Skip to content

create_harness

Operation

create_harness

create_harness(request: CreateHarnessInput | CreateHarnessInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateHarnessInputDict]) -> CreateHarnessOutput

Operation to create a harness.

Parameters:

Name Type Description Default
request CreateHarnessInput | CreateHarnessInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[CreateHarnessInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateHarnessOutput

An instance of CreateHarnessOutput.

create_harness async

create_harness(request: CreateHarnessInput | CreateHarnessInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateHarnessInputDict]) -> CreateHarnessOutput

Operation to create a harness.

Parameters:

Name Type Description Default
request CreateHarnessInput | CreateHarnessInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[CreateHarnessInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateHarnessOutput

An instance of CreateHarnessOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

CreateHarnessInputDict

Bases: TypedDict

Dictionary form of CreateHarnessInput.

Attributes

allowed_tools instance-attribute
allowed_tools: Sequence[str] | None

The tools that the agent is allowed to use. Supports glob patterns such as * for all tools, @builtin for all built-in tools, or @serverName/toolName for specific MCP server tools.

authorizer_configuration instance-attribute
authorizer_configuration: AuthorizerConfiguration | AuthorizerConfigurationDict | None

Represents inbound authorization configuration options used to authenticate incoming requests.

client_token instance-attribute
client_token: str | None

A unique, case-sensitive identifier to ensure idempotency of the request.

This field is autopopulated if not provided.

environment instance-attribute

The compute environment configuration for the harness, including network and lifecycle settings.

environment_artifact instance-attribute

The environment artifact for the harness, such as a custom container image containing additional dependencies.

environment_variables instance-attribute
environment_variables: Mapping[str, str] | None

Environment variables to set in the harness runtime environment.

execution_role_arn instance-attribute
execution_role_arn: Required[str]

The ARN of the IAM role that the harness assumes when running. This role must have permissions for the services the agent needs to access, such as Amazon Bedrock for model invocation.

harness_name instance-attribute
harness_name: Required[str]

The name of the harness. Must start with a letter and contain only alphanumeric characters and underscores.

hooks instance-attribute

The lifecycle hooks to run at defined points in the agent loop.

max_iterations instance-attribute
max_iterations: int | None

The maximum number of iterations the agent loop can execute per invocation.

max_tokens instance-attribute
max_tokens: int | None

The maximum total number of output tokens the agent can generate across all model calls within a single invocation.

memory instance-attribute

The AgentCore Memory configuration for persisting conversation context across sessions.

model instance-attribute

The model configuration for the harness. Supports Amazon Bedrock, OpenAI, and Google Gemini model providers.

skills instance-attribute

The skills available to the agent. Skills are bundles of files that the agent can pull into its context on demand.

system_prompt instance-attribute

The system prompt that defines the agent's behavior and instructions.

tags instance-attribute
tags: Mapping[str, str] | None

Tags to apply to the harness resource.

timeout_seconds instance-attribute
timeout_seconds: int | None

The maximum duration in seconds for the agent loop execution per invocation.

tools instance-attribute

The tools available to the agent, such as remote MCP servers, AgentCore Gateway, AgentCore Browser, Code Interpreter, or inline functions.

truncation instance-attribute

The truncation configuration for managing conversation context when it exceeds model limits.

CreateHarnessInput dataclass

Bases: _SerdeShape

Dataclass for CreateHarnessInput structure.

Attributes

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

The tools that the agent is allowed to use. Supports glob patterns such as * for all tools, @builtin for all built-in tools, or @serverName/toolName for specific MCP server tools.

authorizer_configuration class-attribute instance-attribute
authorizer_configuration: AuthorizerConfiguration | None = ...

Represents inbound authorization configuration options used to authenticate incoming requests.

client_token class-attribute instance-attribute
client_token: str | None = ...

A unique, case-sensitive identifier to ensure idempotency of the request.

This field is autopopulated if not provided.

environment class-attribute instance-attribute
environment: HarnessEnvironmentProviderRequest | None = ...

The compute environment configuration for the harness, including network and lifecycle settings.

environment_artifact class-attribute instance-attribute
environment_artifact: HarnessEnvironmentArtifact | None = ...

The environment artifact for the harness, such as a custom container image containing additional dependencies.

environment_variables class-attribute instance-attribute
environment_variables: dict[str, str] | None = ...

Environment variables to set in the harness runtime environment.

execution_role_arn class-attribute instance-attribute
execution_role_arn: str | None = ...

The ARN of the IAM role that the harness assumes when running. This role must have permissions for the services the agent needs to access, such as Amazon Bedrock for model invocation.

harness_name class-attribute instance-attribute
harness_name: str | None = ...

The name of the harness. Must start with a letter and contain only alphanumeric characters and underscores.

hooks class-attribute instance-attribute
hooks: list[HarnessHook] | None = ...

The lifecycle hooks to run at defined points in the agent loop.

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

The maximum number of iterations the agent loop can execute per invocation.

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

The maximum total number of output tokens the agent can generate across all model calls within a single invocation.

memory class-attribute instance-attribute
memory: HarnessMemoryConfiguration | None = ...

The AgentCore Memory configuration for persisting conversation context across sessions.

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

The model configuration for the harness. Supports Amazon Bedrock, OpenAI, and Google Gemini model providers.

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

The skills available to the agent. Skills are bundles of files that the agent can pull into its context on demand.

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

The system prompt that defines the agent's behavior and instructions.

tags class-attribute instance-attribute
tags: dict[str, str] | None = ...

Tags to apply to the harness resource.

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

The maximum duration in seconds for the agent loop execution per invocation.

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

The tools available to the agent, such as remote MCP servers, AgentCore Gateway, AgentCore Browser, Code Interpreter, or inline functions.

truncation class-attribute instance-attribute
truncation: HarnessTruncationConfiguration | None = ...

The truncation configuration for managing conversation context when it exceeds model limits.

Output

CreateHarnessOutput dataclass

Bases: _SerdeShape

Dataclass for CreateHarnessOutput structure.

Attributes

harness instance-attribute
harness: Harness

The harness that was created.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.