aixyz
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorking with aixyz
使用aixyz进行开发
Where to Find the Latest Information
获取最新信息的渠道
The project evolves quickly. Always consult these sources for up-to-date details:
- Docs site: aixyz.sh — Getting Started guides, API reference, protocol docs, and templates
- GitHub: github.com/AgentlyHQ/aixyz — source, issues, and examples
- CLI help: every command has — run it to discover the current flags
--help
本项目迭代速度较快。请始终通过以下渠道获取最新详情:
- 文档站点: aixyz.sh — 入门指南、API参考、协议文档及模板
- GitHub: github.com/AgentlyHQ/aixyz — 源码、问题反馈及示例
- CLI帮助: 所有命令均支持参数 — 执行该参数可查看当前可用的标志
--help
Immutable Facts
固定规则
These things will not change:
- Runtime is always Bun — install with , run with
bun, test withbunbun test - Agent logic uses the Vercel AI SDK (package) —
ai,ToolLoopAgent,tool()fromstepCountIs()— check ai-sdk.dev for the current version"ai" - LLM providers use adapters —
@ai-sdk/*is the default but any Vercel AI SDK provider works (@ai-sdk/openai,@ai-sdk/anthropic,@ai-sdk/google, etc.)@ai-sdk/amazon-bedrock - is always available for scaffolding — use
create-aixyz-appto see all optionsbunx create-aixyz-app --help - CLI is always available —
aixyzfor the dev/test loop,aixyz devfor buildingaixyz build - Environment variables follow Next.js load order — ,
.env(don't commit),.env.local,.env.<NODE_ENV>.env.<NODE_ENV>.local
以下规则不会发生变更:
- 运行时始终为Bun — 使用安装、运行及测试(
bun)bun test - Agent逻辑基于Vercel AI SDK(包) — 从
ai中引入"ai"、ToolLoopAgent、tool()— 可访问ai-sdk.dev查看当前版本stepCountIs() - 大模型提供商使用适配器 — 默认使用
@ai-sdk/*,但所有Vercel AI SDK支持的提供商均可兼容(@ai-sdk/openai、@ai-sdk/anthropic、@ai-sdk/google等)@ai-sdk/amazon-bedrock - 始终用于项目初始化 — 执行
create-aixyz-app查看所有选项bunx create-aixyz-app --help - CLI始终可用 — 使用
aixyz进入开发/测试循环,aixyz dev用于构建项目aixyz build - 环境变量遵循Next.js加载顺序 — 、
.env(请勿提交至版本库)、.env.local、.env.<NODE_ENV>.env.<NODE_ENV>.local
Getting Started
快速开始
bash
undefinedbash
undefinedSee all scaffolding options (TTY is disabled in AI/CI — every prompt has a flag)
查看所有项目初始化选项(AI/CI环境下TTY已禁用 — 所有交互均有对应标志)
bunx create-aixyz-app --help
bunx create-aixyz-app --help
Scaffold with defaults
使用默认配置初始化项目
bunx create-aixyz-app my-agent --yes
bunx create-aixyz-app my-agent --yes
Dev/test loop
进入开发/测试循环
cd my-agent && bun run dev # aixyz dev — hot reload at http://localhost:3000
cd my-agent && bun run dev # aixyz dev — 在http://localhost:3000实现热重载
Build for deployment
构建用于部署的版本
bun run build # aixyz build
undefinedbun run build # aixyz build
undefinedCore Concepts
核心概念
Project layout
项目结构
Bare minimum to get started:
my-agent/
aixyz.config.ts # Agent identity, payment config, skills declaration
app/
agent.ts # Root agent (ToolLoopAgent from "ai") — required
tools/name.ts # Tools (optional) — each file auto-registered; not exported directly
agents/name.ts # Sub-agents (optional) — each file → /name/agent endpoint
package.json
.env.local # API keys — never commitFull layout with optional files:
my-agent/
aixyz.config.ts
app/
agent.ts
agents/ # Sub-agents
tools/ # Tools; _prefix files are ignored
server.ts # Custom server (overrides auto-generation)
accepts.ts # Custom x402 facilitator
erc-8004.ts # On-chain ERC-8004 identity
icon.png # Agent icon
package.json
vercel.json
.env.local最简启动结构:
my-agent/
aixyz.config.ts # Agent身份信息、支付配置、技能声明
app/
agent.ts # 根Agent(来自"ai"的ToolLoopAgent) — 必填
tools/name.ts # 工具(可选) — 每个文件自动注册;无需直接导出
agents/name.ts # 子Agent(可选) — 每个文件对应/name/agent端点
package.json
.env.local # API密钥 — 切勿提交至版本库包含可选文件的完整结构:
my-agent/
aixyz.config.ts
app/
agent.ts
agents/ # 子Agent目录
tools/ # 工具目录;前缀为_的文件会被忽略
server.ts # 自定义服务器(覆盖自动生成的服务器)
accepts.ts # 自定义x402支付验证器
erc-8004.ts # 链上ERC-8004身份信息
icon.png # Agent图标
package.json
vercel.json
.env.localGetting paid (x402)
收款配置(x402)
Export from (gates ) or from a tool file (gates it on ):
acceptsapp/agent.ts/agent/mcpts
import type { Accepts } from "aixyz/accepts";
export const accepts: Accepts = { scheme: "exact", price: "$0.005" };No export → endpoint is not exposed. → explicitly free.
See aixyz.sh/getting-started/payments for full details.
acceptsscheme: "free"在中导出(用于限制端点),或在工具文件中导出(用于限制端点):
app/agent.tsaccepts/agent/mcpts
import type { Accepts } from "aixyz/accepts";
export const accepts: Accepts = { scheme: "exact", price: "$0.005" };On-chain identity (ERC-8004)
链上身份(ERC-8004)
Register your agent on-chain with:
bash
aixyz erc-8004 register --help # see all non-TTY flags
aixyz erc-8004 register --url https://my-agent.vercel.app --broadcastSee aixyz.sh/protocols/erc-8004 for full details.
通过以下命令在链上注册你的Agent:
bash
aixyz erc-8004 register --help # 查看所有非TTY交互标志
aixyz erc-8004 register --url https://my-agent.vercel.app --broadcastTesting (optional)
测试(可选)
Tests are optional but recommended for advanced users. Tests use Bun's built-in runner (). Write
deterministic tests (no API calls) and use for non-deterministic
ones. Use from for fully offline CI-safe tests.
bun:testtest.skipIf(!process.env.OPENAI_API_KEY)fake()"aixyz/model"bash
bun test # run all tests
bun test app/agent.test.ts # run a specific fileSee aixyz.sh/getting-started/testing for full details.
测试为可选操作,但推荐进阶用户使用。测试基于Bun内置的测试运行器()。编写
确定性测试(无API调用),并对非确定性测试使用。使用中的实现完全离线且CI安全的测试。
bun:testtest.skipIf(!process.env.OPENAI_API_KEY)"aixyz/model"fake()bash
bun test # 运行所有测试
bun test app/agent.test.ts # 运行指定文件的测试Protocol Endpoints
协议端点
Every deployed agent exposes these endpoints automatically:
| Endpoint | Protocol | Description |
|---|---|---|
| A2A | Agent discovery card |
| A2A | JSON-RPC endpoint with x402 payment gate |
| MCP | Tool sharing with MCP clients |
每个已部署的Agent会自动暴露以下端点:
| 端点 | 协议 | 描述 |
|---|---|---|
| A2A | Agent发现卡片 |
| A2A | 带有x402支付验证的JSON-RPC端点 |
| MCP | 为MCP客户端提供工具共享服务 |
Examples
示例
The directory in github.com/AgentlyHQ/aixyz contains
working agents for common patterns. When in doubt, find an example that matches what you need.
examples/If you have GitHub access, clone the repo and explore directly:
examples/bash
gh repo clone AgentlyHQ/aixyz
ls aixyz/examples/Each example has an , , and you can learn from.
The Templates tab on aixyz.sh documents each example.
aixyz.config.tsapp/agent.tsapp/tools/github.com/AgentlyHQ/aixyz的目录包含了
适用于常见场景的可用Agent。如有疑问,可寻找与你的需求匹配的示例。
examples/若你拥有GitHub访问权限,可克隆仓库并直接浏览目录:
examples/bash
gh repo clone AgentlyHQ/aixyz
ls aixyz/examples/Repo Structure (for exploration)
仓库结构(供探索)
If you clone the repo, the key areas are:
packages/
aixyz/ # Framework core (server, adapters, x402)
aixyz-cli/ # CLI: dev, build, erc-8004 commands
aixyz-config/ # Config loading (Zod-validated aixyz.config.ts)
aixyz-erc-8004/ # ERC-8004 ABIs, addresses, schemas
create-aixyz-app/ # Scaffolding CLI
docs/ # Mintlify docs
examples/ # Working agent examplesUse on any CLI command, read the docs at aixyz.sh, or browse examples in
github.com/AgentlyHQ/aixyz/tree/main/examples
for the most current information.
--help若你克隆了仓库,核心目录结构如下:
packages/
aixyz/ # 框架核心(服务器、适配器、x402模块)
aixyz-cli/ # CLI工具:dev、build、erc-8004等命令
aixyz-config/ # 配置加载模块(基于Zod验证aixyz.config.ts)
aixyz-erc-8004/ # ERC-8004的ABI、地址及 schema
create-aixyz-app/ # 项目初始化CLI工具
docs/ # Mintlify文档站点
examples/ # 可用的Agent示例