A3S Code

A3S Code is the Rust runtime behind the a3s code terminal application. You can also embed it in an IDE, runner, service, or desktop application. It handles the agent loop, context, tool calls, permission checks, child tasks, Workspace access, and session recovery.

Install the a3s CLI when you want to work in a terminal. Use the Rust crate, Node.js package, or Python package when you are building a product. They emit the same events, so every UI does not need its own agent loop.

Choose an entry point

EntryUse it whenRepository
Rust / Node.js / Python SDKsAdding a coding agent to an IDE, runner, service, or custom UIA3S-Lab/Code
a3s codeRunning a coding agent directly in your terminalA3S-Lab/a3s
a3s-tuiBuilding a terminal UI; it does not include the agent runtimeA3S-Lab/TUI
A3S WebStudying the desktop task UI and its component implementationapps/web
A3S FlowSaving and resuming flows used by DynamicWorkflowRuntimeA3S-Lab/Flow

What it includes

AreaWhat A3S Code provides
Agent sessionsCreate a Workspace-bound AgentSession with SessionBuilder; send, run, stream, cancel, save, resume, and close it. Concurrent transcript operations fail immediately instead of racing.
User interfacesa3s code renders the event stream in a terminal. Applications can render the same AgentEvent stream in their own interface.
Project filesFilesystem-first explains AGENTS.md, ACL config, .a3s/agents/, skills/, tools/, and schedules/.
ToolsBuilt-in files, search, shell, Git, web, batch, structured output, QuickJS, Skills, MCP, and child-task tools. Model calls pass through argument, permission, confirmation, and cancellation checks.
CommandsCommands covers TUI slash commands and custom /command handlers registered by an application.
Child tasksUse task, parallel_task, session.task(...), or session.tasks(...) with built-in and custom agents. Automatic delegation can be enabled separately.
WorkflowsUse session.parallel, pipelines, phases, checkpoints, loop limits, and budget records for fixed, recoverable workflows.
Scheduled workRun scheduled AgentDir turns through serveAgentDir / serve_agent_dir; each schedule keeps a stable schedule:<name> session.
Access controlApply permission rules, user confirmation, budgets, Workspace path checks, tool timeouts, hooks, and output cleanup during execution.
WorkspacesWorkspace backends support local files, application-provided workspaces, optional S3-compatible storage, and remote Git services.
EventsEventEnvelopeV1 is shared by Rust, Node.js, and Python. Unknown event payloads and metadata are preserved.
Save and resumeSession snapshots, run events, traces, artifacts, loop/workflow checkpoints, and memory stores make sessions recoverable.
VerificationVerification runs named checks and returns reports, summaries, artifacts, traces, and replay data.

A run roughly follows this path:

Text
Agent / AgentSession
-> collect project context
-> optional plan
-> select tools or child tasks
-> check permission and ask the user when needed
-> execution
-> publish events and verification results
-> save the session

Install

For the interactive terminal workspace, run the installer for your platform:

macOS / Linux
Windows
SHELLSCRIPT
curl --proto '=https' --tlsv1.2 -LsSf \
https://raw.githubusercontent.com/A3S-Lab/a3s/main/install.sh | sh

The scripts select the release archive for the current system and architecture and verify its SHA-256 digest. You can also use brew install a3s-lab/tap/a3s or cargo install a3s.

Install an SDK when embedding A3S Code:

SHELLSCRIPT
npm install @a3s-lab/code
pip install a3s-code
cargo add a3s-code-core

Configure

A3S Code uses ACL. Keep real API keys, private model endpoints, local config paths, and tenant/user identifiers out of commits. Commit templates that resolve credentials from the environment.

Text
default_model = "provider/model-id"
max_parallel_tasks = 4
auto_parallel = false
providers "provider" {
apiKey = env("PROVIDER_API_KEY")
baseUrl = env("PROVIDER_BASE_URL")
models "model-id" {
tool_call = true
limit = {
context = 128000
output = 4096
}
}
}
storage_backend = "file"
sessions_dir = ".a3s/sessions"

auto_parallel = false disables automatic parallel child-agent fan-out only. Manual parallel_task remains available unless manual delegation is disabled separately.

Use the TUI

Run a3s code from the workspace you want the agent to inspect:

SHELLSCRIPT
a3s code
a3s code resume <session-id>
a3s code update

The TUI discovers config from A3S_CONFIG_FILE, then .a3s/config.acl walking upward from the current directory, then ~/.a3s/config.acl.

Common first-run flow:

Text
/init # inspect the repository and create or update AGENTS.md
/model # pick a configured provider or account-backed model
/effort # choose low, medium, high, xhigh, max, or ultracode
/ide # open the workspace tree and terminal editor
/help # open the full command and shortcut guide

Rust Runtime Quick Start

Rust construction is async-first. The synchronous Agent::session method only works when memory and the other required resources are already initialized; options that require async setup return CodeError::AsyncSessionBuildRequired. A session-option MCP manager always uses the async path while discovering tools.

Calls such as session.tool(...) come from your application, not the model. Check access in your application before exposing them to users.

Continue reading

  • A3S Code TUI explains installation, config discovery, slash commands, and effort profiles.
  • Filesystem-first covers AGENTS.md, ACL, AgentDir, Skills, tools, and schedules.
  • API contract lists the Node.js API covered by integration tests.
  • Sessions covers creation, streaming, run state, saving, resuming, and cancellation.
  • Tools covers direct calls, typed errors, structured output, and QuickJS programs.
  • Tasks and orchestration cover child agents and fixed workflows.
  • Security, hooks, and verification cover checks before, during, and after execution.
  • Memory and persistence cover reusable facts and session recovery.