Skip to content

SDK

The Everruns SDK provides official client libraries for building AI agent applications. SDKs are available for Rust, Python, and TypeScript with a consistent API across all platforms.

Features

  • Consistent API across Rust, Python, and TypeScript
  • Async/await patterns throughout all SDKs
  • SSE streaming with automatic reconnection
  • Typed models generated from OpenAPI specifications
  • Sub-client organization (agents, sessions, messages, events)

Installation

Requires Rust 1.70+

Terminal window
cargo add everruns-sdk

Authentication

All SDKs use the EVERRUNS_API_KEY environment variable by default. You can also pass the API key explicitly when initializing the client.

use everruns_sdk::Client;
// From environment variable
let client = Client::from_env()?;
// Explicit API key
let client = Client::new("your-api-key");

Quick Start

Create an Agent and Start a Session

use everruns_sdk::{Client, CreateAgentRequest, CreateSessionRequest, CreateMessageRequest};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::from_env()?;
// Create an agent
let agent = client.agents().create(CreateAgentRequest {
name: "my-assistant".to_string(),
system_prompt: "You are a helpful assistant.".to_string(),
..Default::default()
}).await?;
// Create a session
let session = client.sessions().create(CreateSessionRequest {
agent_id: agent.id.clone(),
..Default::default()
}).await?;
// Send a message
client.messages().create(CreateMessageRequest {
session_id: session.id.clone(),
content: "Hello! What can you help me with?".to_string(),
}).await?;
Ok(())
}

Stream Events

use everruns_sdk::{Client, Event};
use futures::StreamExt;
let client = Client::from_env()?;
let mut stream = client.events().stream(&session.id).await?;
while let Some(event) = stream.next().await {
match event? {
Event::OutputMessageDelta { delta, .. } => {
print!("{}", delta);
}
Event::TurnCompleted { .. } => {
println!("\n--- Turn completed ---");
break;
}
_ => {}
}
}

API Coverage

All SDKs provide access to the full Everruns API:

ResourceOperations
AgentsCreate, list, get, update, archive
SessionsCreate, list, get, update, delete, cancel
MessagesCreate, list
EventsPoll, stream (SSE)
FilesystemSession file operations
ImagesUpload, retrieve

Error Handling

SDKs provide standardized error types for common API errors:

Error TypeDescription
AuthenticationErrorInvalid or missing API key
NotFoundErrorResource not found
RateLimitErrorRate limit exceeded
ApiErrorGeneral API error
use everruns_sdk::Error;
match client.agents().get("invalid-id").await {
Ok(agent) => println!("Found: {}", agent.name),
Err(Error::NotFound(msg)) => println!("Not found: {}", msg),
Err(Error::Authentication(msg)) => println!("Auth error: {}", msg),
Err(e) => println!("Other error: {}", e),
}

Event Types

The SDKs support all event types from the Everruns API:

CategoryEvents
Inputinput.message
Outputoutput.message.started, output.message.delta, output.message.completed
Turnturn.started, turn.completed, turn.failed, turn.cancelled
Tooltool.started, tool.completed

See the Events documentation for detailed information about event streaming.

Resources

Overview Video