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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Agent
impl !RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl !UnwindSafe for Agent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more