1. 准备 SDK
Ruby Agent SDK 包尚未发布到 RubyGems。请参阅从源代码安装说明。
2. 定义笔记查询工具
3. 创建并运行 Agent
适用场景
- 工具输入简单且行为确定
- Ruby 应用已拥有数据源
- 你想为范围明确的工作流采用易用的本地工具模式
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
使用 Ruby Agent SDK 查询本地笔记,并通过 Phaseo Gateway 返回范围明确的摘要。
lookup_note = PhaseoAgentSdk.define_tool(
PhaseoAgentSdk::Tool.new(
id: "lookup-note",
description: "Look up one internal note by topic.",
parameters: {
type: "object",
properties: {
topic: { type: "string" },
},
required: ["topic"],
},
execute: lambda do |input, _context|
{
topic: input["topic"],
summary: "Presets centralize routing defaults so app code stays smaller.",
}
end
)
)
agent = PhaseoAgentSdk.create_agent(
id: "notes-agent",
model: "openai/gpt-5.4-nano",
instructions: "Use tools when helpful and answer in one short paragraph.",
tools: [lookup_note]
)
result = agent.run(
input: "Summarize our note about presets.",
client: PhaseoAgentSdk.create_gateway_agent_client
)
puts result.output