The AgentCore Managed Harness: Model + Prompt + Tools
Running an agent with zero orchestration code.
Search across all documentation pages
Running an agent with zero orchestration code.
Every tool-using agent needs a loop: send a prompt, notice the model wants to call a tool, run the tool, feed the result back, repeat until the model is done. On Bedrock's own Converse API, you write that loop yourself - checking stopReason for tool_use and looping until you see end_turn. AgentCore's managed harness is the piece of the platform that can run this same loop for you, so a hosted agent's code can be as small as "here is my model, my prompt, and my tools" with no hand-written loop at all.
This page describes the harness at the level of the shape it presents, not a guaranteed API contract. AgentCore is a 2026 preview capability, and the declarative "model + prompt + tools" configuration described here is the least settled part of its surface - treat method and field names as illustrative and verify against current AWS documentation before depending on them.
Quick-reference recipe card - copy-paste ready. Field and operation names are illustrative; verify at build time.
# --- Python (boto3) --- illustrative shape, verify exact fields at build time
import boto3, json
client = boto3.client("bedrock-agentcore", region_name="us-east-1")
resp = client.invoke_agent_runtime(
agentRuntimeArn="arn:aws:bedrock-agentcore:us-east-1:111122223333:runtime/harness-agent",
payload=json.dumps({"prompt": "What's the status of order 4821?"}).encode(),
)
print(json.loads(resp["response"].read()))// --- TypeScript (AWS SDK v3) --- illustrative shape, verify exact fields at build time
import { BedrockAgentCoreClient, InvokeAgentRuntimeCommand } from "@aws-sdk/client-bedrock-agentcore";
const client = new BedrockAgentCoreClient({ region: "us-east-1" });
const resp = await client.send(new InvokeAgentRuntimeCommand({
agentRuntimeArn: "arn:aws:bedrock-agentcore:us-east-1:111122223333:runtime/harness-agent",
payload: new TextEncoder().encode(JSON.stringify({ prompt: "What's the status of order 4821?" })),
}));
console.log(new TextDecoder().decode(resp.response as Uint8Array));tool_use turns unless you specifically ask for tracing (see the observability page).Here is the declarative side: what you configure so the harness knows which model, prompt, and tools to use. Treat this as the most speculative snippet on this page.
# --- Python (boto3) --- highly illustrative; the actual config surface may differ, verify at build time
import boto3
control = boto3.client("bedrock-agentcore-control", region_name="us-east-1")
control.update_agent_runtime( # representative operation name only
agentRuntimeArn="arn:aws:bedrock-agentcore:us-east-1:111122223333:runtime/harness-agent",
modelId="amazon.nova-lite-v1:0",
systemPrompt="You are a support agent. Use tools to look up order status; never guess.",
toolGatewayArn="arn:aws:bedrock-agentcore:us-east-1:111122223333:gateway/support-tools",
)// --- TypeScript (AWS SDK v3) --- highly illustrative; the actual config surface may differ, verify at build time
import { BedrockAgentCoreControlClient, UpdateAgentRuntimeCommand } from "@aws-sdk/client-bedrock-agentcore-control";
const control = new BedrockAgentCoreControlClient({ region: "us-east-1" });
await control.send(new UpdateAgentRuntimeCommand({ // representative operation name only
agentRuntimeArn: "arn:aws:bedrock-agentcore:us-east-1:111122223333:runtime/harness-agent",
modelId: "amazon.nova-lite-v1:0",
systemPrompt: "You are a support agent. Use tools to look up order status; never guess.",
toolGatewayArn: "arn:aws:bedrock-agentcore:us-east-1:111122223333:gateway/support-tools",
}));What this demonstrates:
modelId on the plain Bedrock Runtime side.A tool-calling loop is small in code but easy to get subtly wrong: forgetting to append the assistant's tool-call turn before the tool result, not capping iterations, or mishandling a tool error mid-loop. Every team building a tool-using agent on Bedrock directly has written some version of this same loop. The managed harness exists to make that loop a platform concern - written once by AWS, exercised by every agent that opts into it - the same argument AgentCore Runtime makes for hosting infrastructure generally.
AgentCore Runtime, on its own, will host any packaged entrypoint - including one where you write the full tool loop yourself using a framework like LangGraph or Strands, or by hand against Converse's toolConfig. The managed harness is a further step: instead of your entrypoint containing a loop, it contains a declaration, and AWS's own harness code runs the loop. Both are "an agent on AgentCore," but only one has zero orchestration code in your repository.
This matters for how much you can inspect and customize. A hand-written loop is fully yours to modify - add custom retry logic, short-circuit on certain tool results, log whatever you want mid-loop. A harness-managed loop trades that flexibility for less code and less to maintain, similar to the trade-off Converse itself makes versus InvokeModel on the plain inference side.
The tools available to a harness-managed agent are expected to come primarily from AgentCore Gateway - the piece of AgentCore that turns existing APIs, Lambda functions, and services into agent-callable tool definitions - plus any built-in tools AWS ships (a managed web-search tool is covered later in this section). The harness page and the Gateway page are tightly coupled: Gateway defines what a tool is, and the harness decides when to call it during a conversation.
toolConfig. Fix: evaluate your chosen model's tool-use behavior directly rather than assuming parity.| Approach | Use When | Don't Use When |
|---|---|---|
| Managed harness (model + prompt + tools) | You want a standard tool-calling agent with minimal code | You need custom control-flow inside the reasoning loop |
| Hand-written loop on AgentCore Runtime | You need custom retry, branching, or multi-agent logic | You just need a straightforward tool-using assistant |
| Plain Bedrock Converse with your own loop, no AgentCore | You don't need managed hosting/isolation at all | You need production session isolation, scaling, or Gateway tools |
| A third-party framework (LangGraph, CrewAI, Strands) hosted on Runtime | You already have orchestration logic you want to keep | You want AWS to own the loop entirely |
No. You still write the system prompt; the harness only automates the tool-calling loop around it, not the prompt content itself.
Most likely from AgentCore Gateway (existing APIs/functions turned into tool definitions) plus any AWS-provided built-in tools. Confirm the exact registration mechanism against current docs.
That is expected to be an observability concern - tracing/logging integration, covered on this section's observability page - rather than something the invoke response returns by default.
No. Runtime hosts any packaged entrypoint, including a hand-written orchestration loop. The harness is one way to run an agent on Runtime, not the only way.
Less stable than the invoke surface. Treat the declarative model+prompt+tools configuration shown here as the most likely direction, not a confirmed contract, given AgentCore's preview status.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+). Amazon Bedrock AgentCore is a fast-moving 2026 preview capability - verify exact API/CLI surface against current AWS docs before relying on specific method names.
Reviewed by Chris St. John·Last updated Jul 24, 2026