Expand description
agentix — Multi-provider LLM client for Rust.
Supports DeepSeek, OpenAI, Anthropic, and Gemini out of the box.
The core API is a value-type Request that carries everything needed to
hit an LLM API — provider, credentials, model, messages, tools, and tuning.
Call Request::stream or Request::complete with a shared reqwest::Client.
§Quickstart
use agentix::{Request, Provider, Message, UserContent, LlmEvent};
use futures::StreamExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let http = reqwest::Client::new();
let mut stream = Request::new(Provider::DeepSeek, std::env::var("DEEPSEEK_API_KEY")?)
.system_prompt("You are helpful.")
.user("Hello!")
.stream(&http)
.await?;
while let Some(event) = stream.next().await {
match event {
LlmEvent::Token(t) => print!("{t}"),
_ => {}
}
}
Ok(())
}Re-exports§
pub use error::ApiError;pub use msg::LlmEvent;pub use raw::shared::ToolDefinition;pub use request::ImageContent;pub use request::ImageData;pub use request::Message;pub use request::Provider;pub use request::Request;pub use request::ResponseFormat;pub use request::ToolCall;pub use request::ToolChoice;pub use request::UserContent;pub use request::truncate_to_token_budget;pub use types::CompleteResponse;pub use types::UsageStats;pub use tool_trait::Tool;pub use tool_trait::ToolBundle;pub use tool_trait::ToolOutput;pub use agent::AgentEvent;pub use agent::AgentTurnsStream;pub use agent::agent;pub use agent::agent_turns;pub use schemars;pub use serde;pub use serde_json;pub use async_trait;pub use futures;
Modules§
- agent
- error
- msg
- raw
- Raw, provider-specific request/response types.
- request
- Unified request layer.
- tool_
trait - types
- Shared types used across the raw provider and request layers.
Attribute Macros§
- tool
- Annotate an
impl Tool for Xblock (or a single fn) to generate the fullTooltrait implementation.