Skip to content

SDK

Everything you can do with OpenAgents from your own code: the HTTP API at https://api.openagents.com/v1 and the Rust SDK that calls it.

Add the SDK

The Rust SDK is the openagents-sdk crate in our repository. Add it to your Cargo.toml:

[dependencies]
openagents-sdk = { git = "https://github.com/OpenAgentsInc/openagents" }
tokio = { version = "1", features = ["macros", "rt"] }

Any language can call the HTTP API directly. Each operation below shows its request and a curl example.

Sign in

A call that acts for your account carries a credential in the Authorization: Bearer header: an app session or a key you created for your account. The SDK takes the credential you give it; it never reads one from your computer on its own. Read how to get a credential.

A first call

Sign in with a credential and read your account:

//! Sign in with a key and read your account: the first call on
//! openagents.com/docs/sdk, which shows this file.
use openagents_sdk::{Client, Deployment};

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // A sign-in key or app session for your account.
    let credential = std::env::var("OPENAGENTS_TOKEN")?;
    let client = Client::new(Deployment::production())?;
    let session = client.authenticate(&credential).await?;
    let view = client.account(&session).await?;
    println!("Signed in as {}", view.account.label);
    for workspace in &view.workspaces {
        println!("Workspace {} ({})", workspace.name, workspace.role);
    }
    Ok(())
}

The same call over HTTP:

curl https://api.openagents.com/v1/account \
  -H "Authorization: Bearer $OPENAGENTS_TOKEN"

API reference

190 operations, generated from our OpenAPI contracts.

  1. Sign-in and account — Sign an app in, read the signed-in account, and sign out.
  2. Keys — List, create, and revoke the keys that act for your account.
  3. Chats — Start chats, send messages, follow answers as they arrive, share chats, and sync chats from your computers.
  4. Chat history — Read saved chats, their files and captures, and the sessions your computers publish.
  5. Home — The projects, work, and dashboards on your Home, and shared dashboard templates.
  6. Agents — Define your own agents and assign them work.
  7. Computers — Create cloud computers, run commands on them, move files, and read usage.
  8. Projects — Create projects, add repositories and members, and share them with invitations.
  9. Files — Upload files to a project, attach documents, and download them again.
  10. Connected sources — Connect Google Drive and attach its files and folders to a project.
  11. Labs — Lab documents, versions, notes, jobs, artifacts, and the workers that run jobs.
  12. Decisions — Ask a decision model typed questions about a state and get typed answers.
  13. Models and balance — The models you can call and the balance your calls draw on.
  14. Workspaces — Workspaces, their members and invitations, keys, billing, and usage.

Calling models through Open Responses or Chat Completions has its own guides: API docs.

Rust SDK reference

Every public module, type, and function, generated from the SDK's source.

  1. openagents_sdk — Public OpenAgents HTTP client.
  2. openagents_sdk::agent_lab — Account-owned Agent Lab documents and bounded experiments.
  3. openagents_sdk::agents — Private, revisioned agent definitions.
  4. openagents_sdk::agents::assignments — Requests to an app on a person's computer, carried by that computer's signed-in session.
  5. openagents_sdk::agents::place — Where a saved agent runs when asked: an online computer of the account with the agent's runtime and a project on it (#11934).
  6. openagents_sdk::agents::runner — Typed, bounded stdio contract for an operator-installed Rust agent.
  7. openagents_sdk::chats — Cloud turns in the existing account chat.
  8. openagents_sdk::cloud_host — Our cloud (#11852): the account's OpenAgents engine on one of its cloud computers.
  9. openagents_sdk::computers — Account-bound cloud computers over the generated public contract.
  10. openagents_sdk::continuations — Move to a linked part without creating a second editable copy of the source.
  11. openagents_sdk::dashboard — Public Home summaries and portable layouts.
  12. openagents_sdk::history — Saved account history.
  13. openagents_sdk::labs — Account-bound Labs, checked edits, and cancellable job and event readers.
  14. openagents_sdk::labs::cad — Local CAD previews use the same portable rules as the server.
  15. openagents_sdk::labs::worker — Signing a computer up to run Lab jobs for an account, and a client that can only run jobs.
  16. openagents_sdk::rooms — Authenticated access to the app's existing Loro rooms on Coder sync.
  17. openagents_sdk::schedules — The account's scheduled prompts (`/v1/schedules`, #11177).
  18. openagents_sdk::sessions — Computer sessions in the account's chat list (#11897).
  19. openagents_sdk::terminal_chats — Saved terminal chats use the same account history and continuation IDs.

The contracts

These pages are drawn from the same files the API is tested against. Download them to generate a client in another language: