列出画布
const canvases = await theo.canvases();
获取画布
const canvas = await theo.canvas("canvas-uuid");
创建画布
const canvas = await theo.createCanvas({
name: "Support Agent",
description: "Customer service skill with knowledge base",
graph_json: {
nodes: [
{ id: "in", type: "input", position: { x: 300, y: 0 }, data: { type: "input", label: "Input", config: { triggerType: "manual" } } },
{ id: "p1", type: "prompt", position: { x: 280, y: 120 }, data: { type: "prompt", label: "Prompt", config: { content: "You are a helpful support agent." } } },
{ id: "m1", type: "model", position: { x: 300, y: 260 }, data: { type: "model", label: "Model", config: { modelId: "theo-1-flash" } } },
{ id: "out", type: "output", position: { x: 300, y: 400 }, data: { type: "output", label: "Output", config: { format: "text" } } },
],
edges: [
{ id: "e1", source: "in", target: "p1" },
{ id: "e2", source: "p1", target: "m1" },
{ id: "e3", source: "m1", target: "out" },
],
},
});
更新画布
await theo.updateCanvas(canvas.id, {
name: "Updated Support Agent",
graph_json: updatedGraph,
});
删除画布
await theo.deleteCanvas(canvas.id);
编译
校验图的拓扑结构,并将其编译为SkillManifest 和 WorkflowSteps。
const result = await theo.compileCanvas(canvas.id);
if (result.compiled) {
console.log("Manifest:", result.manifest);
console.log("Steps:", result.steps);
} else {
console.error("Errors:", result.errors);
}
测试(沙箱)
通过已编译的画布发送一条测试消息。工具调用会被模拟执行。const test = await theo.testCanvas(canvas.id, "Check stock for SKU-1234");
console.log(test.response);
console.log(`Cost: ${test.cost_cents} cents`);
const test = await theo.testCanvas(canvas.id, "What about SKU-5678?", [
{ role: "user", content: "Check stock for SKU-1234" },
{ role: "assistant", content: "SKU-1234 has 47 units in stock." },
]);
发布
编译、审核,然后作为技能发布。选择可见范围:// Private — only you
await theo.publishCanvas(canvas.id, {
slug: "my-agent",
version: "1.0.0",
author: { name: "Your Name" },
visibility: "private",
});
// Organization — visible to your org members
await theo.publishCanvas(canvas.id, {
slug: "team-agent",
version: "1.0.0",
author: { name: "Your Name" },
visibility: "org",
target_org_id: "org-uuid",
});
// Public marketplace
await theo.publishCanvas(canvas.id, {
slug: "public-agent",
version: "1.0.0",
author: { name: "Your Name" },
visibility: "public",
readme: "# Public Agent\nA skill for everyone.",
});
