pub struct AgentContext {
pub system_prompt: String,
pub messages: Vec<AgentMessage>,
pub identity: Option<RunIdentity>,
}Expand description
Snapshot of agent state passed into the loop.
Carries the system prompt, the current transcript, and an optional
RunIdentity. Plain data — the loop builds an internal mutable
copy and returns the new tail.
identity is optional for backward compatibility with callers that
don’t yet thread one through. When None, the loop treats the run
as an anonymous root; plugins that key on identity see None and
degrade gracefully.
Fields§
§system_prompt: String§messages: Vec<AgentMessage>§identity: Option<RunIdentity>Implementations§
Source§impl AgentContext
impl AgentContext
pub fn new(system_prompt: impl Into<String>) -> Self
pub fn with_messages(self, messages: Vec<AgentMessage>) -> Self
Sourcepub fn with_identity(self, identity: RunIdentity) -> Self
pub fn with_identity(self, identity: RunIdentity) -> Self
Attach a RunIdentity to this context. Use
RunIdentity::root for top-level runs and
RunIdentity::child_of for spawned children.
Sourcepub fn spawn_child(&self, system_prompt: impl Into<String>) -> Self
pub fn spawn_child(&self, system_prompt: impl Into<String>) -> Self
Convenience: produce a child AgentContext for a spawned run.
Returns a fresh context with the supplied system_prompt, no
messages, and a child identity derived from this context’s
identity (or a fresh root if this context has none).
Trait Implementations§
Source§impl Clone for AgentContext
impl Clone for AgentContext
Source§fn clone(&self) -> AgentContext
fn clone(&self) -> AgentContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more