pub struct AgentOs { /* private fields */ }Implementations§
Source§impl AgentOs
impl AgentOs
pub fn builder() -> AgentOsBuilder
pub fn client(&self) -> Client
pub fn skill_list(&self) -> Option<Vec<Arc<dyn Skill>>>
pub fn agent(&self, agent_id: &str) -> Option<AgentDefinition>
pub fn tools(&self) -> HashMap<String, Arc<dyn Tool>>
Sourcepub fn validate_agent(&self, agent_id: &str) -> Result<(), AgentOsResolveError>
pub fn validate_agent(&self, agent_id: &str) -> Result<(), AgentOsResolveError>
Check whether an agent with the given ID is registered.
Sourcepub fn resolve(
&self,
agent_id: &str,
) -> Result<ResolvedRun, AgentOsResolveError>
pub fn resolve( &self, agent_id: &str, ) -> Result<ResolvedRun, AgentOsResolveError>
Resolve an agent’s static wiring: config, tools, and run policy.
Source§impl AgentOs
impl AgentOs
pub fn agent_state_store(&self) -> Option<&Arc<dyn ThreadStore>>
Sourcepub async fn load_thread(
&self,
id: &str,
) -> Result<Option<ThreadHead>, AgentOsRunError>
pub async fn load_thread( &self, id: &str, ) -> Result<Option<ThreadHead>, AgentOsRunError>
Load a thread from storage. Returns the thread and its version.
If the thread does not exist, returns None.
pub async fn current_run_id_for_thread( &self, agent_id: &str, thread_id: &str, ) -> Result<Option<String>, AgentOsRunError>
pub async fn start_active_run_with_persistence( &self, owner_agent_id: &str, run_request: RunRequest, resolved: ResolvedRun, persist_run: bool, strip_lineage: bool, ) -> Result<RunStream, AgentOsRunError>
Sourcepub async fn prepare_run(
&self,
request: RunRequest,
resolved: ResolvedRun,
) -> Result<PreparedRun, AgentOsRunError>
pub async fn prepare_run( &self, request: RunRequest, resolved: ResolvedRun, ) -> Result<PreparedRun, AgentOsRunError>
Prepare a resolved run for execution.
This handles all deterministic pre-run logic:
- Thread loading/creation from storage
- Message deduplication and appending
- Persisting pre-run state
- Run-context creation
Callers resolve first, optionally customize, then prepare:
let mut resolved = os.resolve("my-agent")?;
resolved.tools.insert("extra".into(), tool);
let prepared = os.prepare_run(request, resolved).await?;Sourcepub async fn prepare_run_with_persistence(
&self,
request: RunRequest,
resolved: ResolvedRun,
persist_run: bool,
) -> Result<PreparedRun, AgentOsRunError>
pub async fn prepare_run_with_persistence( &self, request: RunRequest, resolved: ResolvedRun, persist_run: bool, ) -> Result<PreparedRun, AgentOsRunError>
Prepare a resolved run and control whether the run should be persisted.
This powers dialog-style runs where short-lived execution state is needed but we intentionally do not keep durable run records.
Sourcepub fn execute_prepared(
prepared: PreparedRun,
) -> Result<RunStream, AgentOsRunError>
pub fn execute_prepared( prepared: PreparedRun, ) -> Result<RunStream, AgentOsRunError>
Execute a previously prepared run.
Sourcepub async fn run_stream(
&self,
request: RunRequest,
) -> Result<RunStream, AgentOsRunError>
pub async fn run_stream( &self, request: RunRequest, ) -> Result<RunStream, AgentOsRunError>
Resolve, prepare, and execute an agent run.
This is the primary entry point. Callers that need to customize
the resolved wiring should use [resolve] + mutation + [prepare_run]
- [
execute_prepared] instead.