本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
您可以在CreateAgentActionGroup或 UpdateAgentActionGroupAPI 操作中指定代理可用的工具。对于内联代理,您可以在 InvokeInlineAgentAPI 操作中指定工具。
在操作组的 “ parentActionGroup签名” 中,您可以从以下值中指定工具类型:
-
Anthropic.com
-
人类。 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}")