pub struct Agent { /* private fields */ }Expand description
Stable public entry point for agent execution.
Wraps an AgentRuntime and provides:
Agent::execute()— run the agent loop on a sessionAgent::storage()— access the shared storage backend
Clone is cheap (inner is Arc).
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn from_runtime(runtime: Arc<AgentRuntime>) -> Self
pub fn from_runtime(runtime: Arc<AgentRuntime>) -> Self
Wrap an existing AgentRuntime in an Agent.
Sourcepub fn builder() -> AgentBuilder
pub fn builder() -> AgentBuilder
Return a new builder.
Sourcepub async fn execute(
&self,
session: &mut Session,
req: ExecuteRequest,
) -> Result<()>
pub async fn execute( &self, session: &mut Session, req: ExecuteRequest, ) -> Result<()>
Execute the agent loop with the given request.
Sourcepub fn persistence(&self) -> &Arc<dyn RuntimeSessionPersistence> ⓘ
pub fn persistence(&self) -> &Arc<dyn RuntimeSessionPersistence> ⓘ
Access the runtime persistence adapter for non-authoritative saves.
Sourcepub fn default_tools(&self) -> &Arc<dyn ToolExecutor> ⓘ
pub fn default_tools(&self) -> &Arc<dyn ToolExecutor> ⓘ
Access the runtime’s default tool executor (the root/full tool surface assembled at build time).
Exposed so callers can compose additional one-off dispatches against the
SAME executor the loop itself uses — e.g. re-executing a single
previously-gated tool call after a permission approval — without forking
or reaching into AgentLoopConfig (which stays unconstructible outside
the engine). This is a read-only accessor alongside storage() /
persistence(); it does not touch the sealed loop config.