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
- Sign-in and account — Sign an app in, read the signed-in account, and sign out.
- Keys — List, create, and revoke the keys that act for your account.
- Chats — Start chats, send messages, follow answers as they arrive, share chats, and sync chats from your computers.
- Chat history — Read saved chats, their files and captures, and the sessions your computers publish.
- Home — The projects, work, and dashboards on your Home, and shared dashboard templates.
- Agents — Define your own agents and assign them work.
- Computers — Create cloud computers, run commands on them, move files, and read usage.
- Projects — Create projects, add repositories and members, and share them with invitations.
- Files — Upload files to a project, attach documents, and download them again.
- Connected sources — Connect Google Drive and attach its files and folders to a project.
- Labs — Lab documents, versions, notes, jobs, artifacts, and the workers that run jobs.
- Decisions — Ask a decision model typed questions about a state and get typed answers.
- Models and balance — The models you can call and the balance your calls draw on.
- Workspaces — Workspaces, their members and invitations, keys, billing, and usage.
Rust SDK reference
openagents_sdk— Public OpenAgents HTTP client.openagents_sdk::agent_lab— Account-owned Agent Lab documents and bounded experiments.openagents_sdk::agents— Private, revisioned agent definitions.openagents_sdk::agents::assignments— Requests to an app on a person's computer, carried by that computer's signed-in session.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).openagents_sdk::agents::runner— Typed, bounded stdio contract for an operator-installed Rust agent.openagents_sdk::chats— Cloud turns in the existing account chat.openagents_sdk::cloud_host— Our cloud (#11852): the account's OpenAgents engine on one of its cloud computers.openagents_sdk::computers— Account-bound cloud computers over the generated public contract.openagents_sdk::continuations— Move to a linked part without creating a second editable copy of the source.openagents_sdk::dashboard— Public Home summaries and portable layouts.openagents_sdk::history— Saved account history.openagents_sdk::labs— Account-bound Labs, checked edits, and cancellable job and event readers.openagents_sdk::labs::cad— Local CAD previews use the same portable rules as the server.openagents_sdk::labs::worker— Signing a computer up to run Lab jobs for an account, and a client that can only run jobs.openagents_sdk::rooms— Authenticated access to the app's existing Loro rooms on Coder sync.openagents_sdk::schedules— The account's scheduled prompts (`/v1/schedules`, #11177).openagents_sdk::sessions— Computer sessions in the account's chat list (#11897).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:
- App API (
docs/sdk/openapi.app.json) - System One (
docs/sdk/openapi.systemone.json) - Decision API (
docs/agents/openapi.yaml)