Expand description
A3S Code Core Library
Harness-driven runtime for coding agents.
Agent and AgentSession are the primary 2.0 API. Lower-level session
runtime state is internal; persistence data flows through store::SessionData.
§Quick Start
use a3s_code_core::{Agent, AgentEvent};
// From an ACL-compatible config file path (.acl)
let agent = Agent::new("agent.acl").await?;
// Create a workspace-bound session
let session = agent.session("/my-project", None)?;
// Non-streaming
let result = session.send("What files handle auth?", None).await?;
println!("{}", result.text);
// Streaming (AgentEvent is #[non_exhaustive])
let (mut rx, _handle) = session.stream("Refactor auth", None).await?;
while let Some(event) = rx.recv().await {
match event {
AgentEvent::TextDelta { text } => print!("{text}"),
AgentEvent::End { .. } => break,
_ => {} // required: #[non_exhaustive]
}
}§Disposable Workers
use a3s_code_core::{Agent, SessionOptions, WorkerAgentSpec};
let agent = Agent::new("agent.acl").await?;
let frontend = WorkerAgentSpec::implementer(
"frontend-cow",
"Small verified frontend fixes",
)
.with_model_ref("openai/gpt-4o")
.with_max_steps(24);
let session = agent.session(
"/my-project",
Some(SessionOptions::new().with_worker_agent(frontend)),
)?;§Architecture
Agent (config-driven facade)
+-- AgentSession (workspace-bound execution API)
+-- internal turn runner
+-- ContextAssembler / ContextProvider
+-- ToolSelector
+-- ToolExecutor
+-- ProgramExecutor (PTC)
+-- SkillRegistry
+-- Permission / confirmation
+-- Trace / artifacts / verification evidence
Advanced infrastructure:
+-- optional lane queues for explicit external/hybrid dispatchRe-exports§
pub use config::CodeConfig;pub use config::ModelConfig;pub use config::ModelCost;pub use config::ModelLimit;pub use config::ModelModalities;pub use config::ProviderConfig;pub use error::CodeError;pub use error::Result;pub use llm::clear_http_metrics_callback;pub use llm::set_http_metrics_callback;pub use llm::AnthropicClient;pub use llm::Attachment;pub use llm::ContentBlock;pub use llm::HttpMetricsCallback;pub use llm::HttpMetricsRecord;pub use llm::ImageSource;pub use llm::LlmClient;pub use llm::LlmResponse;pub use llm::Message;pub use llm::OpenAiClient;pub use llm::TokenUsage;pub use run::ActiveToolSnapshot;pub use run::InMemoryRunStore;pub use run::RunEventRecord;pub use run::RunHandle;pub use run::RunRecord;pub use run::RunSnapshot;pub use run::RunStatus;pub use subagent::AgentDefinition;pub use subagent::AgentRegistry;pub use subagent::CattleAgentKind;pub use subagent::CattleAgentSpec;pub use subagent::WorkerAgentKind;pub use subagent::WorkerAgentSpec;
Modules§
- commands
- Slash Commands — Interactive session commands
- config
- Configuration module for A3S Code
- context
- Context Provider Extension Point
- error
- Typed error enum for A3S Code Core
- hitl
- Human-in-the-Loop (HITL) confirmation mechanism
- hooks
- Hooks System for A3S Code Agent
- llm
- LLM client abstraction layer
- mcp
- MCP (Model Context Protocol) Support
- memory
- Memory and learning system for the agent.
- permissions
- Permission system for tool execution control
- planning
- Planning, Goal Tracking, and Task Management
- program
- Programmatic tool calling primitives.
- queue
- Per-session command queue with lane-based priority scheduling
- run
- Durable run primitives for agent executions.
- sandbox
- Sandbox integration for bash tool execution.
- security
- Security Module
- skills
- Skill System
- store
- Session persistence layer
- subagent
- Delegated Agent System
- telemetry
- Telemetry Module (Core)
- tools
- Extensible Tool System
- trace
- Runtime trace primitives.
- verification
- Verification contracts for A3S Code 2.0.
Structs§
- Agent
- High-level agent facade.
- Agent
Result - Result of agent execution
- Agent
Session - Workspace-bound session. All LLM and tool operations happen here.
- Session
Options - Optional per-session overrides.
- System
Prompt Slots - Slot-based system prompt customization with intent-based style selection.
- Tool
Call Result - Result of a direct tool execution (no LLM).
Enums§
- Agent
Event - Events emitted during agent execution
- Agent
Style - Agent style — determines which system prompt template is used.
- Detection
Confidence - Detection confidence level for style detection.
- Planning
Mode - Planning mode — controls when planning phase is used.