iii-core-primitives
它能做什么
讲解 iii 的基本构建模块:函数、触发器和工作进程,以及如何注册每一种。适合用 TypeScript、Python 或 Rust 为 iii 系统编写代码的开发者。
适用场景
- ✓当你需要注册一个新函数,或把触发器绑定到它上面时。
- ✓当你希望某个函数在另一个函数被调用之后运行时。
- ✓当你想查看当前有哪些工作进程和函数已经连接时。
技能链接
https://github.com/iii-hq/iii/blob/main/skills/iii-core-primitives/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我用 TypeScript 注册一个名为 orders::validate 的函数,让它在每个新订单到达时运行。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能会展示如何用处理程序注册函数,并把它绑定到事件源,例如定时计划或队列。它还涵盖观察者(在另一个函数被调用之后运行目标函数),以及如何直接或在后台调用函数。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Core Primitives
iii has three top-level primitives:
- Function: a named unit of work such as
orders::validate - Trigger: an event source bound to a function
- Worker: a process that connects to the engine and executes functions
Since 0.25 every function is also observable: iii.observe(source, target) invokes target
on each invocation of source that passes its filters. Observers replace trigger bindings over
time; the built-in providers (http, cron, queue, state, stream, pub/sub, database) still
use trigger types in 0.25, so keep registerTrigger for them. See iii-observe.
Use :: in function IDs, leading slashes in HTTP api_path, and expression for cron config.
Function Registration
Register local handlers when you control the implementation. Register HTTP-invoked functions when iii should call an existing external endpoint.
| Shape | Use for |
|---|---|
registerFunction(id, handler, options?) |
Local worker code |
registerFunction(id, HttpInvocationConfig, options?) |
Existing HTTP services |
registerTrigger({ type, function_id, config, metadata? }) |
Binding a built-in event source (deprecated in 0.25, still required for providers that have not migrated) |
observe({ function_id, args?, filters? }, target, options?) |
Running target after another function's invocations, or on an engine event (iii-observe) |
trigger({ function_id, payload, action?, timeout? }) |
Calling any function by ID |
Functions and triggers can carry metadata for ownership, discovery, and generated skills. Do not put secrets in metadata.
Workers and Registry
A worker is any process that connects to the engine and registers functions or trigger types. There are two common paths:
| Task | Use |
|---|---|
| Create your own worker | Write SDK code that calls registerWorker, registerFunction, and registerTrigger or observe |
| Add an existing capability | Browse https://workers.iii.dev/, then call compose::add worker=<name> |
| Pin a worker version | compose::add worker=<name>@<version> |
| Declare a local worker | Add worker: path://./workers/my-worker under containers: |
| Reproduce a project | Commit the exact versions in worker-compose.yaml |
The public worker registry at workers.iii.dev is for installable workers such as HTTP, state,
queue, pub/sub, cron, database, shell, console, rbac-proxy, and other capability workers.
(iii-sandbox and iii-observability are engine-owned and are not added through the registry.) Those workers may ship their own function-level skills; do not duplicate every capability
as a top-level iii skill.
Worker Manifest
Use iii.worker.yaml when iii should start a local worker project:
name: math-worker
runtime:
kind: python
package_manager: pip
entry: math_worker.py
scripts:
install: "pip install -r requirements.txt"
start: "python math_worker.py"
The manifest describes how to start the process. Once running, the WebSocket connection and function registrations are what make the worker part of iii.
Live Engine Registry
The engine keeps a live registry of connected workers, registered functions, triggers, and trigger types. Read it through the built-in discovery functions:
| Function | Returns |
|---|---|
engine::workers::list |
Connected workers and metrics |
engine::functions::list |
Registered functions |
engine::triggers::list |
Registered triggers |
engine::trigger-types::list |
Advertised trigger types and schemas |
engine::observers::list |
Observers you may see (function_id, namespace, worker filters) |
For topology changes, observe the engine-hosted sources engine::on-workers-changed or
engine::on-functions-changed with deliver: 'input' (see iii-observe). The older
engine::workers-available and engine::functions-available trigger types still fire.
Built-In Trigger Shapes
The workers behind these types have not moved to source functions in 0.25, so bind them with
registerTrigger. Each call logs a one-time deprecation warning per process; it is informational
and the binding works as before. For log, the engine also hosts the observability::on-log
source (iii-observe).
| Trigger type | Registration config | Handler payload |
|---|---|---|
http |
{ api_path: "/orders/:id", http_method: "POST" } |
{ query_params, path_params, headers, path, method, body } |
cron |
`{ expression: "0 0 9 * * * |
常见问题
什么是观察者?
观察者会在每次调用另一个函数之后运行一个目标函数,并且不会改变那个函数。
函数 ID 使用什么格式?
使用双冒号,例如 orders::validate。
它能从注册表安装工作进程吗?
可以。该技能涵盖从公共注册表安装工作进程的方法。
详情
作者的原始描述
Use when registering iii functions, binding triggers, observing functions, selecting sync/void/enqueue invocation, creating workers, inspecting the live worker registry, installing registry workers, authoring event sources, moving channel data, or adapting external HTTP functions across TypeScript, Python, and Rust.
repo: iii-hq/iii
热度
- GitHub 星标
- 19k
- 排名
- #10492
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
iii-sandbox
19k帮你的智能体在临时隔离的虚拟机中安全运行不可信或由 AI 生成的代码,完成后将其丢弃。
configuration
19k让你的智能体设置一个共享的命名配置值注册表,并按模式进行检查,使工作进程可以读取并响应变化。
iii
19k教你的智能体了解 iii 工作进程如何运作,使其可以先检查已有的功能,再构建新的工作进程来添加能力。
iii-observability
19k帮你的智能体使用 OpenTelemetry 为 iii 引擎添加追踪、结构化日志、指标和告警,让你看清系统正在发生什么。