Skip to content
/ sdk Public

Official client libraries for the Everruns API. Build AI agent applications with typed, async SDKs for Rust, Python, and TypeScript.

License

Notifications You must be signed in to change notification settings

everruns/sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Everruns SDK

Official client libraries for the Everruns API. Build AI agent applications with typed, async SDKs for Rust, Python, and TypeScript.

Installation

Rust

cargo add everruns-sdk

Python (3.10+)

pip install everruns-sdk

TypeScript (Node 18+)

npm install @everruns/sdk

Quick Start

Set your API key:

export EVERRUNS_API_KEY=evr_your_key_here

Rust

use everruns_sdk::Everruns;
use futures::StreamExt;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Everruns::from_env()?;

    // Create an agent
    let agent = client.agents().create(
        "Assistant",
        "You are a helpful assistant."
    ).await?;

    // Start a session
    let session = client.sessions().create(&agent.id).await?;

    // Send a message
    client.messages().create(&session.id, "Hello!").await?;

    // Stream the response
    let mut stream = client.events().stream(&session.id);
    while let Some(event) = stream.next().await {
        let event = event?;
        println!("{}", event.event_type);
        if event.event_type == "turn.completed" {
            break;
        }
    }

    Ok(())
}

Python

import asyncio
from everruns_sdk import Everruns

async def main():
    client = Everruns()

    # Create an agent
    agent = await client.agents.create(
        name="Assistant",
        system_prompt="You are a helpful assistant."
    )

    # Start a session
    session = await client.sessions.create(agent_id=agent.id)

    # Send a message
    await client.messages.create(session.id, "Hello!")

    # Stream the response
    async for event in client.events.stream(session.id):
        print(event.type)
        if event.type == "turn.completed":
            break

    await client.close()

asyncio.run(main())

TypeScript

import { Everruns } from "@everruns/sdk";

async function main() {
  const client = Everruns.fromEnv();

  // Create an agent
  const agent = await client.agents.create({
    name: "Assistant",
    systemPrompt: "You are a helpful assistant.",
  });

  // Start a session
  const session = await client.sessions.create({ agentId: agent.id });

  // Send a message
  await client.messages.create(session.id, { text: "Hello!" });

  // Stream the response
  for await (const event of client.events.stream(session.id)) {
    console.log(event.type);
    if (event.type === "turn.completed") break;
  }
}

main();

Features

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

API Coverage

Resource Operations
Agents Create, list, get, update, archive
Sessions Create, list, get, update, delete, cancel
Messages Create, list
Events Poll, stream (SSE)
Filesystem List, read, write session files
Images Upload, retrieve

Event Types

Category Events
Input input.message
Output output.message.started, output.message.delta, output.message.completed
Turn turn.started, turn.completed, turn.failed, turn.cancelled
Tool tool.started, tool.completed

Authentication

All SDKs read from EVERRUNS_API_KEY environment variable by default, or accept an explicit key:

// Rust
let client = Everruns::new("evr_...");
# Python
client = Everruns(api_key="evr_...")
// TypeScript
const client = new Everruns({ apiKey: "evr_..." });

Error Handling

Consistent error types across all SDKs:

Error Description
AuthenticationError Invalid or missing API key
NotFoundError Resource not found (404)
RateLimitError Rate limited (429), includes retry_after
ApiError General API errors

Documentation

Examples

See the cookbook/ directory for runnable examples, including a complete Dad Jokes agent in Rust.

Each SDK also has basic examples:

Development

just setup    # Install dependencies for all SDKs
just test     # Run all tests
just lint     # Run all linters

See CONTRIBUTING.md for development guidelines.

License

MIT

About

Official client libraries for the Everruns API. Build AI agent applications with typed, async SDKs for Rust, Python, and TypeScript.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •