Skip to main content

Crate agentkit_provider_cerebras

Crate agentkit_provider_cerebras 

Source
Expand description

Cerebras Inference API adapter for the agentkit agent loop.

This crate implements the agentkit ModelAdapter directly against Cerebras’ /v1/chat/completions endpoint.

Streaming is on by default. Toggle via CerebrasConfig::with_streaming.

§Quick start

use agentkit_loop::{Agent, SessionConfig};
use agentkit_provider_cerebras::{CerebrasAdapter, CerebrasConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = CerebrasConfig::from_env()?;
    let adapter = CerebrasAdapter::new(config)?;
    let agent = Agent::builder().model(adapter).build()?;
    let _driver = agent.start(SessionConfig::new("demo")).await?;
    Ok(())
}

Re-exports§

pub use crate::config::CerebrasConfig;
pub use crate::config::DEFAULT_BASE_URL;
pub use crate::config::DEFAULT_VERSION_PATCH;
pub use crate::config::OutputFormat;
pub use crate::config::PartKindName;
pub use crate::config::ReasoningConfig;
pub use crate::config::ReasoningEffort;
pub use crate::config::ReasoningFormat;
pub use crate::config::ToolChoice;
pub use crate::error::BuildError;
pub use crate::error::CerebrasError;
pub use crate::error::ResponseError;
pub use crate::models::ModelObject;
pub use crate::models::ModelsClient;
pub use crate::rate_limit::RateLimitSnapshot;

Modules§

config
CerebrasConfig and its leaf enums (tool-choice, output format, reasoning, service tier, prediction, compression).
error
Error types for the Cerebras adapter.
models
Thin typed wrapper over GET /v1/models and GET /v1/models/{id}.
rate_limit
Rate-limit snapshot parsed from Cerebras’ x-ratelimit-* response headers.
request
Transcript → Cerebras /v1/chat/completions request-body converter.
response
Buffered Cerebras response → VecDeque<ModelTurnEvent>.
version
X-Cerebras-Version-Patch header helper.

Structs§

CerebrasAdapter
Model adapter that connects the agentkit agent loop to Cerebras’ /v1/chat/completions endpoint.
CerebrasSession
An active session against the Cerebras chat-completions endpoint.
CerebrasTurn
A single Cerebras chat-completions turn in progress.