

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 為動作群組中的代理程式指定電腦使用工具
<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}")
```