能力标签
🛠
AI工具

KohakuTerrarium Agent工作流

基于 Python · 开源 AI 工具,GitHub 社区精选
英文名:KohakuTerrarium
⭐ 326 Stars 🍴 41 Forks 💻 Python 📄 NOASSERTION 🏷 AI 7.5分
7.5AI 综合评分
AI代理框架工作流编排LLM集成Python框架智能自动化
✦ AI Skill Hub 推荐

经 AI Skill Hub 精选评估,KohakuTerrarium Agent工作流 获评「推荐使用」。这款AI工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。

📚 深度解析
KohakuTerrarium Agent工作流 是一款基于 Python 的开源工具,在 GitHub 上收获 0k+ Star,是AI代理框架、工作流编排、LLM集成、Python框架领域中的优质开源项目。开源工具的最大优势在于代码完全透明,你可以审计每一行代码的安全性,也可以根据自身需求进行二次开发和定制。

**为什么要使用开源工具而非商业 SaaS?**
对于个人开发者和有隐私需求的用户,本地部署的开源工具意味着数据不离本机,不受第三方服务商的数据政策约束。同时,开源工具通常没有使用次数限制和月度费用,一次安装即可长期使用,对于高频使用场景的总拥有成本(TCO)远低于订阅制商业工具。

**安装与环境准备**
KohakuTerrarium Agent工作流 依赖 Python 运行环境。建议通过 pyenv(Python)或 nvm(Node.js)管理 Python 版本,避免全局环境污染。对于新手用户,推荐先创建虚拟环境(python -m venv venv && source venv/bin/activate),再安装依赖,这样即使出现问题也可以随时删除虚拟环境重新开始,不影响系统稳定性。

**社区与维护**
GitHub Issue 和 Discussion 是获取帮助的最快渠道。在提问前建议先检查 Closed Issues(已关闭的问题),大多数常见问题都已有解答。遇到 Bug 时,提供 pip list 的输出、完整错误堆栈和最小可复现示例,能显著提高开发者响应速度。AI Skill Hub 将持续追踪 KohakuTerrarium Agent工作流 的版本更新,及时通知重要功能变化。
📋 工具概览

通用型AI代理框架,提供开箱即用的工作流编排能力。支持多种LLM集成,适合开发者构建复杂智能应用、自动化任务流程和多步骤AI任务编排。

KohakuTerrarium Agent工作流 是一款基于 Python 开发的开源工具,专注于 AI代理框架、工作流编排、LLM集成 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

GitHub Stars
⭐ 326
开发语言
Python
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
NOASSERTION
AI 综合评分
7.5 分
工具类型
AI工具
Forks
41
📖 中文文档
以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

通用型AI代理框架,提供开箱即用的工作流编排能力。支持多种LLM集成,适合开发者构建复杂智能应用、自动化任务流程和多步骤AI任务编排。

KohakuTerrarium Agent工作流 是一款基于 Python 开发的开源工具,专注于 AI代理框架、工作流编排、LLM集成 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。

📌 核心特色
  • 开源免费,支持本地部署,数据完全自主可控
  • 活跃的 GitHub 开源社区,持续迭代更新
  • 提供详细文档和使用示例,新手友好
  • 支持自定义配置,灵活适配不同使用环境
  • 可作为基础组件集成进现有技术栈或进行二次开发
🎯 主要使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:pip 安装(推荐)
pip install kohakuterrarium

# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install kohakuterrarium

# 方式三:从源码安装(获取最新功能)
git clone https://github.com/Kohaku-Lab/KohakuTerrarium
cd KohakuTerrarium
pip install -e .

# 验证安装
python -c "import kohakuterrarium; print('安装成功')"
📋 安装步骤说明
  1. 访问 GitHub 仓库页面
  2. 按照 README 文档完成依赖安装
  3. 根据系统环境完成初始化配置
  4. 参考官方示例或文档开始使用
  5. 遇到问题可在 GitHub Issues 中查找解答
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 命令行使用
kohakuterrarium --help

# 基本用法
kohakuterrarium input_file -o output_file

# Python 代码中调用
import kohakuterrarium

# 示例
result = kohakuterrarium.process("input")
print(result)
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
# kohakuterrarium 配置文件示例(config.yml)
app:
  name: "kohakuterrarium"
  debug: false
  log_level: "INFO"

# 运行时指定配置文件
kohakuterrarium --config config.yml

# 或通过环境变量配置
export KOHAKUTERRARIUM_API_KEY="your-key"
export KOHAKUTERRARIUM_OUTPUT_DIR="./output"
📑 README 深度解析 真实文档 完整度 95/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

简介

<p align="center"> <img src="images/banner.png" alt="KohakuTerrarium" width="800"> </p> <p align="center"> <strong>The machine for building agents — so you stop rebuilding the machine every time you want a new one.</strong> </p> <p align="center"> <img src="https://img.shields.io/badge/python-3.10%2B-blue" alt="Python 3.10+"> <img src="https://img.shields.io/badge/license-KohakuTerrarium--1.0-green" alt="License"> <img src="https://img.shields.io/badge/version-1.4.0-orange" alt="Version"> </p>

<p align="center"> <strong>English</strong> &nbsp;·&nbsp; <a href="README.zh.md">繁體中文</a> &nbsp;·&nbsp; <a href="README.zh-CN.md">简体中文</a> </p> <p align="center"> <a href="https://terrarium.kohaku-lab.org"><strong>Documentation</strong></a> </p>

---

Key features

  • Agent-level abstraction. The six-module creature model is the first-class concept. Every new agent shape is "write a config and maybe a few custom modules," not "rebuild the runtime."
  • Built-in session persistence and resume. Sessions store operational state, not just chat history. Resume a run hours later with kt resume.
  • Searchable session history. Every event is indexed. kt search and the search_memory tool let you (and the agent) look up past work.
  • Non-blocking context compaction. Long-running agents keep working while context is compacted in the background.
  • Comprehensive built-in tools and sub-agents. File, shell, web, JSON, notebook/Jupyter, search, editing, planning, review, research, plus the group_* graph-editor tools registered on privileged nodes.
  • MCP support. Connect stdio, streamable HTTP, or legacy SSE/HTTP MCP servers per-agent or globally; tools surface in the prompt automatically.
  • Package system. Install creatures / terrariums / plugins / LLM presets from Git or local paths; compose installed packages with inheritance.
  • Python-native. Agents are async Python objects. Embed them inside tools, triggers, plugins, or outputs of other agents.
  • Composition algebra. >>, &, |, *, .iterate operators for stitching agents into pipelines programmatically.
  • Multiple runtime surfaces. CLI, TUI, web dashboard, and desktop app out of the box.
  • Optional four-layer auth. Host token, admin password, multi-user accounts — opt in per layer for LAN / family-server / internet-exposed deployments. Defaults are everything off (current single-user behaviour preserved). See Authentication.
  • Useful OOTB creatures via kt-biome. Start by running strong default agents; customise or inherit from them later.

I want to understand what's going on

Practical capabilities

KohakuTerrarium already ships:

  • Built-in file, shell, web, JSON, notebook/Jupyter, channel, trigger, and introspection tools, including single-edit and multi-edit file mutation primitives.
  • Built-in sub-agents for exploration, planning, implementation, review, summarisation, and research.
  • Background tool execution and non-blocking agent flow.
  • Session persistence with resumable operational state.
  • FTS + vector memory search (model2vec / sentence-transformer / API embedding providers).
  • Non-blocking auto-compaction for long-running agents.
  • MCP (Model Context Protocol) integration — stdio, streamable HTTP, and legacy SSE/HTTP transports.
  • Package manager for creatures, plugins, terrariums, and reusable agent packs (kt install, kt update).
  • Python embedding through the Terrarium engine plus lower-level Agent access.
  • HTTP and WebSocket serving.
  • Web dashboard and native desktop app.
  • Custom module and plugin systems.

Build the web frontend (required for `kt web` / `kt app` from source)

npm install --prefix src/kohakuterrarium-frontend npm run build --prefix src/kohakuterrarium-frontend ```

1. Install KohakuTerrarium

```bash

Optional extras: pip install "kohakuterrarium[full]"

2. Install OOTB creatures and plugins

```bash

I want to build my own creature

I want to deploy it

Deployment (Docker / systemd / multi-node)

Three first-party Docker images on GHCR — pick the shape:

```bash

Installation & Setup

What Python version is required? Python 3.10 or higher. Install via pip install kohakuterrarium. Python 3.12+ is recommended — that's what CI validates and what the agent runtime is tuned for. 3.10 and 3.11 are supported on a best-effort basis (everything installs and runs, but the asyncio + SQLite-daemon-thread interaction on those older runtimes is slower and occasionally fights the per-test timeouts in the integration suite).

Which LLM providers are supported? Codex OAuth, OpenAI/OpenRouter-style providers, native Anthropic, Google Gemini, local OpenAI-compatible servers (Ollama, vLLM), and other OpenAI-compatible cloud providers. Configure with kt login, kt config llm add, kt config provider add, or provider API keys.

Can I use local models? Yes. Point the LLM endpoint to your local server (Ollama, vLLM, etc.) and configure the model name in your creature configuration.

Quick start

Recommended Python version: 3.12 or newer. CI validates 3.12+ only; 3.10 and 3.11 still install and run (requires-python = ">=3.10") but are supported best-effort — older asyncio + SQLite-daemon-thread interaction is slower and the integration suite occasionally times out on those runtimes.

Programmatic usage

Agents are async Python values. One Terrarium engine per process hosts every running creature — a standalone agent is just a 1-creature graph in the engine.

import asyncio
from kohakuterrarium import Terrarium

async def main():
    # Solo creature
    engine, alice = await Terrarium.with_creature("@kt-biome/creatures/swe")
    try:
        async for chunk in alice.chat("Explain what this codebase does."):
            print(chunk, end="", flush=True)
    finally:
        await engine.shutdown()

    # Multi-agent recipe
    engine = await Terrarium.from_recipe("@kt-biome/terrariums/swe_team")
    try:
        async for chunk in engine["swe"].chat("Fix the auth bug."):
            print(chunk, end="", flush=True)
    finally:
        await engine.shutdown()

asyncio.run(main())

Packages, defaults, and examples

Creatures are meant to be packaged, installed, reused, and shared.

kt install https://github.com/someone/cool-creatures.git
kt install ./my-creatures -e
kt list
kt update --all

Run installed configs with package references:

kt run @cool-creatures/creatures/my-agent
kt terrarium run @cool-creatures/terrariums/my-team

Available resources:

  • kt-biome/ — official showcase creatures, terrariums, and plugin pack
  • examples/agent-apps/ — config-driven creature examples
  • examples/code/ — Python usage examples
  • examples/terrariums/ — multi-agent examples
  • examples/plugins/ — plugin examples

See examples/README.md.

Tutorials

First Creature · First Terrarium · First Python Embedding · First Custom Tool · First Plugin

Guides

Getting Started · Creatures · Terrariums · Sessions · Memory · Configuration · Programmatic Usage · Composition · Custom Modules · Plugins · MCP · Packages · Serving · Laboratory · Deployment — Docker · Deployment — systemd · Deployment — reverse proxy · Examples

Official showcase pack

kt install https://github.com/Kohaku-Lab/kt-biome.git

Or native Anthropic / OpenAI-compatible providers via `kt config llm add`

```

Supports Codex OAuth, OpenRouter/OpenAI, native Anthropic, Google Gemini, and any OpenAI-compatible API.

Environment and session

  • Environment — shared terrarium state (shared channels).
  • Session — private creature state (scratchpad, private channels, sub-agent state).

Private by default, shared by opt-in.

CLI and TUI

  • cli — rich inline terminal experience
  • tui — full-screen Textual application
  • plain — simple stdout/stdin for pipes and CI

See CLI Reference.

Reference

CLI · HTTP · Python API · Configuration · Builtins · Plugin hooks

Any third-party package

kt install <git-url> kt install ./my-creatures -e # editable install ```

Modules

A creature has six conceptual modules. Five of them are user-extensible — you swap their implementations in config or in Python. The sixth, the controller, is the reasoning loop that drives them; you rarely swap it (and when you do, you're writing the framework's successor).

ModuleWhat it doesExample custom use
**Input**Receives external eventsDiscord listener, webhook, voice input
**Output**Delivers agent outputDiscord sender, TTS, file writer
**Tool**Executes actionsAPI calls, database access, RAG retrieval
**Trigger**Generates automatic eventsTimer, scheduler, channel watcher
**Sub-agent**Delegated task executionPlanning, code review, research

Plus plugins, which modify the connections between modules without forking them (prompt plugins, lifecycle hooks). See plugins guide.

FAQ

Troubleshooting

Why is my creature not responding? Check that your LLM provider is configured correctly with kt login. Verify network connectivity and API key validity.

How do I debug agent behavior? Use kt run --verbose for detailed logs. Resume or inspect prior work with kt resume, search it with kt search, or use the Studio session viewer in the web/desktop UI.

Where can I get help? - QQ Group: 1097666427 - Discord: https://discord.gg/xWYrkyvJ2s - Forum: https://linux.do/

🇨🇳 中文文档镜像 AI 翻译 2026-05-25
英文原文章节由系统翻译为中文摘要,便于快速理解。完整原文见上方 "📑 README 深度解析"。
📌 简介

KohakuTerrarium 是一个专为构建 Agent 而设计的“机器”,旨在解决开发者在创建新 Agent 时需要重复构建运行时的痛点。它通过高度抽象的模型,让开发者能够专注于定义 Agent 的行为而非底层架构,从而实现从“构建机器”到“配置机器”的范式转变。

⚡ 功能介绍

本项目提供 Agent 级别的抽象,采用独特的六模块 Creature 模型,开发者只需编写配置或自定义模块��可创建新 Agent。系统内置了强大的 Session 持久化与恢复功能,支持通过 `kt resume` 恢复运行状态,并提供可搜索的 Session 历史记录。此外,它还内置了丰富的工具集(如 File, Shell, Web, Jupyter 等)以及专门用于规划、执行和研究的 Sub-agents,支持后台工具执行与非阻塞的 Agent 流。

📋 环境依赖

在使用 `kt web` 或 `kt app` 等 Web 前端功能时,需要先在 `src/kohakuterrarium-frontend` 目录下通过 npm 进行构建。此外,建议使用 Python 3.12 或更高版本以获得最佳的 asyncio 和 SQLite 性能支持,虽然 3.10+ 版本也兼容,但部分集成测试可能会因运行时差异而出现超时。

🛠 安装步骤(Docker/pip/源码)

首先,通过 pip 安装 KohakuTerrarium 核心包。如果需要完整功能,可以使用 `pip install "kohakuterrarium[full]"`。安装完成后,可以通过 `kt install` 命令从 GitHub 仓库或本地路径安装预设的 Creatures 和 Plugins。对于开发者,还支持使用 `-e` 参数进行可编辑模式安装。

🚀 使用教程

项目支持通过 Python 异步编程进行程序化调用,将 Agent 视为异步 Python 值进行操作。同时,提供了强大的 CLI 工具,支持通过 `kt install` 安装第三方 Agent 包,并通过 `kt run` 使用特定的 package reference 来运行配置好的 Agent 或 Terrarium 团队环境。

⚙️ 配置说明(含 MCP / env)

KohakuTerrarium 提供了灵活的配置机制,支持通过 `kt configure` 配置多种 LLM 提供商,包括 Anthropic、OpenAI、Google Gemini 以及任何兼容 OpenAI 标准的 API。系统通过 Environment(共享状态)与 Session(私有状态)进行隔离,确保 Agent 的私有数据(如 scratchpad)默认安全,仅在需要时通过 opt-in 模式进行共享。

🔌 API 说明

项目提供了多层次的交互接口:`cli` 提供丰富的终端内联体验;`tui` 提供全屏的 Textual 交互式应用程序;`plain` 模式则通过标准输入输出(stdout/stdin)支持管道操作与 CI/CD 集成。开发者可以参考官方文档获取关于 HTTP、Python API 及插件钩子(Plugin hooks)的详细参考。

🔄 工作流/模块

每个 Creature 由六个概念模块组成。其中五个模块是用户可扩展的,开发者可以通过修改配置或 Python 代码来替换其实现。第六个模块是 Controller(控制��),负责驱动整个推理循环。这种模块化设计允许开发者通过更换模块来实现 Agent 能力的快速迭代,而无需重构整个框架。

❓ FAQ 摘要

针对常见问题,如果 Agent 没有响应,请首先通过 `kt login` 检查 LLM 提供商配置及 API Key 的有效性。若需调试 Agent 的具体行为,建议使用 `kt run --verbose` 查看详细日志,并利用 `kt resume` 或搜索功能来检查和回溯之前的运行记录。

🎯 aiskill88 AI 点评 A 级 2026-05-22

设计完整的AI代理框架,提供工作流和LLM集成能力。项目活跃度中等,文档完整度有待提升,适合寻求工作流方案的开发团队。

📚 实用指南(长尾问题)
适合谁
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 构建企业知识库 / RAG 检索应用的团队
  • 做语音类 AI 产品的开发者
最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
  • 本地部署优先选 GGUF 量化模型,节省显存并保持响应速度
  • 分块大小建议 256-512 tokens,向量库优选 pgvector 或 Qdrant
  • Agent 任务先做 dry-run 验证工具调用链,再开启自主执行
常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
  • embedding 模型与查询模型不一致导致检索失效
  • 显存不足直接 OOM — 优先降低 context 或换更小的量化模型
  • Python 依赖冲突:建议用 venv / uv 隔离环境
部署方案
  • Docker:KohakuTerrarium 提供官方镜像,docker compose up 一键启动
  • CLI:直接 npm install -g / pip install,命令行调用
  • 本地部署:CPU 8GB 起,GPU 推荐 16GB+ 显存
  • 云端托管:可放在 Vercel / Railway / Fly.io 等 PaaS 平台
相关搜索
KohakuTerrarium 中文教程KohakuTerrarium 安装报错怎么办KohakuTerrarium MCP 配置KohakuTerrarium Docker 部署KohakuTerrarium Agent 工作流KohakuTerrarium 与同类工具对比KohakuTerrarium 最佳实践KohakuTerrarium 适合谁用
⚡ 核心功能
👥 适合谁
  • 需要让 Claude / Cursor 操作本地工具的 AI 工程师
  • 构建多智能体协作系统的 Agent 开发者
  • 构建企业知识库 / RAG 检索应用的团队
  • 做语音类 AI 产品的开发者
⭐ 最佳实践
  • 配置 MCP 服务器时建议使用 stdio 传输 + JSON-RPC,避免暴露公网
  • 生产部署优先使用 Docker Compose 隔离依赖,并挂载 volume 持久化数据
  • 本地部署优先选 GGUF 量化模型,节省显存并保持响应速度
  • 分块大小建议 256-512 tokens,向量库优选 pgvector 或 Qdrant
⚠️ 常见错误
  • API key 直接提交到 git 仓库(请用 .env 并加入 .gitignore)
  • MCP 配置路径拼错或权限不足,重启 Claude Desktop 才生效
  • 容器内无法访问宿主机 localhost — 使用 host.docker.internal
  • embedding 模型与查询模型不一致导致检索失效
👥 适合人群
AI 技术爱好者研究人员和学生开发者和工程师技术创业者
🎯 使用场景
  • 本地部署运行,保护数据隐私,满足合规要求
  • 自定义集成到现有系统,扩展技术栈能力
  • 作为开源基础组件进行商业化二次开发
⚖️ 优点与不足
✅ 优点
  • +完全开源免费,无授权费用
  • +本地部署,数据完全自主可控
  • +开发者社区支持,遇问题可查可问
⚠️ 不足
  • 安装和初始配置可能需要一定技术基础
  • 功能完整性通常不如成熟商业产品
  • 技术支持主要依赖开源社区,响应速度不稳定
⚠️ 使用须知

该工具使用 NOASSERTION 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

📄 NOASSERTION — 请查阅原始协议条款了解具体使用限制。

🔗 相关工具推荐
📚 相关教程推荐
📰 相关 AI 新闻
🍿 AI 圈相关吃瓜
🗺️ 相关解决方案
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合
❓ 常见问题 FAQ
框架支持多种主流LLM集成,具体可查阅官方文档的模型支持列表
💡 AI Skill Hub 点评

AI Skill Hub 点评:KohakuTerrarium Agent工作流 的核心功能完整,质量良好。对于AI爱好者来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。

📚 深入学习 KohakuTerrarium Agent工作流
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 KohakuTerrarium
原始描述 开源AI工作流:KohakuTerrarium is a general-purpose AI agent framework and batteries-included a。⭐326 · Python
Topics AI代理框架工作流编排LLM集成Python框架智能自动化
GitHub https://github.com/Kohaku-Lab/KohakuTerrarium
License NOASSERTION
语言 Python
🔗 原始来源
🐙 GitHub 仓库  https://github.com/Kohaku-Lab/KohakuTerrarium 🌐 官方网站  https://terrarium.kohaku-lab.org/

收录时间:2026-05-16 · 更新时间:2026-05-19 · License:NOASSERTION · AI Skill Hub 不对第三方内容的准确性作法律背书。