Skip to content

BedrockAgentCoreClient.invoke_agent_runtime

rboto-bedrock-agentcore==0.4.0 · Service index · Types

Model summary (excerpt): Sends a request to an agent or tool hosted in an Amazon Bedrock AgentCore Runtime and receives responses in real-time. To invoke an agent, you can specify either the AgentCore Runtime ARN or the agent ID with an account ID, and provide a payload containing your request. When you use the agent ID instead of the full ARN, you don't need to URL-encode the identifier. You can optionally specify a...

Install and imports

python -m pip install "rboto[bedrock-agentcore]==0.4.0"
from rboto import BedrockAgentCoreClient
from rboto_bedrock_agentcore.types import (
    InvokeAgentRuntimeOutput,
)

Signature

async def invoke_agent_runtime(
    *,
    agent_runtime_arn: str,
    payload: bytes,
    content_type: str | None = None,
    accept: str | None = None,
    mcp_session_id: str | None = None,
    runtime_session_id: str | None = None,
    mcp_protocol_version: str | None = None,
    mcp_method: str | None = None,
    mcp_name: str | None = None,
    runtime_user_id: str | None = None,
    trace_id: str | None = None,
    trace_parent: str | None = None,
    trace_state: str | None = None,
    baggage: str | None = None,
    qualifier: str | None = None,
    account_id: str | None = None,
) -> InvokeAgentRuntimeOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
agent_runtime_arn Yes The identifier of the agent runtime to invoke. You can specify either the full Amazon Web Services Resource Name (ARN) or the agent ID. If you use the agent ID, you must also provide the accountId query parameter.
payload Yes The input data to send to the agent runtime. The format of this data depends on the specific agent configuration and must match the specified content type. For most agents, this is a JSON object containing the user's request.
content_type No The MIME type of the input data in the payload. This tells the agent runtime how to interpret the payload data. Common values include application/json for JSON data.
accept No The desired MIME type for the response from the agent runtime. This tells the agent runtime what format to use for the response data. Common values include application/json for JSON data.
mcp_session_id No The identifier of the MCP session.
runtime_session_id No The identifier of the runtime session.
mcp_protocol_version No The version of the MCP protocol being used.
mcp_method No The MCP method being invoked. For example, tools/call , resources/read , or prompts/get .
mcp_name No The name of the MCP resource, tool, or prompt being accessed. The value depends on the method: tools/call – The tool name. resources/read – The resource URI. prompts/get – The prompt name.
runtime_user_id No The identifier of the runtime user.
trace_id No The trace identifier for request tracking.
trace_parent No The parent trace information for distributed tracing.
trace_state No The trace state information for distributed tracing.
baggage No Additional context information for distributed tracing.
qualifier No The qualifier to use for the agent runtime. This is an endpoint name that points to a specific version. If not specified, Amazon Bedrock AgentCore uses the default endpoint of the agent runtime.
account_id No The identifier of the Amazon Web Services account for the agent runtime resource. This parameter is required when you specify an agent ID instead of the full ARN for agentRuntimeArn .

Output

InvokeAgentRuntimeOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
runtime_session_id str | None Always present —
session_endpoint_url str | None Always present —
mcp_session_id str | None Always present —
mcp_protocol_version str | None Always present —
trace_id str | None Always present —
trace_parent str | None Always present —
trace_state str | None Always present —
baggage str | None Always present —
content_type str Always present —
response ByteStream Always present ByteStream
status_code int | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

InvokeAgentRuntimeOutput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

Output streams: ByteStream.

Consume with async for. Do not reuse a consumed stream.

ByteStream.read() buffers the complete body.

Errors

Import from rboto_bedrock_agentcore.exceptions:

AccessDeniedError, InternalServerError, ResourceNotFoundError, RetryableConflictError, RuntimeClientError, ServiceQuotaExceededError, ThrottlingError, ValidationError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model