Expand description
Run a Rig agent on AWS Bedrock AgentCore Runtime.
AgentCore runs an agent as an ARM64 container that serves its HTTP
protocol contract on port 8080: POST /invocations with a JSON body,
answered with JSON or server-sent events, and GET /ping. Each runtime
session (the X-Amzn-Bedrock-AgentCore-Runtime-Session-Id header) is one
conversation. AgentCoreApp serves that contract for a Rig agent:
-
the session’s conversation is kept between invocations, in memory or in any
rig_memorystore (seeAgentCoreApp::history_store); -
the reply streams as server-sent events when the caller asks for
text/event-stream, and is one JSON object otherwise; -
each invocation runs in a span that continues the caller’s trace and carries the session as
session.id(throughrig_otel), which is what AgentCore Observability and Evaluations group a session’s traces by; -
/pinganswersHealthyBusywhile an invocation or background work fromAgentCoreApp::spawn_taskis open, so AgentCore Runtime keeps the session running until that work ends. -
prompts and replies go on the spans only with
AgentCoreApp::record_content(off by default, as in Rig). AgentCore Evaluations needs them to judge a session. The app’s setting overrides the agent’s ownrecord_content_telemetry, so set it on the app.
async fn run(agent: rig_agent::Agent) -> Result<(), rig_agentcore::ServeError> {
rig_agentcore::AgentCoreApp::new(agent)
.record_content(true)
.serve()
.await
}Re-exports§
pub use rig_memory;
Structs§
- Agent
Core App - A Rig agent served on AgentCore Runtime’s HTTP protocol contract.
- Busy
Guard - Keeps the app’s
/pingatHealthyBusywhile it is alive. Get one fromAgentCoreApp::track_task. The work is released when the guard drops, which also happens when a task holding it is aborted or panics.
Enums§
- Serve
Error - Why the app stopped serving.
Constants§
- DEFAULT_
HISTORY_ TOKENS - How many tokens of history a session keeps by default.
- DEFAULT_
MAX_ REQUEST_ BYTES - The largest
/invocationsbody by default, in bytes: the limit Axum’s JSON extractor already applied. A larger body gets 413. - DEFAULT_
MAX_ SESSIONS - How many sessions an app keeps by default. AgentCore gives each session its own microVM, so one process usually sees one; this bounds the memory when the app runs elsewhere.
- DEFAULT_
PORT - The port AgentCore Runtime sends the HTTP protocol to.
- SESSION_
HEADER - The header AgentCore Runtime names the session with.