Build and deploy autonomous AI agents using the OpenServ SDK (@openserv-labs/sdk). IMPORTANT - Always read the companion skill openserv-client alongside this...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install openserv-agent-sdk或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install openserv-agent-sdk⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/openserv-agent-sdk/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: openserv-agent-sdk description: Build and deploy autonomous AI agents using the OpenServ SDK (@openserv-labs/sdk). IMPORTANT - Always read the companion skill openserv-client alongside this skill, as both packages are required to build and run agents. openserv-client covers the full Platform API for multi-agent workflows and ERC-8004 on-chain identity. Read reference.md for the full API reference. ---
Build and deploy custom AI agents for the OpenServ platform using TypeScript.
An OpenServ agent is a service that runs your code and exposes it on the OpenServ platform—so it can be triggered by workflows, other agents, or paid calls (e.g. x402). The platform sends tasks to your agent; your agent runs your capabilities (APIs, tools, file handling) and returns results. You don't have to use an LLM—e.g. it could be a static API that just returns data. If you need LLM reasoning, you have two options: use runless capabilities (the platform handles the AI call for you—no API key needed) or use generate() (delegates the LLM call to the platform); alternatively, bring your own LLM (any provider you have access to).
run handler) and runless (just a name and description—the platform handles the AI call automatically). You can also use generate() inside runnable capabilities to delegate LLM calls to the platform.provision() create one for you automatically by creating a wallet and signing up with it (that account is reused on later runs). Call provision() (from @openserv-labs/client): it creates or reuses a wallet, registers the agent, and writes API key and auth token into your env (or you pass agent.instance to bind them directly). In development you can skip setting an endpoint URL; the SDK can use a built-in tunnel to the platform.run(agent). The agent listens for tasks, runs your capabilities (and your LLM if you use one), and responds. Use reference.md and troubleshooting.md for details; examples/ has full runnable code.run() function needed. Optionally define inputSchema and outputSchema for structured I/O.inputSchema, and run() function.generate() method — Delegate LLM calls to the platform from inside any runnable capability. No API key needed—the platform performs the call and records usage. Supports text and structured output.addLogToTask() and uploadFile().Reference: reference.md (patterns) · troubleshooting.md (common issues) · examples/ (full examples)
npm install @openserv-labs/sdk @openserv-labs/client zod
> Note: openai is only needed if you use the process() method for direct OpenAI calls. Most agents don't need it—use runless capabilities or generate() instead.
See examples/basic-agent.ts for a complete runnable example.
The pattern is simple:
Agent with a system promptagent.addCapability()provision() to register on the platform (pass agent.instance to bind credentials)run(agent) to start---
my-agent/
├── src/agent.ts
├── .env
├── .gitignore
├── package.json
└── tsconfig.json
npm init -y && npm pkg set type=module
npm i @openserv-labs/sdk @openserv-labs/client dotenv zod
npm i -D @types/node tsx typescript
> Note: The project must use "type": "module" in package.json. Add a "dev": "tsx src/agent.ts" script for local development. Only install openai if you use the process() method for direct OpenAI calls.
Most agents don't need any LLM API key—use runless capabilities or generate() and the platform handles LLM calls for you. If you use process() for direct OpenAI calls, set OPENAI_API_KEY. The rest is filled by provision().
# Only needed if you use process() for direct OpenAI calls:
# OPENAI_API_KEY=your-openai-key
# ANTHROPIC_API_KEY=your_anthropic_key # If using Claude directly
# Auto-populated by provision():
WALLET_PRIVATE_KEY=
OPENSERV_API_KEY=
OPENSERV_AUTH_TOKEN=
PORT=7378
# Production: skip tunnel and run HTTP server only
# DISABLE_TUNNEL=true
# Force tunnel even when endpointUrl is set
# FORCE_TUNNEL=true
---
Capabilities come in two flavors:
Runless capabilities don't need a run function—the platform handles the AI call automatically. Just provide a name and description:
// Simplest form — just name + description
agent.addCapability({
name: 'generate_haiku',
description: 'Generate a haiku poem (5-7-5 syllables) about the given input.'
})
// With custom input schema
agent.addCapability({
name: 'translate',
description: 'Translate text to the target language.',
inputSchema: z.object({
text: z.string(),
targetLanguage: z.string()
})
})
// With structured output
agent.addCapability({
name: 'analyze_sentiment',
description: 'Analyze the sentiment of the given text.',
outputSchema: z.object({
sentiment: z.enum(['positive', 'negative', 'neutral']),
confidence: z.number().min(0).max(1)
})
})
run function — the platform performs the LLM callinputSchema is optional — defaults to z.object({ input: z.string() }) if omittedoutputSchema is optional — define it for structured output from the platformSee examples/haiku-poet-agent.ts for a complete runless example.
Runnable capabilities have a run function for custom logic. Each requires:
name - Unique identifierdescription - What it does (helps AI decide when to use it)inputSchema - Zod schema defining parametersrun - Function returning a stringagent.addCapability({
name: 'greet',
description: 'Greet a user by name',
inputSchema: z.object({ name: z.string() }),
async run({ args }) {
return `Hello, ${args.name}!`
}
})
See examples/capability-example.ts for basic capabilities.
> Note: The schema property still works as an alias for inputSchema but is deprecated. Use inputSchema for new code.
Access this in capabilities to use agent methods like addLogToTask(), uploadFile(), generate(), etc.
See examples/capability-with-agent-methods.ts for logging and file upload patterns.
---
generate() — Platform-Delegated LLM CallsThe generate() method lets you make LLM calls without any API key. The platform performs the call and records usage to the workspace.
// Text generation
const poem = await this.generate({
prompt: `Write a short poem about ${args.topic}`,
action
})
// Structured output (returns validated object matching the schema)
const metadata = await this.generate({
prompt: `Suggest a title and 3 tags for: ${poem}`,
outputSchema: z.object({
title: z.string(),
tags: z.array(z.string()).length(3)
}),
action
})
...安装 OpenServ Agent Sdk 后,可以对 AI 说这些话来触发它
Help me get started with OpenServ Agent Sdk
Explains what OpenServ Agent Sdk does, walks through the setup, and runs a quick demo based on your current project
Use OpenServ Agent Sdk to build and deploy autonomous AI agents using the OpenServ SDK (@open...
Invokes OpenServ Agent Sdk with the right parameters and returns the result directly in the conversation
What can I do with OpenServ Agent Sdk in my developer & devops workflow?
Lists the top use cases for OpenServ Agent Sdk, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/openserv-agent-sdk/ 目录(个人级,所有项目可用),或 .claude/skills/openserv-agent-sdk/(项目级)。重启 AI 客户端后,用 /openserv-agent-sdk 主动调用,或让 AI 根据上下文自动发现并使用。
OpenServ Agent Sdk 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
OpenServ Agent Sdk 可免费安装使用。请查阅仓库了解许可证信息。
Build and deploy autonomous AI agents using the OpenServ SDK (@openserv-labs/sdk). IMPORTANT - Always read the companion skill openserv-client alongside this...
OpenServ Agent Sdk 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using OpenServ Agent Sdk
Identifies repetitive steps in your workflow and sets up OpenServ Agent Sdk to handle them automatically