

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在操作组中为代理指定计算机使用工具
<a name="agent-computer-use-create-action-group"></a>

 您可以在 [CreateAgentActionGroup](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_CreateAgentActionGroup.html) 或 [UpdateAgentActionGroup](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_UpdateAgentActionGroup.html) API 操作中指定可供代理使用的工具。对于内联代理，您可以在 [InvokeInlineAgent](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeInlineAgent.html) 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}")
```