Skip to content

Bedrock Agentcore  >  Operations  >  invoke_agent_runtime_command

invoke_agent_runtime_command

Operation

invoke_agent_runtime_command async

invoke_agent_runtime_command(input: InvokeAgentRuntimeCommandInput, plugins: list[Plugin] | None = None) -> OutputEventStream[InvokeAgentRuntimeCommandStreamOutput, InvokeAgentRuntimeCommandOutput]

Executes a command in a runtime session container and streams the output back to the caller. This operation allows you to run shell commands within the agent runtime environment and receive real-time streaming responses including standard output and standard error.

To invoke a command, you must specify the agent runtime ARN and a runtime session ID. The command execution supports streaming responses, allowing you to receive output as it becomes available through contentStart, contentDelta, and contentStop events.

To use this operation, you must have the bedrock-agentcore:InvokeAgentRuntimeCommand permission.

Parameters:

Name Type Description Default
input InvokeAgentRuntimeCommandInput

An instance of InvokeAgentRuntimeCommandInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
OutputEventStream[InvokeAgentRuntimeCommandStreamOutput, InvokeAgentRuntimeCommandOutput]

An OutputEventStream for server-to-client streaming.

Input

InvokeAgentRuntimeCommandInput dataclass

Request for InvokeAgentRuntimeCommand operation.

Attributes

accept class-attribute instance-attribute
accept: str | None = None

The desired MIME type for the response from the agent runtime command. This tells the agent runtime what format to use for the response data. Common values include application/json for JSON data.

account_id class-attribute instance-attribute
account_id: str | None = None

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.

agent_runtime_arn class-attribute instance-attribute
agent_runtime_arn: str | None = None

The Amazon Resource Name (ARN) of the agent runtime on which to execute the command. This identifies the specific agent runtime environment where the command will run.

baggage class-attribute instance-attribute
baggage: str | None = None

Additional context information for distributed tracing.

body class-attribute instance-attribute

The request body containing the command to execute and optional configuration parameters such as timeout settings.

content_type class-attribute instance-attribute
content_type: str | None = None

The MIME type of the input data in the request payload. This tells the agent runtime how to interpret the payload data. Common values include application/json for JSON data.

qualifier class-attribute instance-attribute
qualifier: str | None = None

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.

runtime_session_id class-attribute instance-attribute
runtime_session_id: str | None = None

The unique identifier of the runtime session in which to execute the command. This session ID is used to maintain state and context across multiple command invocations.

trace_id class-attribute instance-attribute
trace_id: str | None = None

The trace identifier for request tracking.

trace_parent class-attribute instance-attribute
trace_parent: str | None = None

The parent trace information for distributed tracing.

trace_state class-attribute instance-attribute
trace_state: str | None = None

The trace state information for distributed tracing.

Output

This operation returns an OutputEventStream for server-to-client streaming.

Event Stream Structure

Output Event Type

InvokeAgentRuntimeCommandStreamOutput

Initial Response Structure

InvokeAgentRuntimeCommandOutput dataclass

Response for InvokeAgentRuntimeCommand operation.

Attributes
baggage class-attribute instance-attribute
baggage: str | None = None

Additional context information for distributed tracing.

content_type instance-attribute
content_type: str

The MIME type of the response data. This indicates how to interpret the response data. Common values include application/json for JSON data.

runtime_session_id class-attribute instance-attribute
runtime_session_id: str | None = None

The unique identifier of the runtime session in which the command was executed.

status_code class-attribute instance-attribute
status_code: int | None = None

The HTTP status code of the response. A status code of 200 indicates a successful operation. Other status codes indicate various error conditions.

trace_id class-attribute instance-attribute
trace_id: str | None = None

The trace identifier for request tracking.

trace_parent class-attribute instance-attribute
trace_parent: str | None = None

The parent trace information for distributed tracing.

trace_state class-attribute instance-attribute
trace_state: str | None = None

The trace state information for distributed tracing.