Artificial Intelligence

Amazon Bedrock AgentCore harness adds Strands harness defaults, built-in tools, and lifecycle hooks

When building an AI agent, selecting a model is only the first step. The agent still needs tools, instructions for finishing the job, a way to manage context growth in long sessions, and guardrails before it executes any consequential actions, like issuing a refund.

We are upgrading Amazon Bedrock AgentCore harness to use Strands harness, our open-source agent harness, released earlier this year, available under an Apache 2.0 license. AgentCore harness also introduces lifecycle hooks, so you can apply your own deterministic checks and notifications at defined points in the agent loop.

With this upgrade, agents that rely on the managed defaults get a recommended model, a task-oriented system prompt, automatic prompt caching (initially for Anthropic models on Amazon Bedrock), and proactive context management. They also get additional built-in tools for planning, web retrieval, filesystem access, context offloading, and task delegation. This gives agents greater capabilities during long tasks, allowing them to keep track of subtasks, reduce context window usage, and delegate work. With hooks, you can transform non-deterministic AI behavior into predictable, safe, and governed workflows by running deterministic code at specific lifecycle checkpoints.

There’s no new resource type or integration to adopt. You automatically get both updates in the AgentCore harness you already use.

Strands capabilities, on AWS

Strands harness provides an assembled agent foundation with recommended instructions, tools, and context management. Amazon Bedrock AgentCore harness operates that foundation as a managed AWS service. The result is a production-grade default agent that doesn’t require you to assemble and operate the harness or its infrastructure yourself.

You do not need to provision compute, bundle and host the agent loop, manage session scaling, or operate tool-execution infrastructure. Each session runs in a secure, kernel-isolated microVM in AgentCore runtime, a capability of Amazon Bedrock AgentCore, with managed compute, scaling, and high availability.

AgentCore achieves this by connecting the harness to the services required for production agents, including session persistence, streaming responses, usage metadata, observability, AgentCore memory, Identity, Gateway, Browser, Code Interpreter, and customer-provided containers. You retain control over the model, instructions, tools, permissions, and lifecycle policies while AgentCore manages the underlying execution environment.

A more capable managed harness

Harness now provides a stronger experience when you use its managed defaults:

  • A current recommended model. When you omit the model, Harness uses a recommended default model that evolves as new models are released, always keeping your harnesses up to date. Explicit harness-level and per-invocation model configurations continue to take precedence.
  • Task-oriented instructions. The managed system prompt encourages the agent to gather relevant context, use appropriate tools, continue until the task is resolved, adapt to failures or denied actions, and verify its work before reporting completion. The default system prompt improves over time to support the latest harness behavior.
  • Automatic prompt caching. For supported models using Converse on Amazon Bedrock, Harness caches the system prompt, tool definitions, and conversation history. Repeated calls with the same prompt and tool surface can use lower-priced cache-read tokens, reducing input processing latency and cost.
  • Proactive context management. By default, Harness summarizes older conversation turns while retaining recent context once the context window reaches a configurable threshold. Keeping the context lean this way helps Harness run at about 34% lower token cost than other leading harnesses.
  • Context offloading. Large tool results can be moved out of the immediate model context. The agent receives a preview and can retrieve the complete result when needed, reducing repeated context usage without losing access to the data.
  • Planning across invocations. The todo_write tool maintains a structured task plan that can be restored in later invocations within the same session, including after conversation summarization.
  • Focused delegation. The subagent tool delegates a self-contained task to a fresh worker and returns the result to the parent agent. The worker is internal to the invocation, not a separately managed harness resource, and shares invocation limits and your tool-call lifecycle hooks.
  • Web retrieval. The web_fetch tool retrieves content from a specified webpage to give your harness up-to-date external context.
  • Granular filesystem access. With separate read, write, and edit tools, you can grant only the granular filesystem capabilities an agent needs.

Customer-provided Model Context Protocol (MCP) servers, AgentCore Gateway (a capability of Amazon Bedrock AgentCore), Browser, Code Interpreter, inline functions, skills, memory, and customer-provided containers continue to work through the existing harness interfaces.

Harness manages its defaults so that agents using them receive the current AgentCore recommended experience as models, instructions, context management, and built-in capabilities improve.

Explicit configuration always takes precedence:

  • Configure a model ID to keep using a specific model.
  • Configure systemPrompt to completely replace the managed system prompt.
  • Configure truncation to keep a specific context-management policy.
  • List individual allowedTools selectors to maintain a fixed tool surface.

When allowedTools is omitted or set to ["*"], Harness provides the current recommended built-in tool set. Because this set can gain capabilities over time, applications with a fixed security or capability boundary should list only the tools they need.

For example, the following configuration permits read-only filesystem access and web retrieval without granting shell access or file modification:

{
    "allowedTools": [
        "read",
        "web_fetch"
    ]
}

Govern consequential actions with lifecycle hooks

With lifecycle hooks, you can run your own deterministic code at defined points in the agent loop. For example, an AWS Lambda function can allow or deny a request or a tool call, and an Amazon Simple Notification Service (Amazon SNS) topic or Amazon EventBridge event bus can receive a notification to record activity or start an asynchronous workflow.

Harness supports four lifecycle events:

Event When it runs Effect of a Lambda denial
before_invocation Before the agent processes the request Stops the invocation with hook_stopped
before_tool_call After the model proposes a tool call and before execution Skips the tool call. The agent loop continues
after_tool_call After a tool result exists Retains the result and stops before further inference
after_invocation After the invocation completes Reports the decision. Output already streamed cannot be retracted

Only Lambda hooks can change the agent loop. They run synchronously and return allow or deny, with an optional reason. SNS and Amazon EventBridge hooks are notifications and don’t block the agent loop.

For example, a customer-support agent can investigate an order on its own while a before_tool_call hook checks each refund against an approval limit before the refund tool runs. The following configuration attaches that Lambda function to the harness:

[
    {
        "beforeToolCall": {
            "name": "refund_policy",
            "target": {
                "lambda": {
                    "arn": "arn:aws:lambda:us-west-2:123456789012:function:refund-policy",
                    "timeoutSeconds": 10,
                    "failureMode": "deny"
                }
            }
        }
    }
]

The function receives the proposed tool call in the hook payload and returns a decision:

def lambda_handler(event, _context):
    tool = event["context"]
    if tool["toolName"] == "issue_refund" and tool["toolInput"]["amount"] > 500:
        return {"decision": "deny", "reason": "Refund exceeds the $500 auto-approval limit."}
    return {"decision": "allow"}

When the function denies the call, the harness skips the refund and the agent continues, so it can tell the customer that the request was escalated. Each decision also appears in the InvokeHarness response stream as a hookEvent:

{
    "hookEvent": {
        "name": "refund_policy",
        "type": "before_tool_call",
        "decision": "deny",
        "reason": "Refund exceeds the $500 auto-approval limit."
    }
}

Hooks also apply to subagents. When the agent delegates a task, each tool call the subagent makes runs through the same beforeToolCall and afterToolCall hooks, so delegation can’t bypass your refund policy. The invocation-level hooks (beforeInvocation, afterInvocation) run once for the whole invocation.

You configure hooks with CreateHarness or UpdateHarness. If a Lambda function times out or returns an error, the hook applies its failureMode, which defaults to deny. For timeouts, payload fields, and context limits, see Lifecycle hooks in the Amazon Bedrock AgentCore Developer Guide.

To see every event and target type working together, try the Refund Desk sample in the Amazon Bedrock AgentCore samples repository on GitHub. A six-step guided tour shows all four lifecycle events and the AWS Lambda, Amazon SNS, and Amazon EventBridge targets. It also shows validation of client-supplied inline function results and the difference between failureMode deny and allow.

Run a multi-agent research coordinator with the AgentCore CLI

Creating a harness takes a single command. You name it and set up the instructions, context policy, and limits you want. This example creates a Research Coordinator: a harness with a task-oriented system prompt and summarization-based truncation. In a single invocation, it runs a researcher, a synthesizer, and a reviewer as subagents and returns one consolidated report. You get multi-agent orchestration and context management without provisioning infrastructure or wiring the delegation yourself.

The agentcore harness commands call the harness APIs directly, so you don’t need a CLI project or a deployment step. Install the AgentCore CLI, a capability of Amazon Bedrock AgentCore, with npm:

npm install -g @aws/agentcore

The CLI uses your default AWS credentials. It has no --profile flag, so set the AWS_PROFILE environment variable if you want a specific profile. Save the coordinator’s instructions from the sample as system_prompt.md in your working directory.

Create the harness

This command passes the coordinator’s system prompt, a summarization policy that keeps the 30 most recent messages intact as the conversation grows, and limits high enough for the full workflow. Because it omits the model, memory, and execution role, the harness uses the current AgentCore recommended model and managed memory, and the CLI creates an execution role in IAM for you.

HARNESS_ID=$(agentcore harness create --region us-west-2 --json \
--name ResearchCoordinator \
--system-prompt "$(cat system_prompt.md)" \
--truncation '{"strategy":"summarization","config":{"summarization":{"summaryRatio":0.3,"preserveRecentMessages":30}}}' \
--max-iterations 100 \
--timeout-seconds 3600 \
| jq -r '.harness.harnessId')

Creation is asynchronous. Wait for creation to finish. The last command should print READY:

while [ "$(agentcore harness get --region us-west-2 --id "$HARNESS_ID" --json | jq -r '.harness.status')" = CREATING ]; do sleep 10; done

agentcore harness get --region us-west-2 --id "$HARNESS_ID" --json | jq -r '.harness.status'

Send the prompts

Invoke your harness with a new session ID. Start with a basic question. The coordinator answers it directly, without calling its subagents:

SESSION_ID=$(uuidgen)
agentcore harness invoke --region us-west-2 \
--id "$HARNESS_ID" \
--session-id "$SESSION_ID" \
--prompt "What is the current trending topic in AI?"

Then ask for a full research report in the same session. The coordinator plans the work and delegates to the researcher, synthesizer, and reviewer in order. It runs at most one revision cycle if the reviewer asks for it, and delivers the final report. Reusing the session ID continues the conversation in the same environment.

agentcore harness invoke --region us-west-2 \
--id "$HARNESS_ID" \
--session-id "$SESSION_ID" \
--prompt "Perform a full research report on how data shapes innovations in the tech industry. Use specialized subagents to complete this task. In the final output, clearly state which part each subagent was responsible for, followed by their specific findings."

With --prompt, the CLI prints the completed transcript as JSON when the turn finishes. The research run takes about 10 to 15 minutes. To follow along as it works, leave out --prompt, and the CLI opens an interactive chat.

The same example in Python (boto3), including the full system prompt, is available in the AgentCore samples repository on GitHub.

Clean up

Delete the harness when you’re done. This also deletes its managed memory unless you pass --delete-managed-memory false. The execution role that the CLI created stays in your account, so delete it in the IAM console if you no longer need it.

agentcore harness delete --region us-west-2 --id "$HARNESS_ID"

Rollout and compatibility

On November 11, AgentCore harness began rolling out the Strands harness-backed experience to new and existing harnesses. No customer action is required.

Configuration you explicitly provide remains unchanged. Harnesses that omit the model, system prompt, or truncation configuration, or use allowedTools: ["*"], receive the upgraded managed defaults.

If your application requires fixed behavior or a fixed capability boundary, configure those settings explicitly.

Learn more

Create and invoke an AgentCore harness as you do today. Use the managed defaults for the complete current recommended experience, or configure individual settings when your application requires fixed behavior.

We look forward to seeing what you build with the upgraded AgentCore harness.


About the authors

Evandro Franco

Evandro Franco

Evandro is a Sr. Data Scientist working on Amazon Web Services. He is part of the Global GTM team that helps AWS customers overcome business challenges related to AI/ML on top of AWS, mainly on Amazon Bedrock AgentCore and Strands Agents. He has more than 18 years of experience working with technology, from software development, infrastructure, serverless, to machine learning. In his free time, Evandro enjoys playing with his son, mainly building some funny Lego bricks.

Diego Brasil

Diego Brasil

Diego is a Domain Specialist Engineer for Generative AI at Amazon Web Services, based in Dublin, Ireland. He helps AWS customers take AI agents from prototype to production, mainly on Amazon Bedrock AgentCore, Strands Agents, and Kiro. He has more than 13 years of experience in technology. He started in software development and system integration for capital markets platforms at banks and exchanges such as HSBC and B3 (Brazil Stock Exchange and Over-the-Counter Market), then moved into cloud and generative AI. Diego holds an MBA in Digital Business and Artificial Intelligence from USP/ESALQ.

Eshan Kumar

Eshan Kumar

Eshan is a Software Engineer at Amazon Web Services, based in New York. He works on Amazon Bedrock AgentCore and is part of the team that built the AgentCore managed agent harness. His career started in bioengineering, which he studied at UCLA, and he worked as a scientist at Codexis before moving into software and AI. He also studied at Columbia University. Outside of work, Eshan has volunteered with Free The Children and helped build a school for a village in Nicaragua.

Amir Hegazy

Amir Hegazy

Amir is a Software Engineer at Amazon Web Services, based in New York. He works on Amazon Bedrock AgentCore and is part of the team that built the AgentCore managed agent harness. Before AgentCore, he worked on the Amazon Bedrock Converse API, building new features and bringing Anthropic’s Claude models to Converse at launch. He holds a bachelor’s degree in computer science from the University of Southern California. Outside of work, Amir enjoys playing basketball and following Formula 1.