跳到正文
Skillpedia
通用编程19k · #10495

iii-getting-started

它能做什么

带你完成安装 iii 引擎、创建项目并启动第一个工作进程的全过程。适合刚接触 iii、希望不用摸索设置步骤就能拥有可运行后端的人。

适用场景

  • ✓当你想从零开始新建一个 iii 项目时。
  • ✓当你需要安装 iii SDK 并确认它可以正常工作时。
  • ✓当你的第一次 iii 设置没有运行,想重新开始时。

技能链接

https://github.com/iii-hq/iii/blob/main/skills/iii-getting-started/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/iii-hq/iii/blob/main/skills/iii-getting-started/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我安装 iii 并新建一个项目,然后向我展示引擎正在运行。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能会用安装程序安装引擎,从模板创建项目,并通过 compose 文件启动项目。然后它会检查引擎是否在监听,让你知道设置已经成功。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Getting Started with iii

iii replaces your API framework, task queue, cron scheduler, pub/sub, state store, and observability pipeline with a single engine and three primitives: Function, Trigger, Worker.

Step 1: Install the Engine

curl -fsSL https://install.iii.dev/iii/main/install.sh | sh

Verify it installed:

iii --version

Step 2: Create a Project

iii project init my-app              # barebones project
iii project init my-app -t harness   # or: the harness template (agent + console UI)
cd my-app

iii project init --learn-iii scaffolds the harness template and starts it in one step; the installer offers the same when you answer "y" at its prompt. iii project init --template quickstart scaffolds the Quickstart with a Python and a TypeScript worker.

Step 3: Start the Project

iii compose --namespace dev --up --file worker-compose.yaml

The file's engine: section starts the engine; containers: starts project workers. The engine commonly listens on ws://localhost:49134. Keep this foreground supervisor running.

--namespace dev names the daemon and becomes III_NAMESPACE for every worker it starts, so your workers register and call each other in dev; that is why the iii trigger commands below pass -n dev. Engine-owned functions (engine::*, configuration::*) stay in default, and SDK calls to them resolve there without a namespace (see iii-sdk-reference).

Step 4: Install the SDK

Pick your language:

# TypeScript / Node.js
pnpm add iii-sdk @iii-dev/helpers

# Python
pip install iii-sdk iii-helpers

# Rust
cargo add iii-sdk iii-helpers

Step 5: Write Your First Worker

TypeScript

import { registerWorker, TriggerAction } from "iii-sdk";
import { Logger } from "@iii-dev/helpers/observability";

const iii = registerWorker(process.env.III_URL ?? "ws://localhost:49134");

iii.registerFunction(
  "hello::greet",
  async (input) => {
    const logger = new Logger();
    const name = input?.name ?? "world";
    logger.info("Greeting user", { name });
    return { message: `Hello, ${name}!` };
  },
  { description: "Greet a user by name" },
);

iii.registerTrigger({
  type: "http",
  function_id: "hello::greet",
  config: { api_path: "/hello", http_method: "POST" },
});

Python

from iii import register_worker, InitOptions
from iii_helpers.observability import Logger

iii = register_worker(address="ws://localhost:49134", options=InitOptions(worker_name="hello-worker"))

def greet(data):
    logger = Logger()
    name = data.get("name", "world") if isinstance(data, dict) else "world"
    logger.info("Greeting user", {"name": name})
    return {"message": f"Hello, {name}!"}

iii.register_function("hello::greet", greet, description="Greet a user by name")
iii.register_trigger({"type": "http", "function_id": "hello::greet", "config": {"api_path": "/hello", "http_method": "POST"}})

Rust

use iii_sdk::{register_worker, InitOptions, RegisterFunction};
use iii_sdk::protocol::RegisterTriggerInput;
use iii_helpers::observability::Logger;
use serde_json::json;

let iii = register_worker("ws://127.0.0.1:49134", InitOptions::default());

iii.register_function(
    "hello::greet",
    RegisterFunction::new(|input: serde_json::Value| -> Result<serde_json::Value, iii_sdk::Error> {
        let logger = Logger::new();
        let name = input["name"].as_str().unwrap_or("world");
        logger.info("Greeting user", Some(json!({ "name": name })));
        Ok(json!({ "message": format!("Hello, {}!", name) }))
    }).description("Greet a user by name"),
);

// Deprecated since 0.25, still how you bind to the http worker: compiles with a warning.
#[allow(deprecated)]
iii.register_trigger(RegisterTriggerInput::new(
    "http",
    "hello::greet",
    json!({ "api_path": "/hello", "http_method": "POST" }),
))?;

registerTrigger logs a one-time deprecation warning in iii 0.25. It keeps working, and it is still the way to bind to the http, cron, queue, state, stream, and pub/sub workers, which have not moved to source functions yet. To run a function after another one, use iii.observe (see iii-observe).

Step 6: Test It

The http trigger type comes from the http worker. Add it once through the running Compose daemon, then call your endpoint:

iii trigger -n dev compose::add worker=http
curl -X POST http://localhost:3111/hello \
  -H "Co
常见问题

新项目中会创建什么?

会创建一个项目文件夹,其中包含 compose 文件,另外还可以选择一个模板,例如带有智能体和控制台界面的 harness。

应该从哪个模板开始?

基础项目适合入门,harness 或 quickstart 模板则提供更完整的示例。

引擎使用哪个端口?

通常在 localhost 的 49134 端口上监听。

详情

作者的原始描述

Install the iii engine, set up your first worker, and get a working backend running. Use when a user wants to start a new iii project, install the SDK, or needs help with initial setup and configuration.

repo: iii-hq/iii

热度

GitHub 星标
19k
排名
#10495
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能