SuperAPI AI 工具集

nemo-relay-start

智能体与模型

查看项目

更新于 10-16 02:34

技能介绍

用途:面向首次使用 NeMo Relay 的开发者,提供最短路径跑通可运行示例。Rust、Python、Node.js 是主要快速上手与托管文档路径;Go 与原始 FFI 属于源码优先的高级路径。

主要能力:先确定宿主语言,再引导完成一个 scope、一次工具调用和一次 LLM 调用;优先使用托管执行 API,而非手动生命周期 API;基础流程跑通后再加可观测性。

用法:Rust 使用 nemo_relay::api::scope::{push_scope, pop_scope, event} 配合 builder 参数,再调用 nemo_relay::api::tool::tool_call_execute(...) 与 nemo_relay::api::llm::llm_call_execute(...)。Python 先 uv sync,再用 nemo_relay.scope.scope(...)、nemo_relay.tools.execute(...)、nemo_relay.llm.execute(...)。Node.js 先构建 addon,再用 withScope(...)、toolCallExecute(...)、llmCallExecute(...)。Go 使用源码优先包装如 scope.Push(...)、tools.Execute(...)、llm.Execute(...)。FFI 仅建议用于绑定或嵌入,需在当前头文件核对 C 名称。

安装:消费应用可用 cargo add nemo-relay、uv add nemo-relay、npm install nemo-relay-node;从检出构建时 Rust 构建工作区,Python 用 uv sync 重建虚拟环境与原生扩展,Node.js 先安装并构建原生 addon。

首个示例:注册短生命周期订阅者,打开 agent scope,发出一个 mark 事件,运行一次托管工具调用与一次托管 LLM 调用,再注销订阅者。Python 用 nemo_relay.subscribers,Node.js 用 registerSubscriber 等根导出,Rust 用 nemo_relay::api::subscriber。成功标志是应用发出 scope 起止事件及工具、LLM 生命周期事件,且应用结果仍为 provider 或工具结果。

限制与常见问题:无活动 scope 时调用 execute API、跳过构建步骤、误以为 Go/FFI 绑定与 Rust/Python/Node.js 有同等托管文档覆盖、在首个示例中混入手动生命周期 API。Rust 中 scope 句柄显式,Python 与 Node.js 高层 helper 中可选,父级不明确时需传入句柄。相关技能:nemo-relay-instrument-calls、nemo-relay-setup-observability、nemo-relay-debug-runtime-integration。