不联网检查这个仓库的发布风险,并生成报告
把 A3S Code接进现有产品
A3S Code 提供 Agent 会话、工具调用、权限确认、事件流和任务恢复。你可以直接使用 a3s code,也可以通过 Rust、Node.js、Python 或 Go SDK 嵌入现有应用。
curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/A3S-Lab/a3s/main/install.sh | sha3s codeType a message · / for commands · Shift+Tab cycles mode · Ctrl+C twice to exit
检查完成。3 个子智能体并行完成;报告制品已生成,可通过 RemoteUI 打开。
- ✔
读取项目约束与发布配置
- ✔
并行检查代码、测试与文档
- ✔
生成报告制品并打开 RemoteUI
工具执行之前,先检查参数、权限和确认状态
模型给出的工具调用不会直接落到文件系统或 Shell。Runtime 先完成检查,再把执行事件和结果交给应用。
统一检查文件、Shell、Git 与外部请求
模型提交工具参数后,Runtime 依次检查参数、Workspace 能力和权限规则。需要用户确认的调用会先暂停,不会直接执行。
大输出保存为 Artifact
文件、搜索、命令和网页结果都支持范围或游标。超过限制的内容会写入 Artifact,模型只收到预览、大小、哈希和取回地址。
界面订阅 AgentEvent
文本、工具调用、计划、确认和生命周期变化都有明确的事件类型。终端、IDE 和网页可以消费同一条事件流。
SessionSnapshotV1 保存恢复数据
会话、Run、Artifact、Trace、验证结果和子任务记录按同一代快照提交。恢复时直接读取已保存状态。
用 Python 走完一次执行
示例使用仓库中实际提供的 a3s_code API。滚动或点击步骤,代码会逐步加入 Session、上下文限制、权限、事件流和持久化。
查看架构说明from contextlib import closingfrom pathlib import Pathfrom a3s_code import Agentworkspace = str(Path.cwd())with closing(Agent.create("agent.acl")) as agent:pass
from contextlib import closingfrom pathlib import Pathfrom a3s_code import Agent, LocalWorkspaceBackend, SessionOptionsworkspace = 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
from contextlib import closingfrom pathlib import Pathfrom a3s_code import Agent, LocalWorkspaceBackend, SessionOptionsworkspace = str(Path.cwd())options = SessionOptions()options.planning_mode = "disabled"options.auto_compact = Trueoptions.auto_compact_threshold = 0.8options.max_context_tokens = 128_000options.workspace_backend = LocalWorkspaceBackend(workspace)with closing(Agent.create("agent.acl")) as agent:with closing(agent.session(workspace, options)) as session:pass
from contextlib import closingfrom pathlib import Pathfrom a3s_code import (Agent,LocalWorkspaceBackend,PermissionPolicy,SessionOptions,)workspace = str(Path.cwd())options = SessionOptions()options.planning_mode = "disabled"options.auto_compact = Trueoptions.auto_compact_threshold = 0.8options.max_context_tokens = 128_000options.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
from contextlib import closingfrom pathlib import Pathfrom a3s_code import (Agent,EventType,LocalWorkspaceBackend,PermissionPolicy,SessionOptions,)workspace = str(Path.cwd())options = SessionOptions()options.planning_mode = "disabled"options.auto_compact = Trueoptions.auto_compact_threshold = 0.8options.max_context_tokens = 128_000options.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")
from contextlib import closingfrom pathlib import Pathfrom a3s_code import (Agent,EventType,FileSessionStore,LocalWorkspaceBackend,PermissionPolicy,SessionOptions,)workspace = str(Path.cwd())options = SessionOptions()options.planning_mode = "disabled"options.auto_compact = Trueoptions.auto_compact_threshold = 0.8options.max_context_tokens = 128_000options.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()
Runtime 提供的五类能力
工具、模型、任务记录、扩展接口和 Workspace 各自独立。应用可以只配置当前场景需要的部分。
工具列表由 Workspace 和权限共同确定
文件、搜索、Shell、Git、Web、Batch、QuickJS、结构化输出和子任务,只有在当前 Workspace 支持且规则允许时才会提供给模型。
更换模型适配器,不改 Session API
支持 Anthropic、智谱、OpenAI-compatible API,也可以注入自己的 LlmClient。
Run、事件与快照使用稳定格式
一次任务可以保存 Snapshot、事件、Trace、Artifact、验证结果和 Checkpoint;应用可以据此查询、审计或恢复。
工具、上下文与存储都有扩展接口
MCP、Skills、ContextProvider、MemoryStore、SessionStore、Workspace 服务和自定义工具都可以替换或扩展。
本地、S3 与远程 Workspace 分开声明能力
代码导航与文件工具都来自你选择的 Workspace。远程或对象存储后端不能运行本地命令时,Bash 和 Git 就不会暴露给模型。
直接运行 CLI,或使用四种 SDK
终端版用于直接操作项目;Rust crate、Node.js 包、Python 包和 Go module 用于 IDE、Runner、服务端或自有界面。
a3s code
开箱即用的终端界面,可以查看推理、工具调用、确认提示、任务进度和 Diff。
a3s codea3s-code-core
完整的异步 Runtime API,以及用于接入自定义能力的公共 Trait。
cargo add a3s-code-core@a3s-lab/code
通过 N-API 提供原生绑定,覆盖会话、事件流、工具、存储、编排和 MCP。
npm install @a3s-lab/codea3s-code
通过 PyO3 提供原生包,同时支持同步和异步 API。
python -m pip install a3s-codesdk/go/v6
纯 Go API 通过长驻桥接进程提供会话、事件流、工具、验证和 MCP,无需 CGO。
go get github.com/A3S-Lab/Code/sdk/go/v6Runtime 负责执行;应用负责账号、凭据和界面
- A3S Code Core 提供 Agent Runtime,不提供托管服务,也不规定界面应该长什么样。
- a3s code 的终端界面由独立的 A3S CLI 提供。
- 账号、凭据、部署方式,以及哪些应用工具可以直接调用,仍由你的应用决定。
从一个只读任务开始
安装 a3s code 后,在已有仓库里执行一次检查;需要嵌入时再选择 Rust、Node.js、Python 或 Go SDK。