> For the complete documentation index, see [llms.txt](https://tinyhumans.gitbook.io/openhuman/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tinyhumans.gitbook.io/openhuman/zh/kai-fa/embed/cookbook.md). Agents can also search and read this documentation through its [MCP server](https://tinyhumans.gitbook.io/openhuman/~gitbook/mcp).

# 食谱

可执行配方会从其源头文件头中建立索引。每个条目记录示例所需的声明运行模式以及任何命名的 Embed 功能。完整源码包含周围的设置和断言。

## 带取消的轮询和回调审批

允许和拒绝真实的停放写入，然后在不丢失其待处理请求的情况下取消一个进行中的回调。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/approvals.rs) · 离线，使用回环存根；没有实时路径。

运行： `cargo run -p openhuman-embed --example approvals`

## 启动前后稳定的能力元数据

启动前后稳定的能力元数据。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/capability_report.rs) · 离线，使用回环存根；没有实时路径。

运行： `cargo run -p openhuman-embed --example capability_report`

## 无需启动代理运行时的无状态完成

无需启动代理运行时的无状态完成。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/completer.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。

运行： `cargo run -p openhuman-embed --example completer`

## 运行并检查一个代理 cron 作业

运行并检查一个代理 cron 作业。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/cron.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。

运行： `cargo run -p openhuman-embed --example cron`

## 原生自定义提供方、回退和工作负载角色固定

注入确定性的原生模型，并在没有推理 HTTP 的情况下证明回退和角色选择。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/custom_provider.rs) · 离线；没有实时推理路径。

运行： `cargo run -p openhuman-embed --example custom_provider`

## 运行时默认值和按代理覆盖

运行时默认值和按代理覆盖。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/defaults_overrides.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。

运行： `cargo run -p openhuman-embed --example defaults_overrides`

## 每个代理的回合后钩子会观察已完成的回合

每个代理的回合后钩子会观察已完成的回合。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/hooks.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。

运行： `cargo run -p openhuman-embed --example hooks`

## Host tools 和 HostOnly 会保持所公布的工具目录完全准确

Host tools 和 HostOnly 会保持所公布的工具目录完全准确。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/host_tools.rs) · 离线，使用回环存根；没有实时路径。

运行： `cargo run -p openhuman-embed --example host_tools`

## 无后台服务的精简运行时

无后台服务的精简运行时。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/lean_headless.rs) · 离线，使用回环存根；可选通过 OPENHUMAN\_EXAMPLE\_LIVE 启用实时模式。

运行： `cargo run -p openhuman-embed --example lean_headless`

## Linux 代理集群内存和延迟

使用回环推理和两个工作线程，测量保留的运行时所有代理。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/linux_fleet.rs) · 在 Linux 上离线；发布测量请使用新的受限 cgroup。· 功能：mcp,storage-sqlite

运行： `cargo run -p openhuman-embed --release --example linux_fleet --no-default-features --features mcp,storage-sqlite`

## 通过回环连接一个真实的 MCP 协议存根

通过回环连接一个真实的 MCP 协议存根。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/mcp.rs) · 离线，使用回环存根；没有实时路径。· 功能：mcp,storage-sqlite

运行： `cargo run -p openhuman-embed --example mcp --features mcp,storage-sqlite`

## 带有内存引擎的租户范围内存门面

带有内存引擎的租户范围内存门面。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/memory.rs) · 离线，使用回环存根；没有实时路径。

运行： `cargo run -p openhuman-embed --example memory`

## SaaS 配置文件隔离会话历史

SaaS 配置文件隔离会话历史。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/profiles.rs) · 离线，使用回环存根；没有实时路径。· 功能：channels,storage-sqlite

运行： `cargo run -p openhuman-embed --example profiles --features channels,storage-sqlite`

## 你好，代理：输入一个提示，输出一个回复

你好，代理：输入一个提示，输出一个回复。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/run_turn.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。

运行： `cargo run -p openhuman-embed --example run_turn`

## 运行时生命周期事件和实时钩子注册

观察有序元数据，并在代理继续运行时添加/移除一个运行时范围的钩子。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/runtime_events.rs) · 离线，使用回环提供方；没有实时路径。

运行： `cargo run -p openhuman-embed --example runtime_events`

## 访问层级和明确的沙箱选择

访问层级和明确的沙箱选择。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/sandbox_access.rs) · 离线，使用回环存根；没有实时路径。

运行： `cargo run -p openhuman-embed --example sandbox_access`

## 将代理嵌入到由主机拥有的 HTTP 服务器后面

将代理嵌入到由主机拥有的 HTTP 服务器后面。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/server.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。

运行： `cargo run -p openhuman-embed --example server`

## 将一个技能包复制到其代理工作区中

将一个技能包复制到其代理工作区中。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/skills.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。· 功能：skills

运行： `cargo run -p openhuman-embed --example skills --features skills`

## 通过 Embed 进行 SQLite 写入和 MongoDB 配置

打开一个真实的本地 SQLite 后端，并在不连接的情况下描述一个 MongoDB 部署。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/storage.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_MONGODB\_URL 和 storage-mongodb 使用实时 MongoDB。· 功能：storage-sqlite

运行： `cargo run -p openhuman-embed --example storage --features storage-sqlite`

## 带有排空接收器的流式进度

带有排空接收器的流式进度。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/streaming.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。

运行： `cargo run -p openhuman-embed --example streaming`

## 结构化输出被解析并针对请求进行检查

结构化输出被解析并针对请求进行检查。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/structured_output.rs) · 离线，使用回环存根；没有实时路径。

运行： `cargo run -p openhuman-embed --example structured_output`

## Telegram 频道通过本地 Bot API 由其绑定的代理应答

Telegram 频道通过本地 Bot API 由其绑定的代理应答。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/telegram.rs) · 离线，使用回环存根；没有实时路径。· 功能：channels

运行： `cargo run -p openhuman-embed --example telegram --features channels`

## 两个代理，拥有独立的提示和工作文件夹

两个代理，拥有独立的提示和工作文件夹。

[源代码](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/examples/two_agents.rs) · 离线；可选通过 OPENHUMAN\_EXAMPLE\_LIVE=1 以及 BASE\_URL/API\_KEY/MODEL 启用实时模式。

运行： `cargo run -p openhuman-embed --example two_agents`
