OPEN SOURCE · EMBEDDABLE AGENT RUNTIME

Add A3S Codeto an existing product

A3S Code provides agent sessions, tool execution, approvals, event streaming, and task recovery. Run a3s code directly or embed the Rust, Node.js, Python, or Go SDK.

a3s codeCLI
curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/A3S-Lab/a3s/main/install.sh | sh
a3s code
a3s code~/workspace/a3s

a3s-code v6.6.0·openai/gpt-5·12 skills·~/workspace/a3s

Type a message · / for commands · Shift+Tab cycles mode · Ctrl+C twice to exit

You

Audit this repo for release risks offline; generate a report

ArtifactHTML · 18.4 KB
release-risk-report/index.htmlOpen viewRemoteUI
RemoteUIready
Release risk report2 risks · 12 checks
A3S Code

Review complete. Three subagents finished in parallel; the report artifact is ready to open in RemoteUI.

  1. Read repo constraints and release config

  2. Check code, tests, and docs in parallel

  3. Publish report artifact and open RemoteUI

◇ high

defaultctx:12%a3sgit:(main)gpt-5 (128k context)
WHY A3S CODE

Check arguments, permissions, and approvals before execution

Model tool calls do not go straight to the filesystem or shell. The runtime completes its checks first, then sends execution events and results to the application.

01

Check files, shell, Git, and external requests

After the model submits tool arguments, the runtime checks the arguments, workspace capability, and permission policy. Calls that need approval pause before execution.

policyHITLsandbox
02

Store large output as artifacts

File, search, command, and web results support ranges or cursors. Oversized output is written to an artifact; the model receives a preview, size, hash, and retrieval URI.

cursorartifacthash
03

Render the AgentEvent stream

Text, tool calls, plans, approvals, and lifecycle changes have explicit event types. A terminal, IDE, or web app can consume the same stream.

AgentEventEventEnvelopeV1
04

Resume from SessionSnapshotV1

Sessions, runs, artifacts, traces, verification results, and child-task records are committed as one snapshot generation and loaded directly on resume.

snapshotreplayverification
A3S CODE / DISTINCTIVE CAPABILITIES

Five decisive moments that make a coding run safer and smarter

From approval before execution to code semantics, on-demand platform discovery, and past-session recall: select a scenario to see the real interaction order and boundaries in the A3S Code TUI.

Read the complete TUI guide
a3s code~/workspace/a3s

Push main to origin after the tests pass

Preparinggit push origin main
◇ high

default modectx:12%a3sgit:(main)gpt-5 (128k context)
HOW IT RUNS

Follow one complete run in Python

The example uses the actual a3s_code API in this repository. Scroll or select a step to add the Session, context limits, policy, event stream, and persistence.

Read the architecture guide
ACTIVE LAYERWays to use it
runtime.pyPYTHON
from contextlib import closing
from pathlib import Path
from a3s_code import Agent
workspace = str(Path.cwd())
with closing(Agent.create("agent.acl")) as agent:
pass
ACTIVE LAYERAgent and session
runtime.pyPYTHON
from contextlib import closing
from pathlib import Path
from a3s_code import Agent, LocalWorkspaceBackend, SessionOptions
workspace = str(Path.cwd())
options = SessionOptions()
options.planning_mode = "disabled"
options.workspace_backend = LocalWorkspaceBackend(workspace)
with closing(Agent.create("agent.acl")) as agent:
with closing(agent.session(workspace, options)) as session:
pass
ACTIVE LAYERContext, memory, and models
runtime.pyPYTHON
from contextlib import closing
from pathlib import Path
from a3s_code import Agent, LocalWorkspaceBackend, SessionOptions
workspace = str(Path.cwd())
options = SessionOptions()
options.planning_mode = "disabled"
options.auto_compact = True
options.auto_compact_threshold = 0.8
options.max_context_tokens = 128_000
options.workspace_backend = LocalWorkspaceBackend(workspace)
with closing(Agent.create("agent.acl")) as agent:
with closing(agent.session(workspace, options)) as session:
pass
ACTIVE LAYERPermission and execution checks
runtime.pyPYTHON
from contextlib import closing
from pathlib import Path
from a3s_code import (
Agent,
LocalWorkspaceBackend,
PermissionPolicy,
SessionOptions,
)
workspace = str(Path.cwd())
options = SessionOptions()
options.planning_mode = "disabled"
options.auto_compact = True
options.auto_compact_threshold = 0.8
options.max_context_tokens = 128_000
options.permission_policy = PermissionPolicy(
allow=["read*", "ls*", "glob*", "grep*", "code_*"],
deny=["write*", "edit*", "patch*", "bash*", "git*"],
default_decision="deny",
)
options.workspace_backend = LocalWorkspaceBackend(workspace)
with closing(Agent.create("agent.acl")) as agent:
with closing(agent.session(workspace, options)) as session:
pass
ACTIVE LAYERProject files and tools
runtime.pyPYTHON
from contextlib import closing
from pathlib import Path
from a3s_code import (
Agent,
EventType,
LocalWorkspaceBackend,
PermissionPolicy,
SessionOptions,
)
workspace = str(Path.cwd())
options = SessionOptions()
options.planning_mode = "disabled"
options.auto_compact = True
options.auto_compact_threshold = 0.8
options.max_context_tokens = 128_000
options.permission_policy = PermissionPolicy(
allow=["read*", "ls*", "glob*", "grep*", "code_*"],
deny=["write*", "edit*", "patch*", "bash*", "git*"],
default_decision="deny",
)
options.workspace_backend = LocalWorkspaceBackend(workspace)
with closing(Agent.create("agent.acl")) as agent:
with closing(agent.session(workspace, options)) as session:
for event in session.stream(
"Find the authentication entry points. Do not change files."
):
if event.type == EventType.TEXT_DELTA and event.text:
print(event.text, end="", flush=True)
elif event.type == EventType.TOOL_START:
print(f"\n {event.tool_name or 'tool'}")
elif event.type == EventType.ERROR:
raise RuntimeError(event.error or "A3S Code run failed")
ACTIVE LAYEREvents, records, and recovery
runtime.pyPYTHON
from contextlib import closing
from pathlib import Path
from a3s_code import (
Agent,
EventType,
FileSessionStore,
LocalWorkspaceBackend,
PermissionPolicy,
SessionOptions,
)
workspace = str(Path.cwd())
options = SessionOptions()
options.planning_mode = "disabled"
options.auto_compact = True
options.auto_compact_threshold = 0.8
options.max_context_tokens = 128_000
options.permission_policy = PermissionPolicy(
allow=["read*", "ls*", "glob*", "grep*", "code_*"],
deny=["write*", "edit*", "patch*", "bash*", "git*"],
default_decision="deny",
)
options.workspace_backend = LocalWorkspaceBackend(workspace)
options.session_store = FileSessionStore(".a3s/sessions")
with closing(Agent.create("agent.acl")) as agent:
with closing(agent.session(workspace, options)) as session:
for event in session.stream(
"Find the authentication entry points. Do not change files."
):
if event.type == EventType.TEXT_DELTA and event.text:
print(event.text, end="", flush=True)
elif event.type == EventType.TOOL_START:
print(f"\n {event.tool_name or 'tool'}")
elif event.type == EventType.ERROR:
raise RuntimeError(event.error or "A3S Code run failed")
runs = session.runs()
if runs:
current = runs[-1]
print(f"\nrun={current['id']} status={current['status']}")
session.save()
WHAT YOU GET

Five parts of the runtime

Tools, models, run data, extension interfaces, and workspaces are configured separately. An application can enable only the parts it needs.

TOOL CALLS

Workspace and policy determine the tool list

Files, search, shell, Git, web, batch, QuickJS, structured output, and child tasks are exposed only when the current workspace supports them and policy allows them.

filesshellgitwebprogramtask
MODELS

Change the model adapter, not the Session API

Use Anthropic, Zhipu, OpenAI-compatible APIs, or inject your own LlmClient.

streamingtoolsstructured output
RUN DATA

Runs, events, and snapshots use stable formats

A task can save snapshots, events, traces, artifacts, verification results, and checkpoints for queries, audit, or recovery.

atomicreplayableauditable
EXTENSIONS

Extend tools, context, and storage

Replace or extend MCP, Skills, ContextProvider, MemoryStore, SessionStore, workspace services, and custom tools.

MCPSkillstraits
WORKSPACE

Local, S3, and remote workspaces declare capabilities

Code navigation and file tools come from the workspace you select. If a remote or object-backed workspace cannot run local commands, Bash and Git are not shown to the model.

symbolsdiagnosticslocal / S3 / remote
USE IT YOUR WAY

Run the CLI or use one of four SDKs

Use the terminal app directly in a repository. Use the Rust crate, Node.js package, Python package, or Go module in an IDE, runner, server, or custom interface.

Terminal

a3s code

A ready-to-run terminal UI for reasoning, tool calls, approval prompts, task progress, and diffs.

a3s code
Rust

a3s-code-core

The complete async runtime API, plus public traits for custom integrations.

cargo add a3s-code-core
Node.js

@a3s-lab/code

Native N-API bindings for sessions, event streams, tools, storage, orchestration, and MCP.

npm install @a3s-lab/code
Python

a3s-code

A native PyO3 package with both synchronous and asynchronous APIs.

python -m pip install a3s-code
Go

sdk/go/v6

A pure-Go API for sessions, event streams, tools, verification, and MCP through a long-lived bridge, without CGO.

go get github.com/A3S-Lab/Code/sdk/go/v6
WHAT STAYS YOURS

The runtime executes; the app owns accounts and access

  • A3S Code Core provides the agent runtime. It is not a hosted service and does not dictate your UI.
  • The a3s code terminal interface comes from the separate A3S CLI.
  • Accounts, credentials, deployment, and direct access to application tools remain under your control.
Read the architecture guide
TRY IT

Start with a read-only task

Install a3s code and run one inspection in an existing repository. Choose the Rust, Node.js, Python, or Go SDK when you are ready to embed it.