Spécification des outils informatiques pour l’agent dans un groupe d’actions - Amazon Bedrock

Spécification des outils informatiques pour l’agent dans un groupe d’actions

Vous pouvez spécifier les outils disponibles pour l’agent dans l’opération d’API CreateAgentActionGroup ou UpdateAgentActionGroup. Pour les agents en ligne, vous spécifiez l’outil dans l’opération d’API InvokeInlineAgent.

Dans parentActionGroupSignature du groupe d’actions, spécifiez le type d’outil à partir des valeurs suivantes :

  • ANTHROPIC.Computer

  • ANTHROPIC.TextEditor

  • ANTHROPIC.Bash

L’exemple de code suivant montre comment créer un groupe d’actions qui spécifie l’outil ANTHROPIC.Computer à utiliser par l’agent.

def create_agent_action_group(client, agent_id, agent_version): """ Creates an action group that specifies the ANTHROPIC.Computer tool for the agent. Args: client: Boto3 bedrock-agent client agent_id (str): ID of the agent agent_version (str): Version of the agent Returns: dict: Response from create_agent_action_group API call """ try: response = client.create_agent_action_group( agentId=agent_id, agentVersion=agent_version, actionGroupName="my_computer", actionGroupState="ENABLED", parentActionGroupSignature="ANTHROPIC.Computer", parentActionGroupSignatureParams={ "type": "computer_20241022" } ) return response except ClientError as e: print(f"Error: {e}")