Expand description
Embed coding agents in your application.
Stubb drives coding agents through their native protocols and exposes them
through one provider-neutral interface, Provider. A Session is a
conversation with an agent: subscribe to its
events, then send messages.
§Layout
providers: the agents Stubb integrates. Codex, Claude Code and Pi are driven natively, and any agent that speaks the Agent Client Protocol throughproviders::acp. Each sits behind a Cargo feature of the same name, all enabled by default.session,turn,catalog,request,permissionandusage: the shared concepts every provider speaks, from models and their settings to the questions an agent asks during a turn.observation: optional contracts for attributed activity across a session, such as subagent trees and native tasks. Providers without this support returnError::Unsupportedrather than empty results.discovery: finding, describing and updating the agents installed on this computer, without starting them.process: how Stubb starts agent processes and what they inherit.
Provider-specific behavior stays visible: each provider reports its
capabilities, and unsupported operations
return Error::Unsupported.
§Example
use stubb::providers::claude::{Claude, ClaudeConfig};
use stubb::{session, turn};
let provider = Claude::new(ClaudeConfig::default());
let live = provider
.start_session(session::Spec {
cwd: std::env::current_dir()?,
settings: session::Settings::default(),
})
.await?;
let mut events = live.subscribe();
live.send(turn::Input::text("Summarize this repository.")).await?;
while let Ok(event) = events.recv().await {
println!("{event:?}");
}The examples directory has runnable programs for each step: quickstart,
models, sessions, chat, and more.
Modules§
- catalog
- Models a provider offers and the settings that depend on them.
- discovery
- Finding, identifying, and updating the agents installed on this computer.
- observation
- Observing what an agent does across a session: its
agenttree, nativetasks andcontrolreceipts, and the session-wide record stream. - permission
- Permission configuration for session start and resume.
- process
- What every agent process Stubb spawns shares: it never outlives the host, and it starts with the environment the host chose.
- provider
- The interface every harness integration implements.
- providers
- The agents Stubb integrates. Each implements
crate::Providerand is compiled only when its Cargo feature (claude,codex,pi,acp) is enabled; all four are enabled by default. - request
- Questions an agent asks the host application during a turn, such as permission to use a tool, and the host’s answers.
- session
- Sessions: durable conversations with a harness. Codex calls them threads.
- turn
- Turns: one user input and everything the agent did in response.
- usage
- Account-wide quotas reported by a native provider. These are separate from a turn’s token counts; missing values remain unknown.
Structs§
Enums§
- Error
- Errors returned by Stubb operations.
Traits§
- Provider
- A harness Stubb can drive, such as Codex.