Skip to content

Bedrock Agentcore  >  Operations  >  invoke_harness

invoke_harness

Operation

invoke_harness async

invoke_harness(input: InvokeHarnessInput, plugins: list[Plugin] | None = None) -> OutputEventStream[InvokeHarnessStreamOutput, InvokeHarnessOutput]

Operation to invoke a Harness.

Parameters:

Name Type Description Default
input InvokeHarnessInput

An instance of InvokeHarnessInput.

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[InvokeHarnessStreamOutput, InvokeHarnessOutput]

An OutputEventStream for server-to-client streaming.

Input

InvokeHarnessInput dataclass

Dataclass for InvokeHarnessInput structure.

Attributes

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

The actor ID for memory operations. Overrides the actor ID configured on the harness.

allowed_tools class-attribute instance-attribute
allowed_tools: list[str] | None = None

The tools that the agent is allowed to use for this invocation. If specified, overrides the harness default.

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

W3C Baggage header for user-defined context propagation. Format: key1=value1,key2=value2

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

The ARN of the harness to invoke.

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

The maximum number of iterations the agent loop can execute. If specified, overrides the harness default.

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

The maximum number of tokens the agent can generate per iteration. If specified, overrides the harness default.

messages class-attribute instance-attribute
messages: list[HarnessMessage] | None = None

The messages to send to the agent.

model class-attribute instance-attribute
model: HarnessModelConfiguration | None = None

The model configuration to use for this invocation. If specified, overrides the harness default.

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

The endpoint name to invoke. If omitted, the DEFAULT endpoint is used.

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

The session ID for the invocation. Use the same session ID across requests to continue a conversation.

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

An identifier for the end user making the request. This value is passed through to the runtime container.

skills class-attribute instance-attribute
skills: list[HarnessSkill] | None = None

The skills available to the agent for this invocation. If specified, overrides the harness default.

system_prompt class-attribute instance-attribute
system_prompt: list[HarnessSystemContentBlock] | None = None

The system prompt to use for this invocation. If specified, overrides the harness default.

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

The maximum duration in seconds for the agent loop execution. If specified, overrides the harness default.

tools class-attribute instance-attribute
tools: list[HarnessTool] | None = None

The tools available to the agent for this invocation. If specified, overrides the harness default.

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

Trace ID for maintaining observability through the operation.

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

W3C trace context parent header containing version, trace ID, parent span ID, and trace flags.

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

W3C trace context state header for vendor-specific trace information.

Output

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

Event Stream Structure

Output Event Type

InvokeHarnessStreamOutput

Initial Response Structure

InvokeHarnessOutput dataclass

Dataclass for InvokeHarnessOutput structure.