AgentcoreHarness class

Manages an AWS Bedrock AgentCore Harness. A Harness is a managed agent loop that wraps model configuration, tools, skills, memory, and compute environment into a single deployable unit.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const assumeRole = aws.iam.getPolicyDocument({
    statements: [{
        principals: [{
            type: "Service",
            identifiers: ["bedrock-agentcore.amazonaws.com"],
        }],
        effect: "Allow",
        actions: ["sts:AssumeRole"],
    }],
});
const example = new aws.iam.Role("example", {
    name: "bedrock-agentcore-harness-role",
    assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
});
const exampleRolePolicy = new aws.iam.RolePolicy("example", {
    role: example.name,
    policy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [{
            Effect: "Allow",
            Action: [
                "bedrock:InvokeModel",
                "bedrock:InvokeModelWithResponseStream",
            ],
            Resource: "*",
        }],
    }),
});
const exampleAgentcoreHarness = new aws.bedrock.AgentcoreHarness("example", {
    model: {
        bedrockModelConfig: {
            modelId: "anthropic.claude-sonnet-4-20250514",
        },
    },
    systemPrompts: [{
        text: "You are a helpful assistant.",
    }],
    harnessName: "example_harness",
    executionRoleArn: example.arn,
});
import pulumi
import json
import pulumi_aws as aws

assume_role = aws.iam.get_policy_document(statements=[{
    "principals": [{
        "type": "Service",
        "identifiers": ["bedrock-agentcore.amazonaws.com"],
    }],
    "effect": "Allow",
    "actions": ["sts:AssumeRole"],
}])
example = aws.iam.Role("example",
    name="bedrock-agentcore-harness-role",
    assume_role_policy=assume_role.json)
example_role_policy = aws.iam.RolePolicy("example",
    role=example.name,
    policy=json.dumps({
        "Version": "2012-10-17",
        "Statement": [{
            "Effect": "Allow",
            "Action": [
                "bedrock:InvokeModel",
                "bedrock:InvokeModelWithResponseStream",
            ],
            "Resource": "*",
        }],
    }))
example_agentcore_harness = aws.bedrock.AgentcoreHarness("example",
    model={
        "bedrock_model_config": {
            "model_id": "anthropic.claude-sonnet-4-20250514",
        },
    },
    system_prompts=[{
        "text": "You are a helpful assistant.",
    }],
    harness_name="example_harness",
    execution_role_arn=example.arn)
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "bedrock-agentcore.amazonaws.com",
                        },
                    },
                },
                Effect = "Allow",
                Actions = new[]
                {
                    "sts:AssumeRole",
                },
            },
        },
    });

    var example = new Aws.Iam.Role("example", new()
    {
        Name = "bedrock-agentcore-harness-role",
        AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var exampleRolePolicy = new Aws.Iam.RolePolicy("example", new()
    {
        Role = example.Name,
        Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Version"] = "2012-10-17",
            ["Statement"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["Effect"] = "Allow",
                    ["Action"] = new[]
                    {
                        "bedrock:InvokeModel",
                        "bedrock:InvokeModelWithResponseStream",
                    },
                    ["Resource"] = "*",
                },
            },
        }),
    });

    var exampleAgentcoreHarness = new Aws.Bedrock.AgentcoreHarness("example", new()
    {
        Model = new Aws.Bedrock.Inputs.AgentcoreHarnessModelArgs
        {
            BedrockModelConfig = new Aws.Bedrock.Inputs.AgentcoreHarnessModelBedrockModelConfigArgs
            {
                ModelId = "anthropic.claude-sonnet-4-20250514",
            },
        },
        SystemPrompts = new[]
        {
            new Aws.Bedrock.Inputs.AgentcoreHarnessSystemPromptArgs
            {
                Text = "You are a helpful assistant.",
            },
        },
        HarnessName = "example_harness",
        ExecutionRoleArn = example.Arn,
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/bedrock"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "Service",
							Identifiers: []string{
								"bedrock-agentcore.amazonaws.com",
							},
						},
					},
					Effect: pulumi.StringRef("Allow"),
					Actions: []string{
						"sts:AssumeRole",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		example, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
			Name:             pulumi.String("bedrock-agentcore-harness-role"),
			AssumeRolePolicy: pulumi.String(assumeRole.Json),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Version": "2012-10-17",
			"Statement": []map[string]interface{}{
				map[string]interface{}{
					"Effect": "Allow",
					"Action": []string{
						"bedrock:InvokeModel",
						"bedrock:InvokeModelWithResponseStream",
					},
					"Resource": "*",
				},
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = iam.NewRolePolicy(ctx, "example", &iam.RolePolicyArgs{
			Role:   example.Name,
			Policy: pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		_, err = bedrock.NewAgentcoreHarness(ctx, "example", &bedrock.AgentcoreHarnessArgs{
			Model: &bedrock.AgentcoreHarnessModelArgs{
				BedrockModelConfig: &bedrock.AgentcoreHarnessModelBedrockModelConfigArgs{
					ModelId: pulumi.String("anthropic.claude-sonnet-4-20250514"),
				},
			},
			SystemPrompts: bedrock.AgentcoreHarnessSystemPromptArray{
				&bedrock.AgentcoreHarnessSystemPromptArgs{
					Text: pulumi.String("You are a helpful assistant."),
				},
			},
			HarnessName:      pulumi.String("example_harness"),
			ExecutionRoleArn: example.Arn,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_iam_getpolicydocument" "assumeRole" {
  statements {
    principals {
      type        = "Service"
      identifiers = ["bedrock-agentcore.amazonaws.com"]
    }
    effect  = "Allow"
    actions = ["sts:AssumeRole"]
  }
}

resource "aws_iam_role" "example" {
  name               = "bedrock-agentcore-harness-role"
  assume_role_policy = data.aws_iam_getpolicydocument.assumeRole.json
}
resource "aws_iam_rolepolicy" "example" {
  role = aws_iam_role.example.name
  policy = jsonencode({
    "Version" = "2012-10-17"
    "Statement" = [{
      "Effect"   = "Allow"
      "Action"   = ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"]
      "Resource" = "*"
    }]
  })
}
resource "aws_bedrock_agentcoreharness" "example" {
  model = {
    bedrock_model_config = {
      model_id = "anthropic.claude-sonnet-4-20250514"
    }
  }
  system_prompts {
    text = "You are a helpful assistant."
  }
  harness_name       = "example_harness"
  execution_role_arn = aws_iam_role.example.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.aws.bedrock.AgentcoreHarness;
import com.pulumi.aws.bedrock.AgentcoreHarnessArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessModelArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessModelBedrockModelConfigArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessSystemPromptArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .type("Service")
                    .identifiers("bedrock-agentcore.amazonaws.com")
                    .build())
                .effect("Allow")
                .actions("sts:AssumeRole")
                .build())
            .build());

        var example = new Role("example", RoleArgs.builder()
            .name("bedrock-agentcore-harness-role")
            .assumeRolePolicy(assumeRole.json())
            .build());

        var exampleRolePolicy = new RolePolicy("exampleRolePolicy", RolePolicyArgs.builder()
            .role(example.name())
            .policy(serializeJson(
                jsonObject(
                    jsonProperty("Version", "2012-10-17"),
                    jsonProperty("Statement", jsonArray(jsonObject(
                        jsonProperty("Effect", "Allow"),
                        jsonProperty("Action", jsonArray(
                            "bedrock:InvokeModel",
                            "bedrock:InvokeModelWithResponseStream"
                        )),
                        jsonProperty("Resource", "*")
                    )))
                )))
            .build());

        var exampleAgentcoreHarness = new AgentcoreHarness("exampleAgentcoreHarness", AgentcoreHarnessArgs.builder()
            .model(AgentcoreHarnessModelArgs.builder()
                .bedrockModelConfig(AgentcoreHarnessModelBedrockModelConfigArgs.builder()
                    .modelId("anthropic.claude-sonnet-4-20250514")
                    .build())
                .build())
            .systemPrompts(AgentcoreHarnessSystemPromptArgs.builder()
                .text("You are a helpful assistant.")
                .build())
            .harnessName("example_harness")
            .executionRoleArn(example.arn())
            .build());

    }
}
resources:
  example:
    type: aws:iam:Role
    properties:
      name: bedrock-agentcore-harness-role
      assumeRolePolicy: ${assumeRole.json}
  exampleRolePolicy:
    type: aws:iam:RolePolicy
    name: example
    properties:
      role: ${example.name}
      policy:
        fn::toJSON:
          Version: 2012-10-17
          Statement:
            - Effect: Allow
              Action:
                - bedrock:InvokeModel
                - bedrock:InvokeModelWithResponseStream
              Resource: '*'
  exampleAgentcoreHarness:
    type: aws:bedrock:AgentcoreHarness
    name: example
    properties:
      model:
        bedrockModelConfig:
          modelId: anthropic.claude-sonnet-4-20250514
      systemPrompts:
        - text: You are a helpful assistant.
      harnessName: example_harness
      executionRoleArn: ${example.arn}
variables:
  assumeRole:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - principals:
              - type: Service
                identifiers:
                  - bedrock-agentcore.amazonaws.com
            effect: Allow
            actions:
              - sts:AssumeRole

With Tools and Truncation

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.bedrock.AgentcoreHarness("example", {
    model: {
        bedrockModelConfig: {
            modelId: "anthropic.claude-sonnet-4-20250514",
            temperature: 0.7,
            topP: 0.9,
        },
    },
    systemPrompts: [{
        text: "You are a coding assistant.",
    }],
    tools: [{
        config: {
            inlineFunction: {
                description: "Get the current weather for a location",
                inputSchema: JSON.stringify({
                    type: "object",
                    properties: {
                        location: {
                            type: "string",
                            description: "City name",
                        },
                    },
                    required: ["location"],
                }),
            },
        },
        type: "inline_function",
        name: "get_weather",
    }],
    truncations: [{
        config: [{
            slidingWindow: [{
                messagesCount: 50,
            }],
        }],
        strategy: "sliding_window",
    }],
    harnessName: "example_with_tools",
    executionRoleArn: exampleAwsIamRole.arn,
    allowedTools: ["*"],
    maxIterations: 10,
    maxTokens: 4096,
    timeoutSeconds: 300,
});
import pulumi
import json
import pulumi_aws as aws

example = aws.bedrock.AgentcoreHarness("example",
    model={
        "bedrock_model_config": {
            "model_id": "anthropic.claude-sonnet-4-20250514",
            "temperature": 0.7,
            "top_p": 0.9,
        },
    },
    system_prompts=[{
        "text": "You are a coding assistant.",
    }],
    tools=[{
        "config": {
            "inline_function": {
                "description": "Get the current weather for a location",
                "input_schema": json.dumps({
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "City name",
                        },
                    },
                    "required": ["location"],
                }),
            },
        },
        "type": "inline_function",
        "name": "get_weather",
    }],
    truncations=[{
        "config": [{
            "slidingWindow": [{
                "messagesCount": 50,
            }],
        }],
        "strategy": "sliding_window",
    }],
    harness_name="example_with_tools",
    execution_role_arn=example_aws_iam_role["arn"],
    allowed_tools=["*"],
    max_iterations=10,
    max_tokens=4096,
    timeout_seconds=300)
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Bedrock.AgentcoreHarness("example", new()
    {
        Model = new Aws.Bedrock.Inputs.AgentcoreHarnessModelArgs
        {
            BedrockModelConfig = new Aws.Bedrock.Inputs.AgentcoreHarnessModelBedrockModelConfigArgs
            {
                ModelId = "anthropic.claude-sonnet-4-20250514",
                Temperature = 0.7,
                TopP = 0.9,
            },
        },
        SystemPrompts = new[]
        {
            new Aws.Bedrock.Inputs.AgentcoreHarnessSystemPromptArgs
            {
                Text = "You are a coding assistant.",
            },
        },
        Tools = new[]
        {
            new Aws.Bedrock.Inputs.AgentcoreHarnessToolArgs
            {
                Config = new Aws.Bedrock.Inputs.AgentcoreHarnessToolConfigArgs
                {
                    InlineFunction = new Aws.Bedrock.Inputs.AgentcoreHarnessToolConfigInlineFunctionArgs
                    {
                        Description = "Get the current weather for a location",
                        InputSchema = JsonSerializer.Serialize(new Dictionary<string, object?>
                        {
                            ["type"] = "object",
                            ["properties"] = new Dictionary<string, object?>
                            {
                                ["location"] = new Dictionary<string, object?>
                                {
                                    ["type"] = "string",
                                    ["description"] = "City name",
                                },
                            },
                            ["required"] = new[]
                            {
                                "location",
                            },
                        }),
                    },
                },
                Type = "inline_function",
                Name = "get_weather",
            },
        },
        Truncations = new[]
        {
            new Aws.Bedrock.Inputs.AgentcoreHarnessTruncationArgs
            {
                Config = new[]
                {

                    {
                        { "slidingWindow", new[]
                        {

                            {
                                { "messagesCount", 50 },
                            },
                        } },
                    },
                },
                Strategy = "sliding_window",
            },
        },
        HarnessName = "example_with_tools",
        ExecutionRoleArn = exampleAwsIamRole.Arn,
        AllowedTools = new[]
        {
            "*",
        },
        MaxIterations = 10,
        MaxTokens = 4096,
        TimeoutSeconds = 300,
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/bedrock"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"type": "object",
			"properties": map[string]map[string]string{
				"location": map[string]string{
					"type":        "string",
					"description": "City name",
				},
			},
			"required": []string{
				"location",
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = bedrock.NewAgentcoreHarness(ctx, "example", &bedrock.AgentcoreHarnessArgs{
			Model: &bedrock.AgentcoreHarnessModelArgs{
				BedrockModelConfig: &bedrock.AgentcoreHarnessModelBedrockModelConfigArgs{
					ModelId:     pulumi.String("anthropic.claude-sonnet-4-20250514"),
					Temperature: pulumi.Float64(0.7),
					TopP:        pulumi.Float64(0.9),
				},
			},
			SystemPrompts: bedrock.AgentcoreHarnessSystemPromptArray{
				&bedrock.AgentcoreHarnessSystemPromptArgs{
					Text: pulumi.String("You are a coding assistant."),
				},
			},
			Tools: bedrock.AgentcoreHarnessToolArray{
				&bedrock.AgentcoreHarnessToolArgs{
					Config: &bedrock.AgentcoreHarnessToolConfigArgs{
						InlineFunction: &bedrock.AgentcoreHarnessToolConfigInlineFunctionArgs{
							Description: pulumi.String("Get the current weather for a location"),
							InputSchema: pulumi.String(json0),
						},
					},
					Type: pulumi.String("inline_function"),
					Name: pulumi.String("get_weather"),
				},
			},
			Truncations: bedrock.AgentcoreHarnessTruncationArray{
				&bedrock.AgentcoreHarnessTruncationArgs{
					Config: []map[string][]map[string]int{
						{
							"slidingWindow": []map[string]int{
								{
									"messagesCount": 50,
								},
							},
						},
					},
					Strategy: pulumi.String("sliding_window"),
				},
			},
			HarnessName:      pulumi.String("example_with_tools"),
			ExecutionRoleArn: pulumi.Any(exampleAwsIamRole.Arn),
			AllowedTools: pulumi.StringArray{
				pulumi.String("*"),
			},
			MaxIterations:  pulumi.Int(10),
			MaxTokens:      pulumi.Int(4096),
			TimeoutSeconds: pulumi.Int(300),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_bedrock_agentcoreharness" "example" {
  model = {
    bedrock_model_config = {
      model_id    = "anthropic.claude-sonnet-4-20250514"
      temperature = 0.7
      top_p       = 0.9
    }
  }
  system_prompts {
    text = "You are a coding assistant."
  }
  tools {
    config = {
      inline_function = {
        description = "Get the current weather for a location"
        input_schema = jsonencode({
          "type" = "object"
          "properties" = {
            "location" = {
              "type"        = "string"
              "description" = "City name"
            }
          }
          "required" = ["location"]
        })
      }
    }
    type = "inline_function"
    name = "get_weather"
  }
  truncations {
    config = [{
      "slidingWindow" = [{
        "messagesCount" = 50
      }]
    }]
    strategy = "sliding_window"
  }
  harness_name       = "example_with_tools"
  execution_role_arn = exampleAwsIamRole.arn
  allowed_tools      = ["*"]
  max_iterations     = 10
  max_tokens         = 4096
  timeout_seconds    = 300
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.bedrock.AgentcoreHarness;
import com.pulumi.aws.bedrock.AgentcoreHarnessArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessModelArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessModelBedrockModelConfigArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessSystemPromptArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessToolArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessToolConfigArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessToolConfigInlineFunctionArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessTruncationArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new AgentcoreHarness("example", AgentcoreHarnessArgs.builder()
            .model(AgentcoreHarnessModelArgs.builder()
                .bedrockModelConfig(AgentcoreHarnessModelBedrockModelConfigArgs.builder()
                    .modelId("anthropic.claude-sonnet-4-20250514")
                    .temperature(0.7)
                    .topP(0.9)
                    .build())
                .build())
            .systemPrompts(AgentcoreHarnessSystemPromptArgs.builder()
                .text("You are a coding assistant.")
                .build())
            .tools(AgentcoreHarnessToolArgs.builder()
                .config(AgentcoreHarnessToolConfigArgs.builder()
                    .inlineFunction(AgentcoreHarnessToolConfigInlineFunctionArgs.builder()
                        .description("Get the current weather for a location")
                        .inputSchema(serializeJson(
                            jsonObject(
                                jsonProperty("type", "object"),
                                jsonProperty("properties", jsonObject(
                                    jsonProperty("location", jsonObject(
                                        jsonProperty("type", "string"),
                                        jsonProperty("description", "City name")
                                    ))
                                )),
                                jsonProperty("required", jsonArray("location"))
                            )))
                        .build())
                    .build())
                .type("inline_function")
                .name("get_weather")
                .build())
            .truncations(AgentcoreHarnessTruncationArgs.builder()
                .config(Arrays.asList(Map.of("slidingWindow", Arrays.asList(Map.of("messagesCount", 50)))))
                .strategy("sliding_window")
                .build())
            .harnessName("example_with_tools")
            .executionRoleArn(exampleAwsIamRole.arn())
            .allowedTools("*")
            .maxIterations(10)
            .maxTokens(4096)
            .timeoutSeconds(300)
            .build());

    }
}
resources:
  example:
    type: aws:bedrock:AgentcoreHarness
    properties:
      model:
        bedrockModelConfig:
          modelId: anthropic.claude-sonnet-4-20250514
          temperature: 0.7
          topP: 0.9
      systemPrompts:
        - text: You are a coding assistant.
      tools:
        - config:
            inlineFunction:
              description: Get the current weather for a location
              inputSchema:
                fn::toJSON:
                  type: object
                  properties:
                    location:
                      type: string
                      description: City name
                  required:
                    - location
          type: inline_function
          name: get_weather
      truncations:
        - config:
            - slidingWindow:
                - messagesCount: 50
          strategy: sliding_window
      harnessName: example_with_tools
      executionRoleArn: ${exampleAwsIamRole.arn}
      allowedTools:
        - '*'
      maxIterations: 10
      maxTokens: 4096
      timeoutSeconds: 300

With Managed Memory

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.bedrock.AgentcoreHarness("example", {
    model: {
        bedrockModelConfig: {
            modelId: "anthropic.claude-sonnet-4-20250514",
        },
    },
    memory: {
        managedMemoryConfiguration: {
            eventExpiryDuration: 14,
            strategies: [
                "SEMANTIC",
                "SUMMARIZATION",
            ],
        },
    },
    systemPrompts: [{
        text: "You are a helpful assistant.",
    }],
    harnessName: "my_harness",
    executionRoleArn: exampleAwsIamRole.arn,
});
import pulumi
import pulumi_aws as aws

example = aws.bedrock.AgentcoreHarness("example",
    model={
        "bedrock_model_config": {
            "model_id": "anthropic.claude-sonnet-4-20250514",
        },
    },
    memory={
        "managed_memory_configuration": {
            "event_expiry_duration": 14,
            "strategies": [
                "SEMANTIC",
                "SUMMARIZATION",
            ],
        },
    },
    system_prompts=[{
        "text": "You are a helpful assistant.",
    }],
    harness_name="my_harness",
    execution_role_arn=example_aws_iam_role["arn"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Bedrock.AgentcoreHarness("example", new()
    {
        Model = new Aws.Bedrock.Inputs.AgentcoreHarnessModelArgs
        {
            BedrockModelConfig = new Aws.Bedrock.Inputs.AgentcoreHarnessModelBedrockModelConfigArgs
            {
                ModelId = "anthropic.claude-sonnet-4-20250514",
            },
        },
        Memory = new Aws.Bedrock.Inputs.AgentcoreHarnessMemoryArgs
        {
            ManagedMemoryConfiguration = new Aws.Bedrock.Inputs.AgentcoreHarnessMemoryManagedMemoryConfigurationArgs
            {
                EventExpiryDuration = 14,
                Strategies = new[]
                {
                    "SEMANTIC",
                    "SUMMARIZATION",
                },
            },
        },
        SystemPrompts = new[]
        {
            new Aws.Bedrock.Inputs.AgentcoreHarnessSystemPromptArgs
            {
                Text = "You are a helpful assistant.",
            },
        },
        HarnessName = "my_harness",
        ExecutionRoleArn = exampleAwsIamRole.Arn,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/bedrock"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := bedrock.NewAgentcoreHarness(ctx, "example", &bedrock.AgentcoreHarnessArgs{
			Model: &bedrock.AgentcoreHarnessModelArgs{
				BedrockModelConfig: &bedrock.AgentcoreHarnessModelBedrockModelConfigArgs{
					ModelId: pulumi.String("anthropic.claude-sonnet-4-20250514"),
				},
			},
			Memory: &bedrock.AgentcoreHarnessMemoryArgs{
				ManagedMemoryConfiguration: &bedrock.AgentcoreHarnessMemoryManagedMemoryConfigurationArgs{
					EventExpiryDuration: pulumi.Int(14),
					Strategies: pulumi.StringArray{
						pulumi.String("SEMANTIC"),
						pulumi.String("SUMMARIZATION"),
					},
				},
			},
			SystemPrompts: bedrock.AgentcoreHarnessSystemPromptArray{
				&bedrock.AgentcoreHarnessSystemPromptArgs{
					Text: pulumi.String("You are a helpful assistant."),
				},
			},
			HarnessName:      pulumi.String("my_harness"),
			ExecutionRoleArn: pulumi.Any(exampleAwsIamRole.Arn),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_bedrock_agentcoreharness" "example" {
  model = {
    bedrock_model_config = {
      model_id = "anthropic.claude-sonnet-4-20250514"
    }
  }
  memory = {
    managed_memory_configuration = {
      event_expiry_duration = 14
      strategies            = ["SEMANTIC", "SUMMARIZATION"]
    }
  }
  system_prompts {
    text = "You are a helpful assistant."
  }
  harness_name       = "my_harness"
  execution_role_arn = exampleAwsIamRole.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.bedrock.AgentcoreHarness;
import com.pulumi.aws.bedrock.AgentcoreHarnessArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessModelArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessModelBedrockModelConfigArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessMemoryArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessMemoryManagedMemoryConfigurationArgs;
import com.pulumi.aws.bedrock.inputs.AgentcoreHarnessSystemPromptArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new AgentcoreHarness("example", AgentcoreHarnessArgs.builder()
            .model(AgentcoreHarnessModelArgs.builder()
                .bedrockModelConfig(AgentcoreHarnessModelBedrockModelConfigArgs.builder()
                    .modelId("anthropic.claude-sonnet-4-20250514")
                    .build())
                .build())
            .memory(AgentcoreHarnessMemoryArgs.builder()
                .managedMemoryConfiguration(AgentcoreHarnessMemoryManagedMemoryConfigurationArgs.builder()
                    .eventExpiryDuration(14)
                    .strategies(
                        "SEMANTIC",
                        "SUMMARIZATION")
                    .build())
                .build())
            .systemPrompts(AgentcoreHarnessSystemPromptArgs.builder()
                .text("You are a helpful assistant.")
                .build())
            .harnessName("my_harness")
            .executionRoleArn(exampleAwsIamRole.arn())
            .build());

    }
}
resources:
  example:
    type: aws:bedrock:AgentcoreHarness
    properties:
      model:
        bedrockModelConfig:
          modelId: anthropic.claude-sonnet-4-20250514
      memory:
        managedMemoryConfiguration:
          eventExpiryDuration: 14
          strategies:
            - SEMANTIC
            - SUMMARIZATION
      systemPrompts:
        - text: You are a helpful assistant.
      harnessName: my_harness
      executionRoleArn: ${exampleAwsIamRole.arn}

Import

Identity Schema

Required

  • harnessId (String) ID of the harness.

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import Bedrock AgentCore Harnesses using harnessId. For example:

$ pulumi import aws:bedrock/agentcoreHarness:AgentcoreHarness example example-Ab12Cd34Ef

Constructors

AgentcoreHarness(String name, {AgentcoreHarnessArgs? args, CustomResourceOptions? options})
Creates a new AgentcoreHarness. name The Pulumi resource name. args Arguments used to configure this AgentcoreHarness. The set of arguments for AgentcoreHarness. options Resource options controlling this resource's behavior.
AgentcoreHarness.reference(String urn)
Creates a typed reference to an existing AgentcoreHarness resource.

Properties

allowedTools ↔ Output<List<String>>
List of tool names allowed for the harness. Use ["*"] to allow all tools.
latefinal
arn ↔ Output<String>
ARN of the Harness.
latefinal
authorizerConfiguration ↔ Output<AgentcoreHarnessAuthorizerConfiguration?>
Authorization configuration for authenticating requests. See authorizerConfiguration Block below.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
environmentActuals ↔ Output<List<AgentcoreHarnessEnvironmentActual>>
Actual deployed environment configuration.
latefinal
environmentArtifact ↔ Output<AgentcoreHarnessEnvironmentArtifact?>
Environment artifact configuration. See environmentArtifact Block below.
latefinal
environments ↔ Output<List<AgentcoreHarnessEnvironment>?>
Compute environment configuration. See environment Block below.If not specified, configured values can be found in environmentActual. Clearing this value will leave the environment configuration as is, but Terraform will not track changes.
latefinal
environmentVariables ↔ Output<Map<String, String>?>
Map of environment variables.
latefinal
executionRoleArn ↔ Output<String>
ARN of the IAM role that the harness assumes to access AWS services.
latefinal
harnessId ↔ Output<String>
Unique identifier of the Harness.
latefinal
harnessName ↔ Output<String>
Name of the harness. Must be 1-40 characters, alphanumeric and underscores only.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
maxIterations ↔ Output<int>
Maximum number of iterations the agent loop can perform.
latefinal
maxTokens ↔ Output<int?>
Maximum number of tokens in the model response.
latefinal
memory ↔ Output<AgentcoreHarnessMemory?>
Memory configuration. See memory Block below. If not specified, configured values can be found in memoryActual. Clearing this value will reset the memory configuration to default values.
latefinal
memoryActuals ↔ Output<List<AgentcoreHarnessMemoryActual>>
Actual deployed memory configuration.
latefinal
model ↔ Output<AgentcoreHarnessModel>
Model configuration for the harness. See model Block below.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
skills ↔ Output<List<AgentcoreHarnessSkill>?>
Skill configurations. See skill Block below.
latefinal
systemPrompts ↔ Output<List<AgentcoreHarnessSystemPrompt>?>
System prompt blocks for the harness. See systemPrompt Block below.
latefinal
tags ↔ Output<Map<String, String>?>
Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
timeouts ↔ Output<AgentcoreHarnessTimeouts?>
latefinal
timeoutSeconds ↔ Output<int>
Timeout in seconds for the harness execution.
latefinal
tools ↔ Output<List<AgentcoreHarnessTool>?>
Tool configurations. See tool Block below.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
truncations ↔ Output<List<AgentcoreHarnessTruncation>>
Truncation configuration for conversation history. See truncation Block below.
latefinal
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {AgentcoreHarnessState? state, CustomResourceOptions? options}) → AgentcoreHarness
Gets an existing AgentcoreHarness resource's state with the given name and id.