---
title: "POST /agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text"
method: POST
path: "/agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text"
---

# POST /agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text

`POST /agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text`

Sends a prompt for the agent to process and respond to. Note the following fields for the request:

*   To continue the same conversation with an agent, use the same `sessionId` value in the request.
    
*   To activate trace enablement, turn `enableTrace` to `true`. Trace enablement helps you follow the agent's reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see [Trace enablement](https://docs.aws.amazon.com/bedrock/latest/userguide/agents-test.html#trace-events).
    
*   End a conversation by setting `endSession` to `true`.
    
*   In the `sessionState` object, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group.
    

The response contains both **chunk** and **trace** attributes.

The final response is returned in the `bytes` field of the `chunk` object. The `InvokeAgent` returns one chunk for the entire interaction.

*   The `attribution` object contains citations for parts of the response.
    
*   If you set `enableTrace` to `true` in the request, you can trace the agent's steps and reasoning process that led it to the response.
    
*   If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the `returnControl` field.
    
*   Errors are also surfaced in the response.

## Path parameters

- `agentAliasId` string, required
- `agentId` string, required
- `sessionId` string, required

## Headers

- `x-amz-source-arn` string

## Request body

- object
  - `bedrockModelConfigurations` object — Settings for a model called with <a>InvokeAgent</a>.
    - `performanceConfig` object — The performance configuration for the model.
      - `latency` 'standard' | 'optimized' — To use a latency-optimized version of the model, set to <code>optimized</code>.
  - `enableTrace` boolean — Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-test.html#trace-events">Trace enablement</a>.
  - `endSession` boolean — Specifies whether to end the session with the agent or not.
  - `inputText` string, password — <p>The prompt text to send the agent.</p> <note> <p>If you include <code>returnControlInvocationResults</code> in the <code>sessionState</code> field, the <code>inputText</code> field will be ignored.</p> </note>
  - `memoryId` string — The unique identifier of the agent memory.
  - `promptCreationConfigurations` object — Specifies parameters that control how the service populates the agent prompt for an <code>InvokeAgent</code> or <code>InvokeInlineAgent</code> request. You can control which aspects of previous invocations in the same agent session the service uses to populate the agent prompt. This gives you more granular control over the contextual history that is used to process the current request.
    - `excludePreviousThinkingSteps` boolean — If <code>true</code>, the service removes any content between <code>&lt;thinking&gt;</code> tags from previous conversations in an agent session. The service will only remove content from already processed turns. This helps you remove content which might not be useful for current and subsequent invocations. This can reduce the input token count and potentially save costs. The default value is <code>false</code>.
    - `previousConversationTurnsToInclude` integer — The number of previous conversations from the ongoing agent session to include in the conversation history of the agent prompt, during the current invocation. This gives you more granular control over the context that the model is made aware of, and helps the model remove older context which is no longer useful during the ongoing agent session.
  - `sessionState` object — Contains parameters that specify various attributes that persist across a session or prompt. You can define session state attributes as key-value pairs when writing a <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-lambda.html">Lambda function</a> for an action group or pass them when making an <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html">InvokeAgent</a> request. Use session state attributes to control and provide conversational context for your agent and to help customize your agent's behavior. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html">Control session context</a>.
    - `conversationHistory` object — The state's conversation history.
      - `messages` Message[] — The conversation's messages.
        - `content` ContentBlock[], required — The message's content.
          - `text` string — The block's text.
        - `role` 'user' | 'assistant', required — The message's role.
    - `files` InputFile[] — Contains information about the files used by code interpreter.
      - `name` string, required — The name of the source file.
      - `source` object, required — Specifies where the files are located.
        - `byteContent` object — The data and the text of the attached files.
          - `data` string, password, required — The raw bytes of the file to attach. The maximum size of all files that is attached is 10MB. You can attach a maximum of 5 files.
          - `mediaType` string, required — The MIME type of data contained in the file used for chat.
        - `s3Location` object — The s3 location of the files to attach.
          - `uri` string, required — The uri of the s3 object.
        - `sourceType` 'S3' | 'BYTE_CONTENT', required — The source type of the files to attach.
      - `useCase` 'CODE_INTERPRETER' | 'CHAT', required — Specifies how the source files will be used by the code interpreter.
    - `invocationId` string — The identifier of the invocation of an action. This value must match the <code>invocationId</code> returned in the <code>InvokeAgent</code> response for the action whose results are provided in the <code>returnControlInvocationResults</code> field. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-returncontrol.html">Return control to the agent developer</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html">Control session context</a>.
    - `knowledgeBaseConfigurations` KnowledgeBaseConfiguration[] — An array of configurations, each of which applies to a knowledge base attached to the agent.
      - `knowledgeBaseId` string, required — The unique identifier for a knowledge base attached to the agent.
      - `retrievalConfiguration` object, required — The configurations to apply to the knowledge base during query. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.
        - `managedSearchConfiguration` object — Contains configurations for managed search. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.
          - `filter` RetrievalFilter — <p>Specifies the filters to use on the metadata attributes in the knowledge base data sources before returning results. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>. See the examples below to see how to use these filters.</p> <p>This data type is used in the following API operations:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html#API_agent-runtime_Retrieve_RequestSyntax">Retrieve request</a> – in the <code>filter</code> field</p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_RequestSyntax">RetrieveAndGenerate request</a> – in the <code>filter</code> field</p> </li> </ul>
            - `andAll` RetrievalFilter[] — Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list.
            - `equals` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value matches the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>animal</code> attribute whose value is <code>cat</code>:</p> <p> <code>"equals": { "key": "animal", "value": "cat" }</code> </p>
              - …
            - `greaterThan` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>year</code> attribute whose value is greater than <code>1989</code>:</p> <p> <code>"greaterThan": { "key": "year", "value": 1989 }</code> </p>
              - …
            - `greaterThanOrEquals` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than or equal to the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>year</code> attribute whose value is greater than or equal to <code>1989</code>:</p> <p> <code>"greaterThanOrEquals": { "key": "year", "value": 1989 }</code> </p>
              - …
            - `in` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is in the list specified in the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>animal</code> attribute that is either <code>cat</code> or <code>dog</code>:</p> <p> <code>"in": { "key": "animal", "value": ["cat", "dog"] }</code> </p>
              - …
            - `lessThan` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is less than the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>year</code> attribute whose value is less than to <code>1989</code>.</p> <p> <code>"lessThan": { "key": "year", "value": 1989 }</code> </p>
              - …
            - `lessThanOrEquals` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is less than or equal to the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>year</code> attribute whose value is less than or equal to <code>1989</code>.</p> <p> <code>"lessThanOrEquals": { "key": "year", "value": 1989 }</code> </p>
              - …
            - `listContains` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is a list that contains the <code>value</code> as one of its members.</p> <p>The following example would return data sources with an <code>animals</code> attribute that is a list containing a <code>cat</code> member (for example <code>["dog", "cat"]</code>).</p> <p> <code>"listContains": { "key": "animals", "value": "cat" }</code> </p>
              - …
            - `notEquals` object — <p>Knowledge base data sources are returned when:</p> <ul> <li> <p>It contains a metadata attribute whose name matches the <code>key</code> and whose value doesn't match the <code>value</code> in this object.</p> </li> <li> <p>The key is not present in the document.</p> </li> </ul> <p>The following example would return data sources that don't contain an <code>animal</code> attribute whose value is <code>cat</code>.</p> <p> <code>"notEquals": { "key": "animal", "value": "cat" }</code> </p>
              - …
            - `notIn` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value isn't in the list specified in the <code>value</code> in this object.</p> <p>The following example would return data sources whose <code>animal</code> attribute is neither <code>cat</code> nor <code>dog</code>.</p> <p> <code>"notIn": { "key": "animal", "value": ["cat", "dog"] }</code> </p>
              - …
            - `orAll` RetrievalFilter[] — Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list.
            - `startsWith` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value starts with the <code>value</code> in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores.</p> <p>The following example would return data sources with an <code>animal</code> attribute starts with <code>ca</code> (for example, <code>cat</code> or <code>camel</code>).</p> <p> <code>"startsWith": { "key": "animal", "value": "ca" }</code> </p>
              - …
            - `stringContains` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is one of the following:</p> <ul> <li> <p>A string that contains the <code>value</code> as a substring. The following example would return data sources with an <code>animal</code> attribute that contains the substring <code>at</code> (for example <code>cat</code>).</p> <p> <code>"stringContains": { "key": "animal", "value": "at" }</code> </p> </li> <li> <p>A list with a member that contains the <code>value</code> as a substring. The following example would return data sources with an <code>animals</code> attribute that is a list containing a member that contains the substring <code>at</code> (for example <code>["dog", "cat"]</code>).</p> <p> <code>"stringContains": { "key": "animals", "value": "at" }</code> </p> </li> </ul>
              - …
          - `numberOfResults` integer — The number of results to retrieve.
          - `rerankingConfiguration` object — Contains configurations for reranking the results retrieved from the managed search.
            - `bedrockRerankingConfiguration` object — The Bedrock reranking model configuration for managed search.
              - …
            - `type` 'BEDROCK_RERANKING_MODEL', required — The type of reranking configuration.
          - `rerankingModelType` 'CUSTOM' | 'MANAGED' | 'NONE' — The type of reranking model to use when reranking results retrieved from the managed search. Use <code>CUSTOM</code> to specify a model, <code>MANAGED</code> to use the service default, or <code>NONE</code> to disable reranking.
        - `vectorSearchConfiguration` object — Contains details about how the results from the vector search should be returned. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.
          - `filter` object — Specifies the filters to use on the metadata in the knowledge base data sources before returning results. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-test-config.html">Query configurations</a>.
            - `andAll` RetrievalFilter[] — Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list.
              - …
            - `equals` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value matches the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>animal</code> attribute whose value is <code>cat</code>:</p> <p> <code>"equals": { "key": "animal", "value": "cat" }</code> </p>
              - …
            - `greaterThan` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>year</code> attribute whose value is greater than <code>1989</code>:</p> <p> <code>"greaterThan": { "key": "year", "value": 1989 }</code> </p>
              - …
            - `greaterThanOrEquals` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is greater than or equal to the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>year</code> attribute whose value is greater than or equal to <code>1989</code>:</p> <p> <code>"greaterThanOrEquals": { "key": "year", "value": 1989 }</code> </p>
              - …
            - `in` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is in the list specified in the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>animal</code> attribute that is either <code>cat</code> or <code>dog</code>:</p> <p> <code>"in": { "key": "animal", "value": ["cat", "dog"] }</code> </p>
              - …
            - `lessThan` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is less than the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>year</code> attribute whose value is less than to <code>1989</code>.</p> <p> <code>"lessThan": { "key": "year", "value": 1989 }</code> </p>
              - …
            - `lessThanOrEquals` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is less than or equal to the <code>value</code> in this object.</p> <p>The following example would return data sources with an <code>year</code> attribute whose value is less than or equal to <code>1989</code>.</p> <p> <code>"lessThanOrEquals": { "key": "year", "value": 1989 }</code> </p>
              - …
            - `listContains` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is a list that contains the <code>value</code> as one of its members.</p> <p>The following example would return data sources with an <code>animals</code> attribute that is a list containing a <code>cat</code> member (for example <code>["dog", "cat"]</code>).</p> <p> <code>"listContains": { "key": "animals", "value": "cat" }</code> </p>
              - …
            - `notEquals` object — <p>Knowledge base data sources are returned when:</p> <ul> <li> <p>It contains a metadata attribute whose name matches the <code>key</code> and whose value doesn't match the <code>value</code> in this object.</p> </li> <li> <p>The key is not present in the document.</p> </li> </ul> <p>The following example would return data sources that don't contain an <code>animal</code> attribute whose value is <code>cat</code>.</p> <p> <code>"notEquals": { "key": "animal", "value": "cat" }</code> </p>
              - …
            - `notIn` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value isn't in the list specified in the <code>value</code> in this object.</p> <p>The following example would return data sources whose <code>animal</code> attribute is neither <code>cat</code> nor <code>dog</code>.</p> <p> <code>"notIn": { "key": "animal", "value": ["cat", "dog"] }</code> </p>
              - …
            - `orAll` RetrievalFilter[] — Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list.
              - …
            - `startsWith` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value starts with the <code>value</code> in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores.</p> <p>The following example would return data sources with an <code>animal</code> attribute starts with <code>ca</code> (for example, <code>cat</code> or <code>camel</code>).</p> <p> <code>"startsWith": { "key": "animal", "value": "ca" }</code> </p>
              - …
            - `stringContains` object — <p>Knowledge base data sources are returned if they contain a metadata attribute whose name matches the <code>key</code> and whose value is one of the following:</p> <ul> <li> <p>A string that contains the <code>value</code> as a substring. The following example would return data sources with an <code>animal</code> attribute that contains the substring <code>at</code> (for example <code>cat</code>).</p> <p> <code>"stringContains": { "key": "animal", "value": "at" }</code> </p> </li> <li> <p>A list with a member that contains the <code>value</code> as a substring. The following example would return data sources with an <code>animals</code> attribute that is a list containing a member that contains the substring <code>at</code> (for example <code>["dog", "cat"]</code>).</p> <p> <code>"stringContains": { "key": "animals", "value": "at" }</code> </p> </li> </ul>
              - …
          - `implicitFilterConfiguration` object — Settings for implicit filtering.
            - `metadataAttributes` MetadataAttributeSchema[], required — Metadata that can be used in a filter.
              - …
            - `modelArn` string, required — The model that generates the filter.
          - `numberOfResults` integer — The number of source chunks to retrieve.
          - `overrideSearchType` 'HYBRID' | 'SEMANTIC' — By default, Amazon Bedrock decides a search strategy for you. If you're using an Amazon OpenSearch Serverless vector store that contains a filterable text field, you can specify whether to query the knowledge base with a <code>HYBRID</code> search using both vector embeddings and raw text, or <code>SEMANTIC</code> search using only vector embeddings. For other vector store configurations, only <code>SEMANTIC</code> search is available. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-test.html">Test a knowledge base</a>.
          - `rerankingConfiguration` object — Contains configurations for reranking the retrieved results. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/rerank.html">Improve the relevance of query responses with a reranker model</a>.
            - `bedrockRerankingConfiguration` object — Contains configurations for an Amazon Bedrock reranker model.
              - …
            - `type` 'BEDROCK_RERANKING_MODEL', required — The type of reranker model.
    - `promptSessionAttributes` object — <p>Contains attributes that persist across a prompt and the values of those attributes. </p> <ul> <li> <p>In orchestration prompt template, these attributes replace the $prompt_session_attributes$ placeholder variable. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html">Prompt template placeholder variables</a>.</p> </li> <li> <p>In <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-multi-agent-collaboration.html">multi-agent collaboration</a>, the <code>promptSessionAttributes</code> will only be used by supervisor agent when $prompt_session_attributes$ is present in prompt template. </p> </li> </ul>
    - `returnControlInvocationResults` InvocationResultMember[] — <p>Contains information about the results from the action group invocation. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-returncontrol.html">Return control to the agent developer</a> and <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html">Control session context</a>.</p> <note> <p>If you include this field, the <code>inputText</code> field will be ignored.</p> </note>
      - `apiResult` object — The result from the API response from the action group invocation.
        - `actionGroup` string, required — The action group that the API operation belongs to.
        - `agentId` string — The agent's ID.
        - `apiPath` string, password — The path to the API operation.
        - `confirmationState` 'CONFIRM' | 'DENY' — Controls the API operations or functions to invoke based on the user confirmation.
        - `httpMethod` string — The HTTP method for the API operation.
        - `httpStatusCode` integer — http status code from API execution response (for example: 200, 400, 500).
        - `responseBody` object — The response body from the API operation. The key of the object is the content type (currently, only <code>TEXT</code> is supported). The response may be returned directly or from the Lambda function.
        - `responseState` 'FAILURE' | 'REPROMPT' — Controls the final response state returned to end user when API/Function execution failed. When this state is FAILURE, the request would fail with dependency failure exception. When this state is REPROMPT, the API/function response will be sent to model for re-prompt
      - `functionResult` object — The result from the function from the action group invocation.
        - `actionGroup` string, required — The action group that the function belongs to.
        - `agentId` string — The agent's ID.
        - `confirmationState` 'CONFIRM' | 'DENY' — Contains the user confirmation information about the function that was called.
        - `function` string — The name of the function that was called.
        - `responseBody` object — The response from the function call using the parameters. The response might be returned directly or from the Lambda function. Specify <code>TEXT</code> or <code>IMAGES</code>. The key of the object is the content type. You can only specify one type. If you specify <code>IMAGES</code>, you can specify only one image. You can specify images only when the function in the <code>returnControlInvocationResults</code> is a computer use action. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agent-computer-use.html">Configure an Amazon Bedrock Agent to complete tasks with computer use tools</a>.
        - `responseState` 'FAILURE' | 'REPROMPT' — Controls the final response state returned to end user when API/Function execution failed. When this state is FAILURE, the request would fail with dependency failure exception. When this state is REPROMPT, the API/function response will be sent to model for re-prompt
    - `sessionAttributes` object — Contains attributes that persist across a session and the values of those attributes. If <code>sessionAttributes</code> are passed to a supervisor agent in <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-multi-agent-collaboration.html">multi-agent collaboration</a>, it will be forwarded to all agent collaborators.
  - `streamingConfigurations` object — Configurations for streaming.
    - `applyGuardrailInterval` integer — <p> The guardrail interval to apply as response is generated. By default, the guardrail interval is set to 50 characters. If a larger interval is specified, the response will be generated in larger chunks with fewer <code>ApplyGuardrail</code> calls. The following examples show the response generated for <i>Hello, I am an agent</i> input string.</p> <p> <b>Example response in chunks: Interval set to 3 characters</b> </p> <p> <code>'Hel', 'lo, ','I am', ' an', ' Age', 'nt'</code> </p> <p>Each chunk has at least 3 characters except for the last chunk</p> <p> <b>Example response in chunks: Interval set to 20 or more characters</b> </p> <p> <code>Hello, I am an Agent</code> </p>
    - `streamFinalResponse` boolean — Specifies whether to enable streaming for the final response. This is set to <code>false</code> by default.

## Response `200`

Success

- InvokeAgentResponse
  - `completion` object, required — The agent's response to the user prompt.
    - `accessDeniedException` object — The request is denied because of missing access permissions. Check your permissions and retry your request.
      - `message` string
    - `badGatewayException` object — There was an issue with a dependency due to a server issue. Retry your request.
      - `message` string
      - `resourceName` string — The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS.
    - `chunk` object — Contains a part of an agent response and citations for it.
      - `attribution` object — Contains citations for a part of an agent response.
        - `citations` Citation[] — A list of citations and related information for a part of an agent response.
          - `generatedResponsePart` object — Contains the generated response and metadata
            - `textResponsePart` object — Contains metadata about a textual part of the generated response that is accompanied by a citation.
              - …
          - `retrievedReferences` RetrievedReference[] — Contains metadata about the sources cited for the generated response.
            - `content` object — Contains the cited text from the data source.
              - …
            - `location` object — Contains information about the location of the data source.
              - …
            - `metadata` object — Contains metadata attributes and their values for the file in the data source. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-ds.html#kb-ds-metadata">Metadata and filtering</a>.
      - `bytes` string, password — A part of the agent response in bytes.
    - `conflictException` object — There was a conflict performing an operation. Resolve the conflict and retry your request.
      - `message` string
    - `dependencyFailedException` object — There was an issue with a dependency. Check the resource configurations and retry the request.
      - `message` string
      - `resourceName` string — The name of the dependency that caused the issue, such as Amazon Bedrock, Lambda, or STS.
    - `files` object — Contains intermediate response for code interpreter if any files have been generated.
      - `files` OutputFile[] — Files containing intermediate response for the user.
        - `bytes` string, password — The byte count of files that contains response from code interpreter.
        - `name` string — The name of the file containing response from code interpreter.
        - `type` string — The type of file that contains response from the code interpreter.
    - `internalServerException` object — An internal server error occurred. Retry your request.
      - `message` string
      - `reason` string — The reason for the exception. If the reason is <code>BEDROCK_MODEL_INVOCATION_SERVICE_UNAVAILABLE</code>, the model invocation service is unavailable. Retry your request.
    - `modelNotReadyException` object — The model specified in the request is not ready to serve Inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see <a href="https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html">Retry behavior</a> in the <i>AWS SDKs and Tools</i> reference guide.
      - `message` string
    - `resourceNotFoundException` object — The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
      - `message` string
    - `returnControl` object — Contains the parameters and information that the agent elicited from the customer to carry out an action. This information is returned to the system and can be used in your own setup for fulfilling the action.
      - `invocationId` string — The identifier of the action group invocation.
      - `invocationInputs` InvocationInputMember[] — A list of objects that contain information about the parameters and inputs that need to be sent into the API operation or function, based on what the agent determines from its session with the user.
        - `apiInvocationInput` object — Contains information about the API operation that the agent predicts should be called.
          - `actionGroup` string, required — The action group that the API operation belongs to.
          - `actionInvocationType` 'RESULT' | 'USER_CONFIRMATION' | 'USER_CONFIRMATION_AND_RESULT' — Contains information about the API operation to invoke.
          - `agentId` string — The agent's ID.
          - `apiPath` string, password — The path to the API operation.
          - `collaboratorName` string, password — The agent collaborator's name.
          - `httpMethod` string — The HTTP method of the API operation.
          - `parameters` ApiParameter[] — The parameters to provide for the API request, as the agent elicited from the user.
            - `name` string — The name of the parameter.
            - `type` string — The data type for the parameter.
            - `value` string — The value of the parameter.
          - `requestBody` object — The request body to provide for the API request, as the agent elicited from the user.
            - `content` object — The content of the request body. The key of the object in this field is a media type defining the format of the request body.
        - `functionInvocationInput` object — Contains information about the function that the agent predicts should be called.
          - `actionGroup` string, required — The action group that the function belongs to.
          - `actionInvocationType` 'RESULT' | 'USER_CONFIRMATION' | 'USER_CONFIRMATION_AND_RESULT' — Contains information about the function to invoke,
          - `agentId` string — The agent's ID.
          - `collaboratorName` string, password — The collaborator's name.
          - `function` string — The name of the function.
          - `parameters` FunctionParameter[] — A list of parameters of the function.
            - `name` string — The name of the parameter.
            - `type` string — The data type of the parameter.
            - `value` string — The value of the parameter.
    - `serviceQuotaExceededException` object — The number of requests exceeds the service quota. Resubmit your request later.
      - `message` string
    - `throttlingException` object — The number of requests exceeds the limit. Resubmit your request later.
      - `message` string
    - `trace` object — Contains information about the agent and session, alongside the agent's reasoning process and results from calling actions and querying knowledge bases and metadata about the trace. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/trace-events.html">Trace events</a>.
      - `agentAliasId` string — The unique identifier of the alias of the agent.
      - `agentId` string — The unique identifier of the agent.
      - `agentVersion` string — The version of the agent.
      - `callerChain` Caller[] — The part's caller chain.
        - `agentAliasArn` string — The caller's agent alias ARN.
      - `collaboratorName` string, password — The part's collaborator name.
      - `eventTime` string, date-time — The time of the trace.
      - `sessionId` string — The unique identifier of the session with the agent.
      - `trace` object — Contains one part of the agent's reasoning process and results from calling API actions and querying knowledge bases. You can use the trace to understand how the agent arrived at the response it provided the customer. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/agents-test.html#trace-enablement">Trace enablement</a>.
        - `customOrchestrationTrace` object — Details about the custom orchestration step in which the agent determines the order in which actions are executed.
          - `event` object — The event details used with the custom orchestration.
            - `text` string — The text that prompted the event at this step.
          - `traceId` string — The unique identifier of the trace.
        - `failureTrace` object — Contains information about the failure of the interaction.
          - `failureCode` integer — The failure code for the trace.
          - `failureReason` string, password — The reason the interaction failed.
          - `metadata` object — Information about the failure that occurred.
            - `clientRequestId` string — A unique identifier associated with the downstream invocation. This ID can be used for tracing, debugging, and identifying specific invocations in customer logs or systems.
            - `endTime` string, date-time — In the final response, <code>endTime</code> is the end time of the agent invocation operation.
            - `operationTotalTimeMs` integer — The total time it took for the agent to complete execution. This field is only set for the final response.
            - `startTime` string, date-time — In the final response, <code>startTime</code> is the start time of the agent invocation operation.
            - `totalTimeMs` integer — The total execution time for the specific invocation being processed (model, knowledge base, guardrail, agent collaborator, or code interpreter). It represents how long the individual invocation took.
            - `usage` object — Specific to model invocation and contains details about the usage of a foundation model.
              - …
          - `traceId` string — The unique identifier of the trace.
        - `guardrailTrace` object — The trace details for a trace defined in the Guardrail filter.
          - `action` 'INTERVENED' | 'NONE' — The trace action details used with the Guardrail.
          - `inputAssessments` GuardrailAssessment[] — The details of the input assessments used in the Guardrail Trace.
            - `contentPolicy` object — Content policy details of the Guardrail.
              - …
            - `sensitiveInformationPolicy` object — Sensitive Information policy details of Guardrail.
              - …
            - `topicPolicy` object — Topic policy details of the Guardrail.
              - …
            - `wordPolicy` object — Word policy details of the Guardrail.
              - …
          - `metadata` object — Contains information about the Guardrail output.
            - `clientRequestId` string — A unique identifier associated with the downstream invocation. This ID can be used for tracing, debugging, and identifying specific invocations in customer logs or systems.
            - `endTime` string, date-time — In the final response, <code>endTime</code> is the end time of the agent invocation operation.
            - `operationTotalTimeMs` integer — The total time it took for the agent to complete execution. This field is only set for the final response.
            - `startTime` string, date-time — In the final response, <code>startTime</code> is the start time of the agent invocation operation.
            - `totalTimeMs` integer — The total execution time for the specific invocation being processed (model, knowledge base, guardrail, agent collaborator, or code interpreter). It represents how long the individual invocation took.
            - `usage` object — Specific to model invocation and contains details about the usage of a foundation model.
              - …
          - `outputAssessments` GuardrailAssessment[] — The details of the output assessments used in the Guardrail Trace.
            - `contentPolicy` object — Content policy details of the Guardrail.
              - …
            - `sensitiveInformationPolicy` object — Sensitive Information policy details of Guardrail.
              - …
            - `topicPolicy` object — Topic policy details of the Guardrail.
              - …
            - `wordPolicy` object — Word policy details of the Guardrail.
              - …
          - `traceId` string — The details of the trace Id used in the Guardrail Trace.
        - `orchestrationTrace` object — Details about the orchestration step, in which the agent determines the order in which actions are executed and which knowledge bases are retrieved.
          - `invocationInput` object — Contains information pertaining to the action group or knowledge base that is being invoked.
            - `actionGroupInvocationInput` object — Contains information about the action group to be invoked.
              - …
            - `agentCollaboratorInvocationInput` object — The collaborator's invocation input.
              - …
            - `codeInterpreterInvocationInput` object — Contains information about the code interpreter to be invoked.
              - …
            - `invocationType` 'ACTION_GROUP' | 'KNOWLEDGE_BASE' | 'FINISH' | 'ACTION_GROUP_CODE_INTERPRETER' | 'AGENT_COLLABORATOR' — Specifies whether the agent is invoking an action group or a knowledge base.
            - `knowledgeBaseLookupInput` object — Contains details about the knowledge base to look up and the query to be made.
              - …
            - `traceId` string — The unique identifier of the trace.
          - `modelInvocationInput` object — <p>The input for the orchestration step.</p> <ul> <li> <p>The <code>type</code> is <code>ORCHESTRATION</code>.</p> </li> <li> <p>The <code>text</code> contains the prompt.</p> </li> <li> <p>The <code>inferenceConfiguration</code>, <code>parserMode</code>, and <code>overrideLambda</code> values are set in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object that was set when the agent was created or updated.</p> </li> </ul>
            - `foundationModel` string — The identifier of a foundation model.
            - `inferenceConfiguration` object — Specifications about the inference parameters that were provided alongside the prompt. These are specified in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object that was set when the agent was created or updated. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters for foundation models</a>.
              - …
            - `overrideLambda` string — The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
            - `parserMode` 'DEFAULT' | 'OVERRIDDEN' — Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the <code>promptType</code>.
            - `promptCreationMode` 'DEFAULT' | 'OVERRIDDEN' — Specifies whether the default prompt template was <code>OVERRIDDEN</code>. If it was, the <code>basePromptTemplate</code> that was set in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object when the agent was created or updated is used instead.
            - `text` string, password — The text that prompted the agent at this step.
            - `traceId` string — The unique identifier of the trace.
            - `type` 'PRE_PROCESSING' | 'ORCHESTRATION' | 'KNOWLEDGE_BASE_RESPONSE_GENERATION' | 'POST_PROCESSING' | 'ROUTING_CLASSIFIER' — The step in the agent sequence.
          - `modelInvocationOutput` object — Contains information pertaining to the output from the foundation model that is being invoked.
            - `metadata` object — Contains information about the foundation model output from the orchestration step.
              - …
            - `rawResponse` object — Contains details of the raw response from the foundation model output.
              - …
            - `reasoningContent` object — Contains content about the reasoning that the model made during the orchestration step.
              - …
            - `traceId` string — The unique identifier of the trace.
          - `observation` object — Details about the observation (the output of the action group Lambda or knowledge base) made by the agent.
            - `actionGroupInvocationOutput` object — Contains the JSON-formatted string returned by the API invoked by the action group.
              - …
            - `agentCollaboratorInvocationOutput` object — A collaborator's invocation output.
              - …
            - `codeInterpreterInvocationOutput` object — Contains the JSON-formatted string returned by the API invoked by the code interpreter.
              - …
            - `finalResponse` object — Contains details about the response to the user.
              - …
            - `knowledgeBaseLookupOutput` object — Contains details about the results from looking up the knowledge base.
              - …
            - `repromptResponse` object — Contains details about the response to reprompt the input.
              - …
            - `traceId` string — The unique identifier of the trace.
            - `type` 'ACTION_GROUP' | 'AGENT_COLLABORATOR' | 'KNOWLEDGE_BASE' | 'FINISH' | 'ASK_USER' | 'REPROMPT' — <p>Specifies what kind of information the agent returns in the observation. The following values are possible.</p> <ul> <li> <p> <code>ACTION_GROUP</code> – The agent returns the result of an action group.</p> </li> <li> <p> <code>KNOWLEDGE_BASE</code> – The agent returns information from a knowledge base.</p> </li> <li> <p> <code>FINISH</code> – The agent returns a final response to the user with no follow-up.</p> </li> <li> <p> <code>ASK_USER</code> – The agent asks the user a question.</p> </li> <li> <p> <code>REPROMPT</code> – The agent prompts the user again for the same information.</p> </li> </ul>
          - `rationale` object — Details about the reasoning, based on the input, that the agent uses to justify carrying out an action group or getting information from a knowledge base.
            - `text` string, password — The reasoning or thought process of the agent, based on the input.
            - `traceId` string — The unique identifier of the trace step.
        - `postProcessingTrace` object — Details about the post-processing step, in which the agent shapes the response..
          - `modelInvocationInput` object — <p>The input for the post-processing step.</p> <ul> <li> <p>The <code>type</code> is <code>POST_PROCESSING</code>.</p> </li> <li> <p>The <code>text</code> contains the prompt.</p> </li> <li> <p>The <code>inferenceConfiguration</code>, <code>parserMode</code>, and <code>overrideLambda</code> values are set in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object that was set when the agent was created or updated.</p> </li> </ul>
            - `foundationModel` string — The identifier of a foundation model.
            - `inferenceConfiguration` object — Specifications about the inference parameters that were provided alongside the prompt. These are specified in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object that was set when the agent was created or updated. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters for foundation models</a>.
              - …
            - `overrideLambda` string — The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
            - `parserMode` 'DEFAULT' | 'OVERRIDDEN' — Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the <code>promptType</code>.
            - `promptCreationMode` 'DEFAULT' | 'OVERRIDDEN' — Specifies whether the default prompt template was <code>OVERRIDDEN</code>. If it was, the <code>basePromptTemplate</code> that was set in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object when the agent was created or updated is used instead.
            - `text` string, password — The text that prompted the agent at this step.
            - `traceId` string — The unique identifier of the trace.
            - `type` 'PRE_PROCESSING' | 'ORCHESTRATION' | 'KNOWLEDGE_BASE_RESPONSE_GENERATION' | 'POST_PROCESSING' | 'ROUTING_CLASSIFIER' — The step in the agent sequence.
          - `modelInvocationOutput` object — The foundation model output from the post-processing step.
            - `metadata` object — Contains information about the foundation model output from the post-processing step.
              - …
            - `parsedResponse` object — Details about the response from the Lambda parsing of the output of the post-processing step.
              - …
            - `rawResponse` object — Details of the raw response from the foundation model output.
              - …
            - `reasoningContent` object — Contains content about the reasoning that the model made during the post-processing step.
              - …
            - `traceId` string — The unique identifier of the trace.
        - `preProcessingTrace` object — Details about the pre-processing step, in which the agent contextualizes and categorizes user inputs.
          - `modelInvocationInput` object — <p>The input for the pre-processing step.</p> <ul> <li> <p>The <code>type</code> is <code>PRE_PROCESSING</code>.</p> </li> <li> <p>The <code>text</code> contains the prompt.</p> </li> <li> <p>The <code>inferenceConfiguration</code>, <code>parserMode</code>, and <code>overrideLambda</code> values are set in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object that was set when the agent was created or updated.</p> </li> </ul>
            - `foundationModel` string — The identifier of a foundation model.
            - `inferenceConfiguration` object — Specifications about the inference parameters that were provided alongside the prompt. These are specified in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object that was set when the agent was created or updated. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters for foundation models</a>.
              - …
            - `overrideLambda` string — The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
            - `parserMode` 'DEFAULT' | 'OVERRIDDEN' — Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the <code>promptType</code>.
            - `promptCreationMode` 'DEFAULT' | 'OVERRIDDEN' — Specifies whether the default prompt template was <code>OVERRIDDEN</code>. If it was, the <code>basePromptTemplate</code> that was set in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object when the agent was created or updated is used instead.
            - `text` string, password — The text that prompted the agent at this step.
            - `traceId` string — The unique identifier of the trace.
            - `type` 'PRE_PROCESSING' | 'ORCHESTRATION' | 'KNOWLEDGE_BASE_RESPONSE_GENERATION' | 'POST_PROCESSING' | 'ROUTING_CLASSIFIER' — The step in the agent sequence.
          - `modelInvocationOutput` object — The foundation model output from the pre-processing step.
            - `metadata` object — Contains information about the foundation model output from the pre-processing step.
              - …
            - `parsedResponse` object — Details about the response from the Lambda parsing of the output of the pre-processing step.
              - …
            - `rawResponse` object — Details of the raw response from the foundation model output.
              - …
            - `reasoningContent` object — Contains content about the reasoning that the model made during the pre-processing step.
              - …
            - `traceId` string — The unique identifier of the trace.
        - `routingClassifierTrace` object — A routing classifier's trace.
          - `invocationInput` object — The classifier's invocation input.
            - `actionGroupInvocationInput` object — Contains information about the action group to be invoked.
              - …
            - `agentCollaboratorInvocationInput` object — The collaborator's invocation input.
              - …
            - `codeInterpreterInvocationInput` object — Contains information about the code interpreter to be invoked.
              - …
            - `invocationType` 'ACTION_GROUP' | 'KNOWLEDGE_BASE' | 'FINISH' | 'ACTION_GROUP_CODE_INTERPRETER' | 'AGENT_COLLABORATOR' — Specifies whether the agent is invoking an action group or a knowledge base.
            - `knowledgeBaseLookupInput` object — Contains details about the knowledge base to look up and the query to be made.
              - …
            - `traceId` string — The unique identifier of the trace.
          - `modelInvocationInput` object — The classifier's model invocation input.
            - `foundationModel` string — The identifier of a foundation model.
            - `inferenceConfiguration` object — Specifications about the inference parameters that were provided alongside the prompt. These are specified in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object that was set when the agent was created or updated. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html">Inference parameters for foundation models</a>.
              - …
            - `overrideLambda` string — The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
            - `parserMode` 'DEFAULT' | 'OVERRIDDEN' — Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the <code>promptType</code>.
            - `promptCreationMode` 'DEFAULT' | 'OVERRIDDEN' — Specifies whether the default prompt template was <code>OVERRIDDEN</code>. If it was, the <code>basePromptTemplate</code> that was set in the <a href="https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html">PromptOverrideConfiguration</a> object when the agent was created or updated is used instead.
            - `text` string, password — The text that prompted the agent at this step.
            - `traceId` string — The unique identifier of the trace.
            - `type` 'PRE_PROCESSING' | 'ORCHESTRATION' | 'KNOWLEDGE_BASE_RESPONSE_GENERATION' | 'POST_PROCESSING' | 'ROUTING_CLASSIFIER' — The step in the agent sequence.
          - `modelInvocationOutput` object — The classifier's model invocation output.
            - `metadata` object — The invocation's metadata.
              - …
            - `rawResponse` object — The invocation's raw response.
              - …
            - `traceId` string — The invocation's trace ID.
          - `observation` object — The classifier's observation.
            - `actionGroupInvocationOutput` object — Contains the JSON-formatted string returned by the API invoked by the action group.
              - …
            - `agentCollaboratorInvocationOutput` object — A collaborator's invocation output.
              - …
            - `codeInterpreterInvocationOutput` object — Contains the JSON-formatted string returned by the API invoked by the code interpreter.
              - …
            - `finalResponse` object — Contains details about the response to the user.
              - …
            - `knowledgeBaseLookupOutput` object — Contains details about the results from looking up the knowledge base.
              - …
            - `repromptResponse` object — Contains details about the response to reprompt the input.
              - …
            - `traceId` string — The unique identifier of the trace.
            - `type` 'ACTION_GROUP' | 'AGENT_COLLABORATOR' | 'KNOWLEDGE_BASE' | 'FINISH' | 'ASK_USER' | 'REPROMPT' — <p>Specifies what kind of information the agent returns in the observation. The following values are possible.</p> <ul> <li> <p> <code>ACTION_GROUP</code> – The agent returns the result of an action group.</p> </li> <li> <p> <code>KNOWLEDGE_BASE</code> – The agent returns information from a knowledge base.</p> </li> <li> <p> <code>FINISH</code> – The agent returns a final response to the user with no follow-up.</p> </li> <li> <p> <code>ASK_USER</code> – The agent asks the user a question.</p> </li> <li> <p> <code>REPROMPT</code> – The agent prompts the user again for the same information.</p> </li> </ul>
    - `validationException` object — Input validation failed. Check your request parameters and retry the request.
      - `message` string

## Other responses

- `480` — ModelNotReadyException
- `481` — ResourceNotFoundException
- `482` — ConflictException
- `483` — ValidationException
- `484` — InternalServerException
- `485` — DependencyFailedException
- `486` — BadGatewayException
- `487` — ThrottlingException
- `488` — AccessDeniedException
- `489` — ServiceQuotaExceededException

---

[API](https://skmtc.net/aws/apis/bedrock-agent-runtime.md) · [All operations](https://skmtc.net/aws/apis/bedrock-agent-runtime/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/bedrock-agent-runtime/versions/fe358131c0ad/schema)
