Skip to content

BedrockAgentCoreClient.invoke_harness

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

Model summary (excerpt): Operation to invoke a Harness.

Install and imports

python -m pip install "rboto[bedrock-agentcore]==0.4.0"
from rboto import BedrockAgentCoreClient
from collections.abc import Sequence
from rboto_bedrock_agentcore.types import (
    HarnessMessage,
    HarnessModelConfiguration,
    HarnessSkill,
    HarnessSystemContentBlock,
    HarnessTool,
    InvokeHarnessOutput,
)

Signature

async def invoke_harness(
    *,
    harness_arn: str,
    runtime_session_id: str,
    messages: Sequence[HarnessMessage],
    qualifier: str | None = None,
    runtime_user_id: str | None = None,
    trace_parent: str | None = None,
    trace_state: str | None = None,
    trace_id: str | None = None,
    baggage: str | None = None,
    model: HarnessModelConfiguration | None = None,
    system_prompt: Sequence[HarnessSystemContentBlock] | None = None,
    tools: Sequence[HarnessTool] | None = None,
    skills: Sequence[HarnessSkill] | None = None,
    allowed_tools: Sequence[str] | None = None,
    max_iterations: int | None = None,
    max_tokens: int | None = None,
    timeout_seconds: int | None = None,
    actor_id: str | None = None,
) -> InvokeHarnessOutput: ...

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)
harness_arn Yes The ARN of the harness to invoke.
runtime_session_id Yes The session ID for the invocation. Use the same session ID across requests to continue a conversation.
messages Yes The messages to send to the agent.
qualifier No The endpoint name to invoke. If omitted, the DEFAULT endpoint is used.
runtime_user_id No An identifier for the end user making the request. This value is passed through to the runtime container.
trace_parent No W3C trace context parent header containing version, trace ID, parent span ID, and trace flags.
trace_state No W3C trace context state header for vendor-specific trace information.
trace_id No Trace ID for maintaining observability through the operation.
baggage No W3C Baggage header for user-defined context propagation. Format: key1=value1,key2=value2
model No The model configuration to use for this invocation. If specified, overrides the harness default.
system_prompt No The system prompt to use for this invocation. If specified, overrides the harness default.
tools No The tools available to the agent for this invocation. If specified, overrides the harness default.
skills No The skills available to the agent for this invocation. If specified, overrides the harness default.
allowed_tools No The tools that the agent is allowed to use for this invocation. If specified, overrides the harness default.
max_iterations No The maximum number of iterations the agent loop can execute. If specified, overrides the harness default.
max_tokens No The maximum number of tokens the agent can generate per iteration. If specified, overrides the harness default.
timeout_seconds No The maximum duration in seconds for the agent loop execution. If specified, overrides the harness default.
actor_id No The actor ID for memory operations. Overrides the actor ID configured on the harness.

Output

InvokeHarnessOutput.

Typed response mapping, accessed as response["field"].

Field Type Presence References
stream AsyncIterator[InvokeHarnessStreamOutput] Always present InvokeHarnessStreamOutput

| 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.

HarnessMessage, HarnessModelConfiguration, HarnessSkill, HarnessSystemContentBlock, HarnessTool, InvokeHarnessOutput

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: InvokeHarnessOutput.

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

Errors

Import from rboto_bedrock_agentcore.exceptions:

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

Stream decoding may also raise the linked modeled event errors.

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

Service guide · Pinned model