

AWS Chatbot is now Amazon Q Developer. [Learn more](service-rename.md)

# Invoking Amazon Bedrock Agents from chat channels using Amazon Q Developer in chat applications
Invoking Amazon Bedrock Agents

You can invoke Amazon Bedrock Agents directly from your chat channels using Amazon Q Developer in chat applications. Amazon Bedrock Agents are fully managed capabilities that make it easier for you to create generative AI-based applications that can complete complex tasks for a wide range of use cases and deliver up-to-date answers based on proprietary knowledge sources. You can use agents to increase productivity, improve your customer experience, and automate workflows. For more information, see [Automate tasks in your application using conversational agents](https://docs.aws.amazon.com/bedrock/latest/userguide/agents.html) in the *Amazon Bedrock User Guide*.

**Topics**
+ [

## Setting up your chat channel
](#bedrock-setup)
+ [

# Connecting Amazon Bedrock to chat channels
](bedrock-connectors.md)
+ [

# Conversing with your Amazon Bedrock Agent connectors using Amazon Q Developer in chat applications
](bedrock-converse.md)
+ [

# Updating a connector using Amazon Q Developer in chat applications
](bedrock-update.md)
+ [

# Quotas for Amazon Bedrock in Amazon Q Developer in chat applications
](bedrock-limits.md)

## Setting up your chat channel


To invoke an agent from your chat channel with Amazon Q Developer in chat applications, you must ensure that both:
+  The channel or user role has permission to invoke the agent. 
+  The channel guardrail policies include permission to invoke the agent. 
**Tip**  
The most minimal way to achieve this is to create a new IAM policy with just the required `InvokeAgent` permissions and add it to your channel guardrail policies.

The Amazon Q Developer in chat applications Bedrock Agent connector requires the [https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples-agent.html#security_iam_id-based-policy-examples-perform-actions-agent](https://docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples-agent.html#security_iam_id-based-policy-examples-perform-actions-agent) IAM action.

### Example role policy


The following policy is a minimal policy statement with the permissions required to invoke a specific agent. This policy statement is added to the channel or user role used to run AWS SDK commands in your Amazon Q Developer in chat applications channel.

```
{
  "Sid": "AllowInvokeBedrockAgent",
  "Effect": "Allow",
  "Action": "bedrock:InvokeAgent",
  "Resource": [
    "arn:aws:bedrock:aws-region:111122223333:agent-alias/AGENT12345/ALIAS12345"
  ]
}
```

**Note**  
The Agent and Alias IDs are located on the Agent details page in the Amazon Bedrock console. For more information, see [ View information about aliases of agents in Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-alias-view.html) in the *Amazon Bedrock User Guide*.

# Connecting Amazon Bedrock to chat channels
Connecting Amazon Bedrock

 To connect an agent to a chat channel, you must set up a connector. Connector commands are used to manage connectors in your chat channel. Amazon Q Developer in chat applications connectors work by assigning a friendly name to a specific alias of an Amazon Bedrock agent. Once this configuration is defined, you can start conversing with this agent directly in your chat channel.

**To connect an agent to your chat channel**

1. In your chat channel, enter `@Amazon Q connector`. Amazon Q Developer in chat applications responds with a help message, listing the available connector management commands.

1. Add your Amazon Bedrock agent by running `@Amazon Q connector add connector_name arn:aws:bedrock:aws-region:111122223333:agent/AgentID AliasID`.

1. (Optional) View all registered connectors by running `@Amazon Q connector list`.

1. (Optional) Remove connectors by running `@Amazon Q connector delete connector_name`.

**Important**  
Exposing agents to chat channels: By granting a chat channel or user role permission to invoke an agent, they can perform any action that the agent provides. Take careful consideration when exposing agents to chat channels. 
 Shared usage of Amazon Bedrock sessions: The threads that connectors start are visible to all members of the the chat channel, and any member can participate in the session (user roles permitting). Consider this when exposing actions that depend on previous session context, as subsequent requests can be from different users. 
Amazon Bedrock session timeouts: Agents have a configurable idle session TTL after which any session data is forgotten. This is true for interactions with agents within a thread and if the idle session TTL is exceeded, previous contents of the conversation are lost. Further interactions with the agent within this thread maintain the same session ID but may lose the previous session context. 
Amazon Bedrock feature coverage: Connectors in Amazon Q Developer in chat applications are currently intended for use in textual conversations with agents. The use of the **Return Control** features in action groups for richer controls is currently not supported. Any trace context, observations, or linked sources are also currently not included in the final message. You can let us know if these features would be desirable by sending us feedback in your chat channel. 

# Conversing with your Amazon Bedrock Agent connectors using Amazon Q Developer in chat applications
Conversing with Amazon Bedrock Agent connectors

To start a conversation with your agent, run:

`@Amazon Q ask connector_name your message`. This invokes your configured agent with your message within a new session. Your agent's response starts a new thread in your chat channel under the initial message.

Any subsequent mention of `@Amazon Q` in this thread sends the provided message directly to the agent and all interactions in this thread share the same agent and session ID. As such, you can continue to ask questions in this thread without specifying the name of your connector.

# Updating a connector using Amazon Q Developer in chat applications
Updating connectors

If you're publishing a new alias for a Amazon Bedrock, you must replace the connector to converse with this new version. Existing threads can no longer use the old agent alias. You may also need to update the roles and policies for your channel to allow the new alias.

**To update a connector**

1. In your chat channel, run `@Amazon Q connector delete connector_name`.

1. Run `@Amazon Q connector add connector_name arn:aws:bedrock:aws-region:111122223333:agent/AgentID AliasID `.

# Quotas for Amazon Bedrock in Amazon Q Developer in chat applications
Quotas

Your AWS account has the following default quotas, formerly referred to as limits, for Amazon Bedrock.


****  

| Name | Default | Adjustable | Description | 
| --- | --- | --- | --- | 
| Connectors per channel | 10 connectors. | No | The maximum number of registered connectors you can have in a channel. | 
| InvokeAgent request timeout | 120 seconds. | No | The amount of time connectors allow the invokeAgent request to complete | 
| InvokeAgent response truncation | 2,500 characters. | No | The maximum number of characters a response message from an agent can contain. | 
| Connector names | 1-20 letters, digits, dashes or underscores | No | The maximum number of characters a valid connector name can contain. Each connector must have a unique name. | 