iii-agentic-backend

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agentic 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原语

PrimitivePurpose
registerWorker
Initialize the worker and connect to iii
registerFunction
Define each agent
trigger({ function_id: 'state::set/get/update', payload })
Shared context between agents
trigger({ ..., action: TriggerAction.Enqueue({ queue }) })
Async handoff between agents via named queue
trigger({ function_id, payload })
Explicit condition check before enqueuing
trigger({ function_id: 'publish', payload, action: TriggerAction.Void() })
Broadcast completion to any listeners
registerTrigger({ type: 'http' })
Entry point
原语用途
registerWorker
初始化Worker并连接到iii引擎
registerFunction
定义每个Agent
trigger({ function_id: 'state::set/get/update', payload })
实现Agent间的共享上下文
trigger({ ..., action: TriggerAction.Enqueue({ queue }) })
通过命名队列实现Agent间的异步移交
trigger({ function_id, payload })
加入队列前执行显式条件检查
trigger({ function_id: 'publish', payload, action: TriggerAction.Void() })
向所有监听者广播完成事件
registerTrigger({ type: 'http' })
作为入口点

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:
  • registerWorker(url, { workerName })
    — worker initialization
  • trigger({ function_id, payload, action: TriggerAction.Enqueue({ queue }) })
    — async handoff between agents
  • trigger({ function_id: 'state::set/get/update', payload: { scope, key } })
    — shared context between agents
  • Explicit condition check via
    await iii.trigger({ function_id: 'condition-fn', payload })
    before enqueuing next agent
  • trigger({ function_id: 'publish', payload: { topic, data }, action: TriggerAction.Void() })
    — completion broadcast
  • Each agent as its own
    registerFunction
    with
    agents::
    prefix IDs
  • const logger = new Logger()
    — structured logging per agent
使用此模式的代码通常包含以下相关内容:
  • registerWorker(url, { workerName })
    —— Worker初始化
  • trigger({ function_id, payload, action: TriggerAction.Enqueue({ queue }) })
    —— Agent间的异步移交
  • trigger({ function_id: 'state::set/get/update', payload: { scope, key } })
    —— Agent间的共享上下文
  • 在加入下一个Agent队列前,通过
    await iii.trigger({ function_id: 'condition-fn', payload })
    执行显式条件检查
  • trigger({ function_id: 'publish', payload: { topic, data }, action: TriggerAction.Void() })
    —— 完成事件广播
  • 每个Agent都是带有
    agents::
    前缀ID的独立
    registerFunction
  • const logger = new Logger()
    —— 每个Agent的结构化日志

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
    iii-config.yaml
    under
    queue_configs
  • State scope should be named for your domain (e.g.
    research-tasks
    ,
    support-tickets
    )
  • functionId
    segments should reflect your agent hierarchy (e.g.
    agents::researcher
    ,
    agents::critic
    )
请根据任务需求选用以下适配方式。
  • 将每个Agent中的模拟逻辑替换为实际工作(API调用、LLM推理等)
  • 通过注册函数并使用
    TriggerAction.Enqueue({ queue })
    将任务加入队列,添加更多Agent
  • 对于审批关卡,在加入下一个Agent队列前显式调用条件函数
  • iii-config.yaml
    queue_configs
    下定义队列配置(重试、并发数)
  • 状态作用域应根据你的业务领域命名(例如
    research-tasks
    support-tickets
  • functionId
    分段应体现你的Agent层级结构(例如
    agents::researcher
    agents::critic

Engine Configuration

引擎配置

Named queues for agent handoffs are declared in iii-config.yaml under
queue_configs
. See ../references/iii-config.yaml for the full annotated config reference.
Agent移交使用的命名队列需在
iii-config.yaml
queue_configs
中声明。完整带注释的配置参考请查看../references/iii-config.yaml

Pattern Boundaries

模式边界

  • If a request is about adapting existing HTTP endpoints into
    registerFunction
    (including prompts asking for
    { path, id }
    endpoint maps + loops), prefer
    iii-http-invoked-functions
    .
  • Stay with
    iii-agentic-backend
    when the primary problem is multi-agent orchestration, queue handoffs, approval gates, and shared context.
  • 如果需求是将现有HTTP端点适配为
    registerFunction
    (包括要求提供
    { path, id }
    端点映射及循环的请求),请优先使用
    iii-http-invoked-functions
    模式。
  • 当核心需求是多Agent编排、队列移交、审批关卡和共享上下文时,使用
    iii-agentic-backend
    模式。

When to Use

使用场景

  • Use this skill when the task is primarily about
    iii-agentic-backend
    in the iii engine.
  • 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技能时,禁止使用此技能。
  • 在应用此技能中的示例前,务必验证环境和安全约束。