在操作组中为代理指定计算机使用工具 - Amazon Bedrock

在操作组中为代理指定计算机使用工具

您可以在 CreateAgentActionGroupUpdateAgentActionGroup API 操作中指定可供代理使用的工具。对于内联代理,您可以在 InvokeInlineAgent API 操作中指定工具。

在操作组的 parentActionGroupSignature 中,您可以从以下值中指定工具类型:

  • ANTHROPIC.Computer

  • ANTHROPIC.TextEditor

  • ANTHROPIC.Bash

以下代码示例演示了如何创建一个操作组,来指定供代理使用的 ANTHROPIC.Computer 工具。

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}")