Skip to main content

Crate a3s_code_core

Crate a3s_code_core 

Source
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]
    }
}

§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 dispatch
  +-- Orchestrator for direct SubAgent lifecycle control

Re-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;

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.
orchestrator
Advanced SubAgent control plane.
permissions
Permission system for tool execution control
planning
Planning, Goal Tracking, and Task Management
plugin
Plugin System for A3S Code
program
Programmatic tool calling primitives.
queue
Per-session command queue with lane-based priority scheduling
sandbox
Sandbox integration for bash tool execution.
security
Security Module
skills
Skill System
store
Session persistence layer
subagent
Subagent 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.
AgentResult
Result of agent execution
AgentSession
Workspace-bound session. All LLM and tool operations happen here.
BtwResult
Result of a /btw ephemeral side question.
SessionOptions
Optional per-session overrides.
SystemPromptSlots
Slot-based system prompt customization with intent-based style selection.
ToolCallResult
Result of a direct tool execution (no LLM).

Enums§

AgentEvent
Events emitted during agent execution
AgentStyle
Agent style — determines which system prompt template is used.
DetectionConfidence
Detection confidence level for style detection.
PlanningMode
Planning mode — controls when planning phase is used.