pub struct AgentCoreApp { /* private fields */ }Expand description
A Rig agent served on AgentCore Runtime’s HTTP protocol contract.
Implementations§
Source§impl AgentCoreApp
impl AgentCoreApp
Sourcepub fn max_sessions(self, max: usize) -> Self
pub fn max_sessions(self, max: usize) -> Self
Keep at most max sessions’ conversations in memory, forgetting the
oldest. This is the default, with DEFAULT_MAX_SESSIONS. It replaces
a store set with history_store.
Sourcepub fn history_store<S>(self, store: S) -> Self
pub fn history_store<S>(self, store: S) -> Self
Keep sessions in store, one session log per session id, so they
survive restarts and several apps can share them: any rig_memory
store, such as rig_memory::DirStore (feature fs) or the
rig-sqlite and rig-postgres stores. Any session id works: one that
is 1 to 128 ASCII letters, digits, - or _ names its log as it is,
any other is hashed into a safe log name. Two apps, or concurrent
invocations of one session, saving at once do not lose either turn: a
save that loses a race rereads and retries up to 10 times with a short
jittered backoff. If a save still fails, the invocation’s answer is
returned anyway, the failure is logged, and that run’s turn is not
persisted, so later invocations do not see it. A load that fails is
reported to the caller as an error, before the agent runs. The store
keeps each session’s whole conversation;
history_window limits only what an invocation
sends. Replaces the in-memory store set by max_sessions.
Sourcepub fn history_window(self, window: impl Recent + 'static) -> Self
pub fn history_window(self, window: impl Recent + 'static) -> Self
Which newest messages of a session each invocation sends the model,
such as rig_memory::recent::TokenBudget::new(8_000) or
LastMessages(20). Defaults to DEFAULT_HISTORY_TOKENS tokens. A
tool result is never sent without its call. An empty window
(TokenBudget::new(0), LastMessages(0)) sends no history.
What the window also does depends on the store. In memory, messages
beyond it are forgotten when a run is saved, so memory stays bounded.
With history_store, the store keeps the whole
conversation and the window only limits what is sent, so a later,
wider window sees older turns again.
Sourcepub fn record_content(self, record: bool) -> Self
pub fn record_content(self, record: bool) -> Self
Record prompts and replies on the GenAI spans. AgentCore Evaluations needs them to judge a session; they are off by default, as in Rig, because they put conversation content into your telemetry.
Sourcepub fn router(self) -> Router
pub fn router(self) -> Router
The contract’s routes, /invocations and /ping, as an Axum router.
Sourcepub async fn serve(self) -> Result<(), ServeError>
pub async fn serve(self) -> Result<(), ServeError>
Serve on 0.0.0.0 at PORT (default 8080, what AgentCore sends to)
until the process gets Ctrl-C or SIGTERM.