Install

# Cargo.toml
[dependencies]
orgs-sdk = "0.9"
tokio = { version = "1", features = ["full"] }

Quick start

use orgs_sdk::{Client, ProposalKind};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new(std::env::var("ORGS_API_KEY")?);

    // List entities
    let entities = client.entities().list().await?;
    for entity in &entities {
        println!("{}: {}", entity.did, entity.name);
    }

    // Create a proposal
    let proposal = client.proposals().create(
        "helios-research",
        ProposalKind::Spend {
            amount_usd: 12_500.0,
            recipient: "aws-bedrock".into(),
            description: "Q2 compute reservation".into(),
        },
    ).await?;

    println!("Proposal created: {}", proposal.id);
    Ok(())
}

Client configuration

let client = Client::builder()
    .api_url("https://api.orgs.sh/v1")
    .api_key(std::env::var("ORGS_API_KEY")?)
    .timeout(Duration::from_secs(30))
    .max_retries(3)
    .build()?;

Error handling

All methods return Result<T, OrgsError> where OrgsError is an enum covering all error codes from Errors:
match client.treasury().disburse(...).await {
    Ok(receipt) => { /* success */ },
    Err(OrgsError::InsufficientFunds { requested, available }) => {
        eprintln!("Not enough: ${requested} > ${available}");
    }
    Err(OrgsError::EscalationRequired { contact, .. }) => {
        eprintln!("Human approval required from {contact}");
    }
    Err(e) => eprintln!("Other error: {e}"),
}

Signing

use orgs_sdk::signing::{SigningKey, HardwareKey};

// Software key (stored in Arsenal vault)
let signer = SigningKey::from_passphrase(passphrase)?;

// Hardware key
let signer = HardwareKey::ledger()?;

let vote = client.proposals()
    .vote(&proposal_id, Choice::Approve)
    .signed_by(&signer)
    .await?;

MCP mode

When running inside an MCP-capable agent, the SDK can auto-discover the MCP server:
let client = Client::from_mcp()?;
// Uses ACT from the MCP context, no API key required.

Full documentation

Rust SDK rustdoc: docs.rs/orgs-sdk. Source: github.com/l1feai/orgs.