rig-agentcore
Run a Rig agent on AWS Bedrock AgentCore Runtime.
AgentCore runs an agent as an ARM64 container serving its HTTP protocol contract on port
8080. AgentCoreApp serves it for a Rig agent:
| Path | What it does |
|---|---|
POST /invocations |
Takes {"prompt": "..."}. Answers {"response": "...", "status": "success"}, or server-sent events ({"text"} as the model writes, then {"response"}) when the caller accepts text/event-stream. |
GET /ping |
{"status": "Healthy"}. |
new
.record_content // prompts and replies on the spans, for AgentCore Evaluations
.serve // 0.0.0.0:$PORT, default 8080; stops on SIGTERM
.await?;
-
Sessions: the
X-Amzn-Bedrock-AgentCore-Runtime-Session-Idheader names the conversation; each session's messages are kept and sent with its next invocation. By default they live in memory (at most 1000 sessions, oldest forgotten first).history_storekeeps them in anyrig-memorystore (DirStoreon disk,rig-sqlite,rig-postgres), so they survive a restart and several apps can share them. Any session id works: one of 1-128 of[A-Za-z0-9_-]names its log as it is, any other is hashed into a safe log name. A save that loses a race with another writer retries up to 10 times; if it still fails, the answer is returned, the failure is logged, and that turn is not persisted. A failed load is an error reported before the agent runs. Each invocation sends the newest messages that fithistory_window(32k tokens by default,rig_memory::recent::TokenBudget), never splitting a tool call from its result. An empty window sends no history. In memory, messages beyond the window are forgotten when a run is saved. Withhistory_store, the store keeps the whole conversation and the window only limits what is sent.new .history_store .history_window;DirStoreneeds rig-memory'sfsfeature: enable it in your ownCargo.toml(rig-memory = { version = "0.47", features = ["fs"] }). -
Traces: each invocation runs in an
agentcore.invocationspan that continues the caller's trace (traceparent) and gives every span under itsession.id, throughrig-otel. With rig-otel'sawsfeature exporting to CloudWatch, that is what AgentCore Observability and AgentCore Evaluations read. -
Content:
record_content(true)records prompts and replies on the GenAI spans. AgentCore Evaluations needs them to judge a session; they are off by default, as in Rig.
Verified on AWS
On 2026-11-26, rig-lab (a Rig agent with a calculator tool, Claude Haiku 4.5 on
Bedrock) ran on AgentCore Runtime in us-east-1 with record_content(true) and
rig-otel's aws export, deployed as AWS documents it (ECR image, execution role,
Transaction Search). A two-turn session (3×47−29, then ÷4) kept its conversation, its
spans reached CloudWatch (aws/spans) under the session id, and AgentCore Evaluations'
built-in evaluators judged it from those spans: GoalSuccessRate 1.0, Helpfulness 0.83
and Correctness 1.0 per turn. The scripts are in rig-lab's deploy/agentcore.
What made the spans evaluable: the scope opentelemetry.instrumentation.rig,
session.id on every span, an invoke_agent span with gen_ai.task.input and
gen_ai.task.output, and Rig's chat and execute_tool spans with content recorded.
Testing
cargo test serves the contract over real HTTP for agents on scripted models: ping, a
session keeping its conversation, sessions kept apart, streamed replies, a bad body, and
an invocation continuing the caller's trace with the session on every span.