pub struct Agent { /* private fields */ }Expand description
High-level agent facade.
Holds the LLM client and agent config. Workspace-independent.
Use Agent::session() to bind to a workspace.
Implementations§
Source§impl Agent
impl Agent
Sourcepub async fn new(config_source: impl Into<String>) -> Result<Self>
pub async fn new(config_source: impl Into<String>) -> Result<Self>
Create from a config file path or inline config string.
Auto-detects: file path (.hcl/.json) vs inline JSON vs inline HCL.
Sourcepub async fn create(config_source: impl Into<String>) -> Result<Self>
pub async fn create(config_source: impl Into<String>) -> Result<Self>
Create from a config file path or inline config string.
Alias for Agent::new() — provides a consistent API with
the Python and Node.js SDKs.
Sourcepub async fn from_config(config: CodeConfig) -> Result<Self>
pub async fn from_config(config: CodeConfig) -> Result<Self>
Create from a CodeConfig struct.
Sourcepub fn session(
&self,
workspace: impl Into<String>,
options: Option<SessionOptions>,
) -> Result<AgentSession>
pub fn session( &self, workspace: impl Into<String>, options: Option<SessionOptions>, ) -> Result<AgentSession>
Bind to a workspace directory, returning an AgentSession.
Pass None for defaults, or Some(SessionOptions) to override
the model, agent directories for this session.
Sourcepub fn resume_session(
&self,
session_id: &str,
options: SessionOptions,
) -> Result<AgentSession>
pub fn resume_session( &self, session_id: &str, options: SessionOptions, ) -> Result<AgentSession>
Resume a previously saved session by ID.
Loads the session data from the store, rebuilds the AgentSession with
the saved conversation history, and returns it ready for continued use.
The options must include a session_store (or with_file_session_store)
that contains the saved session.