All integrations

Rust SDK

Systems services, ML infra, Rust CLIs.

LiveSDKchirp login

Blocking Rust client. `chirp::track` is a synchronous wrapper that opens an activity, runs your closure, and closes on return. Outcome is inferred from the closure's `Result` - `Ok(_)` is green, `Err(_)` is red with the error message. Pure-blocking design (`reqwest::blocking`) keeps the API simple.

If you're in async Rust (tokio, async-std), call from `tokio::task::spawn_blocking` so the HTTP calls don't block the runtime. Most use cases - CLIs, build scripts, ML training loops - are sync, so the blocking client is the right default.

Prerequisites

  • Rust 1.70+ (cargo edition 2021).
  • A Chirp account.

Setup

  1. 1

    Add chirp to Cargo.toml

    cargo add chirp works, or add manually:

    shell
    [dependencies]
    chirp = "0.5"
    anyhow = "1.0"  # for the example below
  2. 2

    Pair your laptop

    Run chirp login once. The SDK reads ~/.chirp/credentials.

    shell
    chirp login
  3. 3

    Wrap your work with chirp::track

    Closure-based API. The SDK propagates anything that implements std::error::Error; pair with anyhow for ergonomic error context.

    main.rs
    use chirp::{track, AgentOptions};
    use anyhow::Result;
    
    fn main() -> Result<()> {
        track(AgentOptions::new("train")
                .schema("@training")
                .theme("#22c55e"), |agent| {
            for epoch in 1..=10 {
                agent.update(format!("epoch {epoch}/10"))?;
                train_one_epoch(epoch)?;
            }
            Ok(())
        })?;
        Ok(())
    }
  4. 4

    (Optional) From async code

    If you're in tokio, wrap with spawn_blocking so the HTTP calls don't stall the runtime. The closure's Result is what the activity outcome reads from.

    shell
    tokio::task::spawn_blocking(|| {
        chirp::track(AgentOptions::new("ingest"), |agent| {
            agent.update("processing batch")?;
            process_batch()?;
            Ok::<_, anyhow::Error>(())
        })
    }).await??;

What you’ll see

Card header: Rust crab logo + "Rust · WORKING" + agent name. Action line shows the latest `update()` argument. Closes green on `Ok`, red on `Err` with the Display impl of the error chain. Panics also close the card red (with the panic message) - the SDK installs a panic-catch so you don't lose the card on unwind.

Troubleshooting

Compile error about reqwest features.
Chirp's reqwest dependency uses default features (rustls). If you have a project-wide reqwest with default-features = false, you may need to enable rustls-tls explicitly. Run cargo tree -i reqwest to find conflicts.
Activity doesn't open when running from a CI matrix.
Most CI matrices run with RUST_LOG=warn or similar - the SDK's first call logs an info-level startup message, but if the network call itself fails (proxy / firewall) the SDK silently swallows the error to avoid breaking your build. Set CHIRP_DEBUG=1 to surface failures.
I want to update from multiple threads.
The Agent handle inside the closure is Send + Sync. Clone it via agent.clone() (it's an Arc under the hood) and move into worker threads.