本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
您可以在 CreateAgentActionGroup 或 UpdateAgentActionGroup 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}")