CreateHarness
Operation to create a Harness.
Request Syntax
POST /harnesses HTTP/1.1
Content-type: application/json
{
"allowedTools": [ "string" ],
"authorizerConfiguration": { ... },
"clientToken": "string",
"environment": { ... },
"environmentArtifact": { ... },
"environmentVariables": {
"string" : "string"
},
"executionRoleArn": "string",
"harnessName": "string",
"maxIterations": number,
"maxTokens": number,
"memory": { ... },
"model": { ... },
"skills": [
{ ... }
],
"systemPrompt": [
{ ... }
],
"tags": {
"string" : "string"
},
"timeoutSeconds": number,
"tools": [
{
"config": { ... },
"name": "string",
"type": "string"
}
],
"truncation": {
"config": { ... },
"strategy": "string"
}
}
URI Request Parameters
The request does not use any URI parameters.
Request Body
The request accepts the following data in JSON format.
- allowedTools
-
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.
Type: Array of strings
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
(\*|@?[^/]+(/[^/]+)?)Required: No
-
Represents inbound authorization configuration options used to authenticate incoming requests.
Type: AuthorizerConfiguration object
Note: This object is a Union. Only one member of this object can be specified or returned.
Required: No
- clientToken
-
A unique, case-sensitive identifier to ensure idempotency of the request.
Type: String
Length Constraints: Minimum length of 33. Maximum length of 256.
Pattern:
[a-zA-Z0-9](-*[a-zA-Z0-9]){0,256}Required: No
- environment
-
The compute environment configuration for the harness, including network and lifecycle settings.
Type: HarnessEnvironmentProviderRequest object
Note: This object is a Union. Only one member of this object can be specified or returned.
Required: No
- environmentArtifact
-
The environment artifact for the harness, such as a custom container image containing additional dependencies.
Type: HarnessEnvironmentArtifact object
Note: This object is a Union. Only one member of this object can be specified or returned.
Required: No
- environmentVariables
-
Environment variables to set in the harness runtime environment.
Type: String to string map
Map Entries: Minimum number of 0 items. Maximum number of 50 items.
Key Length Constraints: Minimum length of 1. Maximum length of 100.
Value Length Constraints: Minimum length of 0. Maximum length of 5000.
Required: No
- executionRoleArn
-
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.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 2048.
Pattern:
arn:aws(-[^:]+)?:iam::([0-9]{12})?:role/.+Required: Yes
- harnessName
-
The name of the harness. Must start with a letter and contain only alphanumeric characters and underscores.
Type: String
Pattern:
[a-zA-Z][a-zA-Z0-9_]{0,39}Required: Yes
- maxIterations
-
The maximum number of iterations the agent loop can execute per invocation.
Type: Integer
Required: No
- maxTokens
-
The maximum total number of output tokens the agent can generate across all model calls within a single invocation.
Type: Integer
Required: No
- memory
-
The AgentCore Memory configuration for persisting conversation context across sessions.
Type: HarnessMemoryConfiguration object
Note: This object is a Union. Only one member of this object can be specified or returned.
Required: No
- model
-
The model configuration for the harness. Supports Amazon Bedrock, OpenAI, and Google Gemini model providers.
Type: HarnessModelConfiguration object
Note: This object is a Union. Only one member of this object can be specified or returned.
Required: No
- skills
-
The skills available to the agent. Skills are bundles of files that the agent can pull into its context on demand.
Type: Array of HarnessSkill objects
Required: No
- systemPrompt
-
The system prompt that defines the agent's behavior and instructions.
Type: Array of HarnessSystemContentBlock objects
Required: No
-
Tags to apply to the harness resource.
Type: String to string map
Map Entries: Minimum number of 0 items. Maximum number of 50 items.
Key Length Constraints: Minimum length of 1. Maximum length of 128.
Key Pattern:
[a-zA-Z0-9\s._:/=+@-]*Value Length Constraints: Minimum length of 0. Maximum length of 256.
Value Pattern:
[a-zA-Z0-9\s._:/=+@-]*Required: No
- timeoutSeconds
-
The maximum duration in seconds for the agent loop execution per invocation.
Type: Integer
Required: No
- tools
-
The tools available to the agent, such as remote MCP servers, AgentCore Gateway, AgentCore Browser, Code Interpreter, or inline functions.
Type: Array of HarnessTool objects
Required: No
- truncation
-
The truncation configuration for managing conversation context when it exceeds model limits.
Type: HarnessTruncationConfiguration object
Required: No
Response Syntax
HTTP/1.1 201
Content-type: application/json
{
"harness": {
"allowedTools": [ "string" ],
"arn": "string",
"authorizerConfiguration": { ... },
"createdAt": "string",
"environment": { ... },
"environmentArtifact": { ... },
"environmentVariables": {
"string" : "string"
},
"executionRoleArn": "string",
"failureReason": "string",
"harnessId": "string",
"harnessName": "string",
"maxIterations": number,
"maxTokens": number,
"memory": { ... },
"model": { ... },
"skills": [
{ ... }
],
"status": "string",
"systemPrompt": [
{ ... }
],
"timeoutSeconds": number,
"tools": [
{
"config": { ... },
"name": "string",
"type": "string"
}
],
"truncation": {
"config": { ... },
"strategy": "string"
},
"updatedAt": "string"
}
}
Response Elements
If the action is successful, the service sends back an HTTP 201 response.
The following data is returned in JSON format by the service.
Errors
For information about the errors that are common to all actions, see Common Error Types.
- AccessDeniedException
-
This exception is thrown when a request is denied per access permissions
HTTP Status Code: 403
- ConflictException
-
This exception is thrown when there is a conflict performing an operation
HTTP Status Code: 409
- InternalServerException
-
This exception is thrown if there was an unexpected error during processing of request
HTTP Status Code: 500
- ServiceQuotaExceededException
-
This exception is thrown when a request is made beyond the service quota
HTTP Status Code: 402
- ThrottlingException
-
This exception is thrown when the number of requests exceeds the limit
HTTP Status Code: 429
- ValidationException
-
The input fails to satisfy the constraints specified by the service.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: