Skip to main content

Crate hanzo_agent

Crate hanzo_agent 

Source
Expand description

Hanzo Agent SDK - Core agent functionality

This crate provides the core agent framework for building AI agents with tools, handoffs, and structured output support.

§Example

use hanzo_agent::{Agent, RunConfig};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let agent = Agent::builder("assistant")
        .instructions("You are a helpful assistant.")
        .model("gpt-4")
        .build();

    let result = agent.run("Hello!", &RunConfig::default()).await?;
    println!("Response: {}", result.final_output);
    Ok(())
}

Re-exports§

pub use agent::Agent;
pub use agent::AgentBuilder;
pub use context::RunContext;
pub use errors::AgentError;
pub use result::RunResult;
pub use result::RunResultStreaming;
pub use runner::RunConfig;
pub use runner::Runner;
pub use tool::FunctionTool;
pub use tool::Tool;
pub use types::InputItem;
pub use types::ModelResponse;
pub use types::RunItem;

Modules§

agent
Agent implementation
context
Runtime context for agent execution
errors
Error types for the agent framework
prelude
Re-export commonly used types
result
Result types for agent runs
runner
Agent execution runner
tool
Tool system for agents
types
Core types for agent framework