iii-agentic-backend
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgentic Backend
Agent化后端
Comparable to: LangGraph, CrewAI, AutoGen, Letta
同类工具:LangGraph、CrewAI、AutoGen、Letta
Key Concepts
核心概念
Use the concepts below when they fit the task. Not every agentic workflow needs all of them.
- Each agent is a registered function with a single responsibility
- Agents communicate via named queues (ordered handoffs) and shared state (accumulated context)
- Approval gates are explicit checks in the producing agent before enqueuing the next step
- An HTTP trigger provides the entry point; agents chain from there
- Pubsub broadcasts completion events for downstream listeners
请根据任务需求选用以下概念。并非所有Agent化工作流都需要用到全部概念。
- 每个Agent都是一个具有单一职责的已注册函数
- Agent通过命名队列(有序移交)和共享状态(累积上下文)进行通信
- 审批关卡是生产Agent在将下一步加入队列前执行的显式检查
- HTTP触发器作为入口点,Agent从此处开始链式执行
- Pubsub(发布订阅)向下游监听者广播完成事件
Architecture
架构
text
HTTP request
→ Enqueue(agent-tasks) → Agent 1 (researcher) → writes state
→ Enqueue(agent-tasks) → Agent 2 (critic) → reads/updates state
→ explicit approval check (is-approved?)
→ Enqueue(agent-tasks) → Agent 3 (synthesizer) → final state update
→ publish(research.complete)text
HTTP request
→ Enqueue(agent-tasks) → Agent 1 (researcher) → writes state
→ Enqueue(agent-tasks) → Agent 2 (critic) → reads/updates state
→ explicit approval check (is-approved?)
→ Enqueue(agent-tasks) → Agent 3 (synthesizer) → final state update
→ publish(research.complete)iii Primitives Used
使用的iii原语
| Primitive | Purpose |
|---|---|
| Initialize the worker and connect to iii |
| Define each agent |
| Shared context between agents |
| Async handoff between agents via named queue |
| Explicit condition check before enqueuing |
| Broadcast completion to any listeners |
| Entry point |
| 原语 | 用途 |
|---|---|
| 初始化Worker并连接到iii引擎 |
| 定义每个Agent |
| 实现Agent间的共享上下文 |
| 通过命名队列实现Agent间的异步移交 |
| 加入队列前执行显式条件检查 |
| 向所有监听者广播完成事件 |
| 作为入口点 |
Reference Implementation
参考实现
See ../references/agentic-backend.js for the full working example — a multi-agent research pipeline
where a researcher gathers findings, a critic reviews them, and a synthesizer produces a final report.
完整可运行示例请查看../references/agentic-backend.js —— 这是一个多Agent研究流水线,其中研究员Agent收集研究结果,评审员Agent进行审核,合成员Agent生成最终报告。
Common Patterns
常见模式
Code using this pattern commonly includes, when relevant:
- — worker initialization
registerWorker(url, { workerName }) - — async handoff between agents
trigger({ function_id, payload, action: TriggerAction.Enqueue({ queue }) }) - — shared context between agents
trigger({ function_id: 'state::set/get/update', payload: { scope, key } }) - Explicit condition check via before enqueuing next agent
await iii.trigger({ function_id: 'condition-fn', payload }) - — completion broadcast
trigger({ function_id: 'publish', payload: { topic, data }, action: TriggerAction.Void() }) - Each agent as its own with
registerFunctionprefix IDsagents:: - — structured logging per agent
const logger = new Logger()
使用此模式的代码通常包含以下相关内容:
- —— Worker初始化
registerWorker(url, { workerName }) - —— Agent间的异步移交
trigger({ function_id, payload, action: TriggerAction.Enqueue({ queue }) }) - —— Agent间的共享上下文
trigger({ function_id: 'state::set/get/update', payload: { scope, key } }) - 在加入下一个Agent队列前,通过执行显式条件检查
await iii.trigger({ function_id: 'condition-fn', payload }) - —— 完成事件广播
trigger({ function_id: 'publish', payload: { topic, data }, action: TriggerAction.Void() }) - 每个Agent都是带有前缀ID的独立
agents::registerFunction - —— 每个Agent的结构化日志
const logger = new Logger()
Adapting This Pattern
适配此模式
Use the adaptations below when they apply to the task.
- Replace simulated logic in each agent with real work (API calls, LLM inference, etc.)
- Add more agents by registering functions and enqueuing to them with
TriggerAction.Enqueue({ queue }) - For approval gates, call a condition function explicitly before enqueuing the next agent
- Define queue configs (retries, concurrency) in under
iii-config.yamlqueue_configs - State scope should be named for your domain (e.g. ,
research-tasks)support-tickets - segments should reflect your agent hierarchy (e.g.
functionId,agents::researcher)agents::critic
请根据任务需求选用以下适配方式。
- 将每个Agent中的模拟逻辑替换为实际工作(API调用、LLM推理等)
- 通过注册函数并使用将任务加入队列,添加更多Agent
TriggerAction.Enqueue({ queue }) - 对于审批关卡,在加入下一个Agent队列前显式调用条件函数
- 在的
iii-config.yaml下定义队列配置(重试、并发数)queue_configs - 状态作用域应根据你的业务领域命名(例如、
research-tasks)support-tickets - 分段应体现你的Agent层级结构(例如
functionId、agents::researcher)agents::critic
Engine Configuration
引擎配置
Named queues for agent handoffs are declared in iii-config.yaml under . See ../references/iii-config.yaml for the full annotated config reference.
queue_configsAgent移交使用的命名队列需在的中声明。完整带注释的配置参考请查看../references/iii-config.yaml。
iii-config.yamlqueue_configsPattern Boundaries
模式边界
- If a request is about adapting existing HTTP endpoints into (including prompts asking for
registerFunctionendpoint maps + loops), prefer{ path, id }.iii-http-invoked-functions - Stay with when the primary problem is multi-agent orchestration, queue handoffs, approval gates, and shared context.
iii-agentic-backend
- 如果需求是将现有HTTP端点适配为(包括要求提供
registerFunction端点映射及循环的请求),请优先使用{ path, id }模式。iii-http-invoked-functions - 当核心需求是多Agent编排、队列移交、审批关卡和共享上下文时,使用模式。
iii-agentic-backend
When to Use
使用场景
- Use this skill when the task is primarily about in the iii engine.
iii-agentic-backend - Triggers when the request directly asks for this pattern or an equivalent implementation.
- 当任务主要涉及iii引擎中的时,使用此技能。
iii-agentic-backend - 当请求直接要求实现此模式或等效方案时触发。
Boundaries
使用限制
- Never use this skill as a generic fallback for unrelated tasks.
- You must not apply this skill when a more specific iii skill is a better fit.
- Always verify environment and safety constraints before applying examples from this skill.
- 切勿将此技能作为无关任务的通用 fallback。
- 当有更适合的特定iii技能时,禁止使用此技能。
- 在应用此技能中的示例前,务必验证环境和安全约束。