Expand description
Unified Rust SDK for multiple AI coding agents.
unified-agent-sdk provides one consistent interface over multiple agent backends.
It is designed for applications that want to swap executors without rewriting
orchestration logic.
§Feature Overview
- Unified executor API via
AgentExecutor - Provider adapter architecture
- Unified event pipeline (
raw logs -> normalized logs -> AgentEvent) - Profile/config resolution with runtime discovery (
ProfileManager) - Cross-provider capability and availability introspection
§Supported Agents
| Agent | ExecutorType | Executor Adapter | Log Normalizer | Profile Discovery |
|---|---|---|---|---|
| Claude Code | ExecutorType::ClaudeCode | ClaudeCodeExecutor | ClaudeCodeLogNormalizer | providers::claude_code::profile |
| Codex | ExecutorType::Codex | CodexExecutor | CodexLogNormalizer | providers::codex::profile |
§Common Scenarios
Start a new session with one provider:
use unified_agent_sdk::{
AgentExecutor, CodexExecutor, PermissionPolicy, executor::SpawnConfig,
};
let executor = CodexExecutor::default();
let config = SpawnConfig {
model: Some("gpt-5-codex".to_string()),
reasoning: Some("medium".to_string()),
permission_policy: Some(PermissionPolicy::Prompt),
env: vec![],
context_window_override_tokens: None,
};
let cwd = std::env::current_dir()?;
let session = executor
.spawn(&cwd, "Summarize this repository in three bullets.", &config)
.await?;
println!("session_id={}", session.session_id);Resolve profile + runtime overrides before spawning:
use unified_agent_sdk::{
ExecutorConfig, ExecutorType, ProfileId, ProfileManager,
};
let manager = ProfileManager::new();
let resolved = manager
.resolve(&ExecutorConfig {
profile_id: ProfileId::new(ExecutorType::Codex, Some("default".to_string())),
model_override: None,
reasoning_override: Some("high".to_string()),
permission_policy: None,
})
.await?;
let _ = (resolved.model, resolved.reasoning, resolved.permission_policy);Build a session event stream with hooks:
use futures::{StreamExt, stream};
use std::path::PathBuf;
use std::sync::Arc;
use unified_agent_sdk::{
AgentEvent, AgentSession, CodexLogNormalizer, EventType, ExecutorType, HookManager,
session::RawLogStream,
};
let session = AgentSession::new(
"demo-session",
ExecutorType::Codex,
PathBuf::from("."),
None,
);
let hooks = Arc::new(HookManager::new());
hooks.register(
EventType::MessageReceived,
Arc::new(|event| Box::pin(async move {
if let AgentEvent::MessageReceived { content, .. } = event {
println!("message={content}");
}
})),
);
let raw_logs: RawLogStream = Box::pin(stream::iter(vec![
br#"{"type":"item.completed","item":{"type":"agent_message","id":"m1","text":"hello"}}"#
.to_vec(),
b"\n".to_vec(),
]));
let mut stream = session.event_stream(raw_logs, Box::new(CodexLogNormalizer::new()), Some(hooks));
let _ = stream.next().await;Re-exports§
pub use error::ExecutorError;pub use error::Result;pub use event::AgentEvent;pub use event::EventConverter;pub use event::EventStream;pub use event::EventType;pub use event::HookManager;pub use event::normalized_log_to_event;pub use executor::AgentCapabilities;pub use executor::AgentExecutor;pub use executor::AvailabilityStatus;pub use log::LogNormalizer;pub use log::NormalizedLog;pub use profile::DiscoveryData;pub use profile::ExecutorConfig;pub use profile::ProfileId;pub use profile::ProfileManager;pub use providers::ClaudeCodeExecutor;pub use providers::ClaudeCodeLogNormalizer;pub use providers::CodexExecutor;pub use providers::CodexLogNormalizer;pub use session::AgentSession;pub use session::SessionMetadata;pub use session::SessionResume;pub use types::ContextUsage;pub use types::ContextUsageSource;pub use types::ExecutorType;pub use types::ExitStatus;pub use types::PermissionPolicy;pub use types::Role;pub use types::ToolStatus;
Modules§
- error
- Typed errors used by the unified SDK.
- event
- Unified event stream and hook system.
- executor
- Provider-agnostic session execution contract.
- log
- Provider log normalization primitives.
- profile
- Profile and configuration management.
- providers
- Provider implementations for specific agent SDKs.
- session
- Session handles, metadata, and event-stream construction.
- types
- Core public types shared across unified executors, sessions, and events.