A3S Code
A3S Code
Embeddable AI coding agent framework in Rust with native Node.js and Python bindings
A3S Code
Embeddable AI coding agent framework in Rust — Build AI agents that read, write, and execute code with tool access, planning, safety controls, and multi-machine distribution.
let agent = Agent::new("agent.hcl").await?;
let session = agent.session(".", None)?;
let result = session.send("Refactor auth to use JWT", None).await?;Test Coverage: 1387 tests, 100% pass rate | Extension Points: 19 trait-based | Built-in Tools: 12 (13 with sandbox feature)
Why A3S Code?
🔧 Embeddable
Rust library, not a service. Integrate into your app with Node.js/Python bindings.🛡️ Production-Ready
Permission system, HITL confirmation, skill-based tool restrictions, and error recovery (parse retries, tool timeout, circuit breaker).🔌 Extensible
14 trait-based extension points. Replace any policy with your own implementation.📈 Scalable
Lane-based priority queue with multi-machine task distribution.Quick Start
Installation
cargo add a3s-code-corenpm install @a3s-lab/codepip install a3s-codeConfiguration
Create agent.hcl:
default_model = "anthropic/claude-sonnet-4-20250514"
providers {
name = "anthropic"
api_key = env("ANTHROPIC_API_KEY")
}A3S Code uses HCL configuration format exclusively. See Providers for multi-provider setup and full config reference.
Basic Usage
use a3s_code_core::{Agent, SessionOptions};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let agent = Agent::new("agent.hcl").await?;
// Basic usage
let session = agent.session(".", None)?;
let result = session.send("What files handle authentication?", None).await?;
println!("{}", result.text);
// With options
let session = agent.session(".", Some(
SessionOptions::new()
.with_default_security()
.with_builtin_skills()
.with_planning(true)
))?;
let result = session.send("Refactor auth + update tests", None).await?;
Ok(())
}import { Agent } from '@a3s-lab/code';
const agent = await Agent.create('agent.hcl');
const session = agent.session('.', {
defaultSecurity: true,
builtinSkills: true,
planning: true,
});
const result = await session.send('Refactor auth + update tests');
console.log(result.text);from a3s_code import Agent
agent = Agent.create("agent.hcl")
session = agent.session(".", default_security=True, builtin_skills=True, planning=True)
result = session.send("Refactor auth + update tests")
print(result.text)Architecture
5 core components (stable, not replaceable) + 14 extension points (replaceable via traits):
Agent (config-driven)
└── AgentSession (workspace-bound)
├── AgentLoop (core execution engine)
│ ├── ToolExecutor (11 built-in tools)
│ ├── Planning (task decomposition + wave execution)
│ └── HITL Confirmation
├── SessionLaneQueue (a3s-lane backed)
│ ├── Control (P0) → Query (P1) → Execute (P2) → Generate (P3)
│ └── External Task Distribution
├── HookEngine (8 lifecycle events)
├── Security (PII redaction, injection detection)
├── Skills (instruction injection + tool permissions)
├── Context (RAG providers)
└── Memory (episodic, semantic, procedural, working)See Architecture for detailed documentation.
Documentation
Core
Security & Safety
- Security — Permissions, PII redaction, HITL
Infrastructure
- Architecture — System design overview
- Lane Queue — Priority routing and queue features
- Multi-Machine — Horizontal scaling guide
Testing
cargo test # All tests
cargo test --lib # Unit tests onlyTest Coverage: 1387 tests, 100% pass rate
License
MIT License
Related Projects
- A3S Lane — Priority-based task queue with DLQ
- A3S Search — Multi-engine web search aggregator
- A3S Box — Secure sandbox runtime with TEE support
- A3S Event — Event-driven architecture primitives