[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75J23KQTVB29G9A66WWT2P4":3,"skill-same:01M75J23KQTVB29G9A66WWT2P4":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M75J23KQTVB29G9A66WWT2P4","openserv-agent-sdk",null,"Build and deploy autonomous AI agents using the OpenServ SDK (@openserv-labs\u002Fsdk). 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.","javimosch\u002Fopen-claw-skills","javimosch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F12900508?v=4","01M6D3F2AS6PV75ET9PZ1QGP8J","Javier Leandro Arancibia","01M75B8NCTAJG9WH5YNZH7C3D8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fissa-me-sush\u002Fopenserv-agent-sdk\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: openserv-agent-sdk\ndescription: Build and deploy autonomous AI agents using the OpenServ SDK (@openserv-labs\u002Fsdk). 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.\n---\n\n# OpenServ Agent SDK\n\nBuild and deploy custom AI agents for the OpenServ platform using TypeScript.\n\n## Why build an agent?\n\nAn 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).\n\n## How it works (the flow)\n\n1. **Define your agent** — System prompt plus _capabilities_. Capabilities come in two flavors: **runnable** (with a Zod schema and a `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.\n2. **Register with the platform** — You need an account on the platform; often the easiest way is to let `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\u002Fclient`): 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.\n3. **Start the agent** — Call `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\u002F` has full runnable code.\n\n## What your agent can do\n\n- **Runless Capabilities** — Just a name and description. The platform handles the AI call automatically—no API key, no `run()` function needed. Optionally define `inputSchema` and `outputSchema` for structured I\u002FO.\n- **Runnable Capabilities** — The tools your agent can run (e.g. search, transform data, call APIs). Each has a name, description, `inputSchema`, and `run()` function.\n- **`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.\n- **Task context** — When running in a task, the agent can attach logs and uploads to that task via methods like `addLogToTask()` and `uploadFile()`.\n- **Multi-agent workflows** — Your agent can be part of workflows with other agents; see the **openserv-client** skill for the Platform API, workflows, and ERC-8004 on-chain identity.\n\n**Reference:** `reference.md` (patterns) · `troubleshooting.md` (common issues) · `examples\u002F` (full examples)\n\n## Quick Start\n\n### Installation\n\n```bash\nnpm install @openserv-labs\u002Fsdk @openserv-labs\u002Fclient zod\n```\n\n> **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.\n\n### Minimal Agent\n\nSee `examples\u002Fbasic-agent.ts` for a complete runnable example.\n\nThe pattern is simple:\n\n1. Create an `Agent` with a system prompt\n2. Add capabilities with `agent.addCapability()`\n3. Call `provision()` to register on the platform (pass `agent.instance` to bind credentials)\n4. Call `run(agent)` to start\n\n---\n\n## Complete Agent Template\n\n### File Structure\n\n```\nmy-agent\u002F\n├── src\u002Fagent.ts\n├── .env\n├── .gitignore\n├── package.json\n└── tsconfig.json\n```\n\n### Dependencies\n\n```bash\nnpm init -y && npm pkg set type=module\nnpm i @openserv-labs\u002Fsdk @openserv-labs\u002Fclient dotenv zod\nnpm i -D @types\u002Fnode tsx typescript\n```\n\n> **Note:** The project must use `\"type\": \"module\"` in `package.json`. Add a `\"dev\": \"tsx src\u002Fagent.ts\"` script for local development. Only install `openai` if you use the `process()` method for direct OpenAI calls.\n\n### .env\n\nMost 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()`.\n\n```env\n# Only needed if you use process() for direct OpenAI calls:\n# OPENAI_API_KEY=your-openai-key\n# ANTHROPIC_API_KEY=your_anthropic_key  # If using Claude directly\n\n# Auto-populated by provision():\nWALLET_PRIVATE_KEY=\nOPENSERV_API_KEY=\nOPENSERV_AUTH_TOKEN=\nPORT=7378\n# Production: skip tunnel and run HTTP server only\n# DISABLE_TUNNEL=true\n# Force tunnel even when endpointUrl is set\n# FORCE_TUNNEL=true\n```\n\n---\n\n## Capabilities\n\nCapabilities come in two flavors:\n\n### Runless Capabilities (recommended for most use cases)\n\nRunless capabilities don't need a `run` function—the platform handles the AI call automatically. Just provide a name and description:\n\n```typescript\n\u002F\u002F Simplest form — just name + description\nagent.addCapability({\n  name: 'generate_haiku',\n  description: 'Generate a haiku poem (5-7-5 syllables) about the given input.'\n})\n\n\u002F\u002F With custom input schema\nagent.addCapability({\n  name: 'translate',\n  description: 'Translate text to the target language.',\n  inputSchema: z.object({\n    text: z.string(),\n    targetLanguage: z.string()\n  })\n})\n\n\u002F\u002F With structured output\nagent.addCapability({\n  name: 'analyze_sentiment',\n  description: 'Analyze the sentiment of the given text.',\n  outputSchema: z.object({\n    sentiment: z.enum(['positive', 'negative', 'neutral']),\n    confidence: z.number().min(0).max(1)\n  })\n})\n```\n\n- **No `run` function** — the platform performs the LLM call\n- **No API key needed** — the platform handles it\n- `inputSchema` is optional — defaults to `z.object({ input: z.string() })` if omitted\n- `outputSchema` is optional — define it for structured output from the platform\n\nSee `examples\u002Fhaiku-poet-agent.ts` for a complete runless example.\n\n### Runnable Capabilities\n\nRunnable capabilities have a `run` function for custom logic. Each requires:\n\n- `name` - Unique identifier\n- `description` - What it does (helps AI decide when to use it)\n- `inputSchema` - Zod schema defining parameters\n- `run` - Function returning a string\n\n```typescript\nagent.addCapability({\n  name: 'greet',\n  description: 'Greet a user by name',\n  inputSchema: z.object({ name: z.string() }),\n  async run({ args }) {\n    return `Hello, ${args.name}!`\n  }\n})\n```\n\nSee `examples\u002Fcapability-example.ts` for basic capabilities.\n\n> **Note:** The `schema` property still works as an alias for `inputSchema` but is deprecated. Use `inputSchema` for new code.\n\n### Using Agent Methods\n\nAccess `this` in capabilities to use agent methods like `addLogToTask()`, `uploadFile()`, `generate()`, etc.\n\nSee `examples\u002Fcapability-with-agent-methods.ts` for logging and file upload patterns.\n\n---\n\n## Agent Methods\n\n### `generate()` — Platform-Delegated LLM Calls\n\nThe `generate()` method lets you make LLM calls without any API key. The platform performs the call and records usage to the workspace.\n\n```typescript\n\u002F\u002F Text generation\nconst poem = await this.generate({\n  prompt: `Write a short poem about ${args.topic}`,\n  action\n})\n\n\u002F\u002F Structured output (returns validated object matching the schema)\nconst metadata = await this.generate({\n  prompt: `Suggest a title and 3 tags for: ${poem}`,\n  outputSchema: z.object({\n    title: z.string(),\n    tags: z.array(z.string()).length(3)\n  }),\n  action\n})\n\n\u002F\u002F With conversation history\nconst followUp = await this.generate({\n  prompt: 'Suggest a related topic.',\n  messages,  \u002F\u002F conversation history from run function\n  action\n})\n```\n\nParameters:\n- `prompt` (string) — The prompt for the LLM\n- `action` (ActionSchema) — The action context (passed into your `run` function)\n- `outputSchema` (Zod schema, optional) — When provided, returns a validated structured output\n- `messages` (array, optional) — Conversation history for multi-turn generation\n\nThe `action` parameter is required because it identifies the workspace\u002Ftask for billing. Use it inside runnable capabilities where `action` is available from the `run` function arguments.\n\n### Task Management\n\n```typescript\nawait agent.createTask({ workspaceId, assignee, description, body, input, dependencies })\nawait agent.updateTaskStatus({ workspaceId, taskId, status: 'in-progress' })\nawait agent.addLogToTask({ workspaceId, taskId, severity: 'info', type: 'text', body: '...' })\nawait agent.markTaskAsErrored({ workspaceId, taskId, error: 'Something went wrong' })\nconst task = await agent.getTaskDetail({ workspaceId, taskId })\nconst tasks = await agent.getTasks({ workspaceId })\n```\n\n### File Operations\n\n```typescript\nconst files = await agent.getFiles({ workspaceId })\nawait agent.uploadFile({ workspaceId, path: 'output.txt', file: 'content', taskIds: [taskId] })\nawait agent.deleteFile({ workspaceId, fileId })\n```\n\n---\n\n## Action Context\n\nThe `action` parameter in capabilities is a **union type** — `task` only exists on the `'do-task'` variant. Always narrow with a type guard before accessing `action.task`:\n\n```typescript\nasync run({ args, action }) {\n  \u002F\u002F action.task does NOT exist on all action types — you must narrow first\n  if (action?.type === 'do-task' && action.task) {\n    const { workspace, task } = action\n    workspace.id        \u002F\u002F Workspace ID\n    workspace.goal      \u002F\u002F Workspace goal\n    task.id             \u002F\u002F Task ID\n    task.description    \u002F\u002F Task description\n    task.input          \u002F\u002F Task input\n    action.me.id        \u002F\u002F Current agent ID\n  }\n}\n```\n\n**Do not** extract `action?.task?.id` before the type guard — TypeScript will error with `Property 'task' does not exist on type 'ActionSchema'`.\n\n---\n\n## Workflow Name & Goal\n\nThe `workflow` object in `provision()` requires two important properties:\n\n- **`name`** (string) - This becomes the **agent name in ERC-8004**. Make it polished, punchy, and memorable — this is the public-facing brand name users see. Think product launch, not variable name. Examples: `'Crypto Alpha Scanner'`, `'AI Video Studio'`, `'Instant Blog Machine'`.\n- **`goal`** (string, required) - A detailed description of what the workflow accomplishes. Must be descriptive and thorough — short or vague goals will cause API calls to fail. Write at least a full sentence explaining the workflow's purpose.\n\n```typescript\nworkflow: {\n  name: 'Haiku Poetry Generator',  \u002F\u002F Polished display name — the ERC-8004 agent name users see\n  goal: 'Transform any theme or emotion into a beautiful traditional 5-7-5 haiku poem using AI',\n  trigger: triggers.x402({ ... }),\n  task: { description: 'Generate a haiku about the given topic' }\n}\n```\n\n---\n\n## Trigger Types\n\n```typescript\nimport { triggers } from '@openserv-labs\u002Fclient'\n\ntriggers.webhook({ waitForCompletion: true, timeout: 600 })\ntriggers.x402({ name: '...', description: '...', price: '0.01', timeout: 600 })\ntriggers.cron({ schedule: '0 9 * * *' })\ntriggers.manual()\n```\n\n> **Important:** Always set `timeout` to at least **600 seconds** (10 minutes) for webhook and x402 triggers. Agents often take significant time to process requests — especially when performing research, content generation, or other complex tasks. A low timeout will cause premature failures. For multi-agent pipelines with many sequential steps, consider 900 seconds or more.\n\n## API Keys: Agent vs User\n\n`provision()` creates two types of credentials. They are **not interchangeable**:\n\n- **`OPENSERV_API_KEY`** (Agent API key) — Used internally by the SDK to authenticate when receiving tasks. Set automatically by `provision()` when you pass `agent.instance`. **Do not** use this key with `PlatformClient`.\n- **`WALLET_PRIVATE_KEY`** \u002F **`OPENSERV_USER_API_KEY`** (User credentials) — Used with `PlatformClient` to make management calls (list tasks, debug workflows, etc.). Authenticate with `client.authenticate(walletKey)` or pass `apiKey` to the constructor.\n\nIf you need to debug tasks or inspect workflows, use wallet authentication:\n\n```typescript\nconst client = new PlatformClient()\nawait client.authenticate(process.env.WALLET_PRIVATE_KEY)\nconst tasks = await client.tasks.list({ workflowId: result.workflowId })\n```\n\nSee `troubleshooting.md` for details on 401 errors.\n\n---\n\n## Deployment\n\n### Local Development\n\n```bash\nnpm run dev\n```\n\nThe `run()` function automatically:\n\n- Starts the agent HTTP server (port 7378, with automatic fallback)\n- Connects via WebSocket to `agents-proxy.openserv.ai`\n- Routes platform requests to your local machine\n\n**No need for ngrok or other tunneling tools** - `run()` handles this seamlessly. Just call `run(agent)` and your local agent is accessible to the platform.\n\n### Production\n\nWhen deploying to a hosting provider like Cloud Run, set `DISABLE_TUNNEL=true` as an environment variable. This makes `run()` start only the HTTP server without opening a WebSocket tunnel — the platform reaches your agent directly at its public URL.\n\n```typescript\nawait provision({\n  agent: {\n    name: 'my-agent',\n    description: '...',\n    endpointUrl: 'https:\u002F\u002Fmy-agent.example.com' \u002F\u002F Required for production\n  },\n  workflow: {\n    name: 'Lightning Service Pro',\n    goal: 'Describe in detail what this workflow does — be thorough, vague goals cause failures',\n    trigger: triggers.webhook({ waitForCompletion: true, timeout: 600 }),\n    task: { description: 'Process incoming requests' }\n  }\n})\n\n\u002F\u002F With DISABLE_TUNNEL=true, run() starts only the HTTP server (no tunnel)\nawait run(agent)\n```\n\n---\n\n## ERC-8004: On-Chain Agent Identity\n\nAfter provisioning, register your agent on-chain for discoverability via the Identity Registry.\n\n> **Requires ETH on Base.** Registration calls `register()` on the ERC-8004 contract on **Base mainnet (chain 8453)**, which costs gas. The wallet created by `provision()` starts with a zero balance. Fund it with a small amount of ETH on Base before the first registration attempt. The wallet address is logged during provisioning (`Created new wallet: 0x...`).\n\n> **Always wrap in try\u002Fcatch** so a registration failure (e.g. unfunded wallet) doesn't prevent `run(agent)` from starting.\n\nTwo important patterns:\n\n1. **Use `dotenv` programmatically** (not `import 'dotenv\u002Fconfig'`) so you can reload `.env` after `provision()` writes `WALLET_PRIVATE_KEY`.\n2. **Call `dotenv.config({ override: true })` after `provision()`** to pick up the freshly written key before ERC-8004 registration.\n\n```typescript\nimport dotenv from 'dotenv'\ndotenv.config()\n\nimport { Agent, run } from '@openserv-labs\u002Fsdk'\nimport { provision, triggers, PlatformClient } from '@openserv-labs\u002Fclient'\n\n\u002F\u002F ... define agent and capabilities ...\n\nconst result = await provision({\n  agent: { instance: agent, name: 'my-agent', description: '...' },\n  workflow: {\n    name: 'My Service',\n    goal: 'Detailed description of what the workflow does',\n    trigger: triggers.x402({ name: 'My Service', description: '...', price: '0.01', timeout: 600 }),\n    task: { description: 'Process requests' }\n  }\n})\n\n\u002F\u002F Reload .env to pick up WALLET_PRIVATE_KEY written by provision()\ndotenv.config({ override: true })\n\n\u002F\u002F Register on-chain (non-blocking — requires funded wallet on Base)\ntry {\n  const client = new PlatformClient()\n  await client.authenticate(process.env.WALLET_PRIVATE_KEY)\n\n  const erc8004 = await client.erc8004.registerOnChain({\n    workflowId: result.workflowId,\n    privateKey: process.env.WALLET_PRIVATE_KEY!,\n    name: 'My Service',\n    description: 'What this agent does'\n  })\n\n  console.log(`Agent ID: ${erc8004.agentId}`) \u002F\u002F \"8453:42\"\n  console.log(`TX: ${erc8004.blockExplorerUrl}`)\n  console.log(`Scan: ${erc8004.scanUrl}`) \u002F\u002F \"https:\u002F\u002Fwww.8004scan.io\u002Fagents\u002Fbase\u002F42\"\n} catch (error) {\n  console.warn('ERC-8004 registration skipped:', error instanceof Error ? error.message : error)\n}\n\nawait run(agent)\n```\n\n- **First run** mints a new identity NFT. **Re-runs update the URI** — agent ID stays the same.\n- **Never clear the wallet state** unless you intentionally want a new agent ID. To update metadata, just re-run.\n- Default chain: Base mainnet (8453). Pass `chainId` \u002F `rpcUrl` for others.\n\nSee **openserv-client** skill for the full ERC-8004 API reference and troubleshooting.\n\n---\n\n## DO NOT USE\n\n- **`this.process()`** inside capabilities — Legacy method requiring an OpenAI API key. Use `this.generate()` instead (platform-delegated, no key needed), or use runless capabilities\n- **`doTask` override** — The SDK handles task execution automatically\n- **`this.completeTask()`** — Task completion is handled by the Runtime API\n\n---\n\n## Updating This Skill\n\nThis skill may be outdated. The OpenServ team ships updates regularly—new features, API changes, and bug fixes won't be reflected here until you update. **If something isn't working as expected, or you want to make sure you have the latest information, update the skill before proceeding.**\n\n```bash\n# Check if updates are available\nnpx skills check\n\n# Update all installed skills to latest versions\nnpx skills update\n```\n\nOr reinstall the OpenServ skills directly:\n\n```bash\nnpx skills add openserv-labs\u002Fskills\n```\n\n---\n\n## Related Skills\n\n- **openserv-client** - Full Platform Client API reference\n- **openserv-multi-agent-workflows** - Multi-agent collaboration patterns\n- **openserv-launch** - Launch tokens on Base blockchain\n- **openserv-ideaboard-api** - Find ideas and ship agent services on the Ideaboard\n","# OpenServ Agent SDK\n\nBuild and deploy custom AI agents for the OpenServ platform using TypeScript.\n\n## Why build an agent?\n\nAn 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).\n\n## How it works (the flow)\n\n1. **Define your agent** — System prompt plus _capabilities_. Capabilities come in two flavors: **runnable** (with a Zod schema and a `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.\n2. **Register with the platform** — You need an account on the platform; often the easiest way is to let `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\u002Fclient`): 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.\n3. **Start the agent** — Call `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\u002F` has full runnable code.\n\n## What your agent can do\n\n- **Runless Capabilities** — Just a name and description. The platform handles the AI call automatically—no API key, no `run()` function needed. Optionally define `inputSchema` and `outputSchema` for structured I\u002FO.\n- **Runnable Capabilities** — The tools your agent can run (e.g. search, transform data, call APIs). Each has a name, description, `inputSchema`, and `run()` function.\n- **`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.\n- **Task context** — When running in a task, the agent can attach logs and uploads to that task via methods like `addLogToTask()` and `uploadFile()`.\n- **Multi-agent workflows** — Your agent can be part of workflows with other agents; see the **openserv-client** skill for the Platform API, workflows, and ERC-8004 on-chain identity.\n\n**Reference:** `reference.md` (patterns) · `troubleshooting.md` (common issues) · `examples\u002F` (full examples)\n\n## Quick Start\n\n### Installation\n\n```bash\nnpm install @openserv-labs\u002Fsdk @openserv-labs\u002Fclient zod\n```\n\n> **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.\n\n### Minimal Agent\n\nSee `examples\u002Fbasic-agent.ts` for a complete runnable example.\n\nThe pattern is simple:\n\n1. Create an `Agent` with a system prompt\n2. Add capabilities with `agent.addCapability()`\n3. Call `provision()` to register on the platform (pass `agent.instance` to bind credentials)\n4. Call `run(agent)` to start\n\n---\n\n## Complete Agent Template\n\n### File Structure\n\n```\nmy-agent\u002F\n├── src\u002Fagent.ts\n├── .env\n├── .gitignore\n├── package.json\n└── tsconfig.json\n```\n\n### Dependencies\n\n```bash\nnpm init -y && npm pkg set type=module\nnpm i @openserv-labs\u002Fsdk @openserv-labs\u002Fclient dotenv zod\nnpm i -D @types\u002Fnode tsx typescript\n```\n\n> **Note:** The project must use `\"type\": \"module\"` in `package.json`. Add a `\"dev\": \"tsx src\u002Fagent.ts\"` script for local development. Only install `openai` if you use the `process()` method for direct OpenAI calls.\n\n### .env\n\nMost 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()`.\n\n```env\n# Only needed if you use process() for direct OpenAI calls:\n# OPENAI_API_KEY=your-openai-key\n# ANTHROPIC_API_KEY=your_anthropic_key  # If using Claude directly\n\n# Auto-populated by provision():\nWALLET_PRIVATE_KEY=\nOPENSERV_API_KEY=\nOPENSERV_AUTH_TOKEN=\nPORT=7378\n# Production: skip tunnel and run HTTP server only\n# DISABLE_TUNNEL=true\n# Force tunnel even when endpointUrl is set\n# FORCE_TUNNEL=true\n```\n\n---\n\n## Capabilities\n\nCapabilities come in two flavors:\n\n### Runless Capabilities (recommended for most use cases)\n\nRunless capabilities don't need a `run` function—the platform handles the AI call automatically. Just provide a name and description:\n\n```typescript\n\u002F\u002F Simplest form — just name + description\nagent.addCapability({\n  name: 'generate_haiku',\n  description: 'Generate a haiku poem (5-7-5 syllables) about the given input.'\n})\n\n\u002F\u002F With custom input schema\nagent.addCapability({\n  name: 'translate',\n  description: 'Translate text to the target language.',\n  inputSchema: z.object({\n    text: z.string(),\n    targetLanguage: z.string()\n  })\n})\n\n\u002F\u002F With structured output\nagent.addCapability({\n  name: 'analyze_sentiment',\n  description: 'Analyze the sentiment of the given text.',\n  outputSchema: z.object({\n    sentiment: z.enum(['positive', 'negative', 'neutral']),\n    confidence: z.number().min(0).max(1)\n  })\n})\n```\n\n- **No `run` function** — the platform performs the LLM call\n- **No API key needed** — the platform handles it\n- `inputSchema` is optional — defaults to `z.object({ input: z.string() })` if omitted\n- `outputSchema` is optional — define it for structured output from the platform\n\nSee `examples\u002Fhaiku-poet-agent.ts` for a complete runless example.\n\n### Runnable Capabilities\n\nRunnable capabilities have a `run` function for custom logic. Each requires:\n\n- `name` - Unique identifier\n- `description` - What it does (helps AI decide when to use it)\n- `inputSchema` - Zod schema defining parameters\n- `run` - Function returning a string\n\n```typescript\nagent.addCapability({\n  name: 'greet',\n  description: 'Greet a user by name',\n  inputSchema: z.object({ name: z.string() }),\n  async run({ args }) {\n    return `Hello, ${args.name}!`\n  }\n})\n```\n\nSee `examples\u002Fcapability-example.ts` for basic capabilities.\n\n> **Note:** The `schema` property still works as an alias for `inputSchema` but is deprecated. Use `inputSchema` for new code.\n\n### Using Agent Methods\n\nAccess `this` in capabilities to use agent methods like `addLogToTask()`, `uploadFile()`, `generate()`, etc.\n\nSee `examples\u002Fcapability-with-agent-methods.ts` for logging and file upload patterns.\n\n---\n\n## Agent Methods\n\n### `generate()` — Platform-Delegated LLM Calls\n\nThe `generate()` method lets you make LLM calls without any API key. The platform performs the call and records usage to the workspace.\n\n```typescript\n\u002F\u002F Text generation\nconst poem = await this.generate({\n  prompt: `Write a short poem about ${args.topic}`,\n  action\n})\n\n\u002F\u002F Structured output (returns validated object matching the schema)\nconst metadata = await this.generate({\n  prompt: `Suggest a title and 3 tags for: ${poem}`,\n  outputSchema: z.object({\n    title: z.string(),\n    tags: z.array(z.string()).length(3)\n  }),\n  action\n})\n\n\u002F\u002F With conversation history\nconst followUp = await this.generate({\n  prompt: 'Suggest a related topic.',\n  messages,  \u002F\u002F conversation history from run function\n  action\n})\n```\n\nParameters:\n- `prompt` (string) — The prompt for the LLM\n- `action` (ActionSchema) — The action context (passed into your `run` function)\n- `outputSchema` (Zod schema, optional) — When provided, returns a validated structured output\n- `messages` (array, optional) — Conversation history for multi-turn generation\n\nThe `action` parameter is required because it identifies the workspace\u002Ftask for billing. Use it inside runnable capabilities where `action` is available from the `run` function arguments.\n\n### Task Management\n\n```typescript\nawait agent.createTask({ workspaceId, assignee, description, body, input, dependencies })\nawait agent.updateTaskStatus({ workspaceId, taskId, status: 'in-progress' })\nawait agent.addLogToTask({ workspaceId, taskId, severity: 'info', type: 'text', body: '...' })\nawait agent.markTaskAsErrored({ workspaceId, taskId, error: 'Something went wrong' })\nconst task = await agent.getTaskDetail({ workspaceId, taskId })\nconst tasks = await agent.getTasks({ workspaceId })\n```\n\n### File Operations\n\n```typescript\nconst files = await agent.getFiles({ workspaceId })\nawait agent.uploadFile({ workspaceId, path: 'output.txt', file: 'content', taskIds: [taskId] })\nawait agent.deleteFile({ workspaceId, fileId })\n```\n\n---\n\n## Action Context\n\nThe `action` parameter in capabilities is a **union type** — `task` only exists on the `'do-task'` variant. Always narrow with a type guard before accessing `action.task`:\n\n```typescript\nasync run({ args, action }) {\n  \u002F\u002F action.task does NOT exist on all action types — you must narrow first\n  if (action?.type === 'do-task' && action.task) {\n    const { workspace, task } = action\n    workspace.id        \u002F\u002F Workspace ID\n    workspace.goal      \u002F\u002F Workspace goal\n    task.id             \u002F\u002F Task ID\n    task.description    \u002F\u002F Task description\n    task.input          \u002F\u002F Task input\n    action.me.id        \u002F\u002F Current agent ID\n  }\n}\n```\n\n**Do not** extract `action?.task?.id` before the type guard — TypeScript will error with `Property 'task' does not exist on type 'ActionSchema'`.\n\n---\n\n## Workflow Name & Goal\n\nThe `workflow` object in `provision()` requires two important properties:\n\n- **`name`** (string) - This becomes the **agent name in ERC-8004**. Make it polished, punchy, and memorable — this is the public-facing brand name users see. Think product launch, not variable name. Examples: `'Crypto Alpha Scanner'`, `'AI Video Studio'`, `'Instant Blog Machine'`.\n- **`goal`** (string, required) - A detailed description of what the workflow accomplishes. Must be descriptive and thorough — short or vague goals will cause API calls to fail. Write at least a full sentence explaining the workflow's purpose.\n\n```typescript\nworkflow: {\n  name: 'Haiku Poetry Generator',  \u002F\u002F Polished display name — the ERC-8004 agent name users see\n  goal: 'Transform any theme or emotion into a beautiful traditional 5-7-5 haiku poem using AI',\n  trigger: triggers.x402({ ... }),\n  task: { description: 'Generate a haiku about the given topic' }\n}\n```\n\n---\n\n## Trigger Types\n\n```typescript\nimport { triggers } from '@openserv-labs\u002Fclient'\n\ntriggers.webhook({ waitForCompletion: true, timeout: 600 })\ntriggers.x402({ name: '...', description: '...', price: '0.01', timeout: 600 })\ntriggers.cron({ schedule: '0 9 * * *' })\ntriggers.manual()\n```\n\n> **Important:** Always set `timeout` to at least **600 seconds** (10 minutes) for webhook and x402 triggers. Agents often take significant time to process requests — especially when performing research, content generation, or other complex tasks. A low timeout will cause premature failures. For multi-agent pipelines with many sequential steps, consider 900 seconds or more.\n\n## API Keys: Agent vs User\n\n`provision()` creates two types of credentials. They are **not interchangeable**:\n\n- **`OPENSERV_API_KEY`** (Agent API key) — Used internally by the SDK to authenticate when receiving tasks. Set automatically by `provision()` when you pass `agent.instance`. **Do not** use this key with `PlatformClient`.\n- **`WALLET_PRIVATE_KEY`** \u002F **`OPENSERV_USER_API_KEY`** (User credentials) — Used with `PlatformClient` to make management calls (list tasks, debug workflows, etc.). Authenticate with `client.authenticate(walletKey)` or pass `apiKey` to the constructor.\n\nIf you need to debug tasks or inspect workflows, use wallet authentication:\n\n```typescript\nconst client = new PlatformClient()\nawait client.authenticate(process.env.WALLET_PRIVATE_KEY)\nconst tasks = await client.tasks.list({ workflowId: result.workflowId })\n```\n\nSee `troubleshooting.md` for details on 401 errors.\n\n---\n\n## Deployment\n\n### Local Development\n\n```bash\nnpm run dev\n```\n\nThe `run()` function automatically:\n\n- Starts the agent HTTP server (port 7378, with automatic fallback)\n- Connects via WebSocket to `agents-proxy.openserv.ai`\n- Routes platform requests to your local machine\n\n**No need for ngrok or other tunneling tools** - `run()` handles this seamlessly. Just call `run(agent)` and your local agent is accessible to the platform.\n\n### Production\n\nWhen deploying to a hosting provider like Cloud Run, set `DISABLE_TUNNEL=true` as an environment variable. This makes `run()` start only the HTTP server without opening a WebSocket tunnel — the platform reaches your agent directly at its public URL.\n\n```typescript\nawait provision({\n  agent: {\n    name: 'my-agent',\n    description: '...',\n    endpointUrl: 'https:\u002F\u002Fmy-agent.example.com' \u002F\u002F Required for production\n  },\n  workflow: {\n    name: 'Lightning Service Pro',\n    goal: 'Describe in detail what this workflow does — be thorough, vague goals cause failures',\n    trigger: triggers.webhook({ waitForCompletion: true, timeout: 600 }),\n    task: { description: 'Process incoming requests' }\n  }\n})\n\n\u002F\u002F With DISABLE_TUNNEL=true, run() starts only the HTTP server (no tunnel)\nawait run(agent)\n```\n\n---\n\n## ERC-8004: On-Chain Agent Identity\n\nAfter provisioning, register your agent on-chain for discoverability via the Identity Registry.\n\n> **Requires ETH on Base.** Registration calls `register()` on the ERC-8004 contract on **Base mainnet (chain 8453)**, which costs gas. The wallet created by `provision()` starts with a zero balance. Fund it with a small amount of ETH on Base before the first registration attempt. The wallet address is logged during provisioning (`Created new wallet: 0x...`).\n\n> **Always wrap in try\u002Fcatch** so a registration failure (e.g. unfunded wallet) doesn't prevent `run(agent)` from starting.\n\nTwo important patterns:\n\n1. **Use `dotenv` programmatically** (not `import 'dotenv\u002Fconfig'`) so you can reload `.env` after `provision()` writes `WALLET_PRIVATE_KEY`.\n2. **Call `dotenv.config({ override: true })` after `provision()`** to pick up the freshly written key before ERC-8004 registration.\n\n```typescript\nimport dotenv from 'dotenv'\ndotenv.config()\n\nimport { Agent, run } from '@openserv-labs\u002Fsdk'\nimport { provision, triggers, PlatformClient } from '@openserv-labs\u002Fclient'\n\n\u002F\u002F ... define agent and capabilities ...\n\nconst result = await provision({\n  agent: { instance: agent, name: 'my-agent', description: '...' },\n  workflow: {\n    name: 'My Service',\n    goal: 'Detailed description of what the workflow does',\n    trigger: triggers.x402({ name: 'My Service', description: '...', price: '0.01', timeout: 600 }),\n    task: { description: 'Process requests' }\n  }\n})\n\n\u002F\u002F Reload .env to pick up WALLET_PRIVATE_KEY written by provision()\ndotenv.config({ override: true })\n\n\u002F\u002F Register on-chain (non-blocking — requires funded wallet on Base)\ntry {\n  const client = new PlatformClient()\n  await client.authenticate(process.env.WALLET_PRIVATE_KEY)\n\n  const erc8004 = await client.erc8004.registerOnChain({\n    workflowId: result.workflowId,\n    privateKey: process.env.WALLET_PRIVATE_KEY!,\n    name: 'My Service',\n    description: 'What this agent does'\n  })\n\n  console.log(`Agent ID: ${erc8004.agentId}`) \u002F\u002F \"8453:42\"\n  console.log(`TX: ${erc8004.blockExplorerUrl}`)\n  console.log(`Scan: ${erc8004.scanUrl}`) \u002F\u002F \"https:\u002F\u002Fwww.8004scan.io\u002Fagents\u002Fbase\u002F42\"\n} catch (error) {\n  console.warn('ERC-8004 registration skipped:', error instanceof Error ? error.message : error)\n}\n\nawait run(agent)\n```\n\n- **First run** mints a new identity NFT. **Re-runs update the URI** — agent ID stays the same.\n- **Never clear the wallet state** unless you intentionally want a new agent ID. To update metadata, just re-run.\n- Default chain: Base mainnet (8453). Pass `chainId` \u002F `rpcUrl` for others.\n\nSee **openserv-client** skill for the full ERC-8004 API reference and troubleshooting.\n\n---\n\n## DO NOT USE\n\n- **`this.process()`** inside capabilities — Legacy method requiring an OpenAI API key. Use `this.generate()` instead (platform-delegated, no key needed), or use runless capabilities\n- **`doTask` override** — The SDK handles task execution automatically\n- **`this.completeTask()`** — Task completion is handled by the Runtime API\n\n---\n\n## Updating This Skill\n\nThis skill may be outdated. The OpenServ team ships updates regularly—new features, API changes, and bug fixes won't be reflected here until you update. **If something isn't working as expected, or you want to make sure you have the latest information, update the skill before proceeding.**\n\n```bash\n# Check if updates are available\nnpx skills check\n\n# Update all installed skills to latest versions\nnpx skills update\n```\n\nOr reinstall the OpenServ skills directly:\n\n```bash\nnpx skills add openserv-labs\u002Fskills\n```\n\n---\n\n## Related Skills\n\n- **openserv-client** - Full Platform Client API reference\n- **openserv-multi-agent-workflows** - Multi-agent collaboration patterns\n- **openserv-launch** - Launch tokens on Base blockchain\n- **openserv-ideaboard-api** - Find ideas and ship agent services on the Ideaboard\n",{"name":5,"description":7},"main","f9d3fe7cf9ac8f1ea63a0d96e98e1f510a3814db","skills\u002Fissa-me-sush\u002Fopenserv-agent-sdk",1,"https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills","https:\u002F\u002Fgithub.com\u002Fjavimosch","intrane.fr","Building robust, open-source infrastructure for the commons. AI-leveraged, self-hosted, built to last.","2026-06-07 03:34:58",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add javimosch\u002Fopen-claw-skills --skill openserv-agent-sdk",{"tool":39,"command":40},"bunx","bunx skills add javimosch\u002Fopen-claw-skills --skill openserv-agent-sdk",{"tool":42,"command":43},"pnpm","pnpm dlx skills add javimosch\u002Fopen-claw-skills --skill openserv-agent-sdk","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fissa-me-sush\u002Fopenserv-agent-sdk\u002FSKILL.md",true,[],[48,56,63,70,77,84],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":55},"01M778GGXG2VQ0YF31W2MKGMQZ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":55},"01M778G7BH8SBJ9FJ6C3G7CB1K","ceaser","Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir\u002FUltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":55},"01M778FYCJQZWFKKX5FYMK3S47","ceaser-send","Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir\u002FUltraHonk zero-knowledge proofs.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser-send\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":55},"01M778FQQNSEYA3HJKZBPQ4M9Z","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":55},"01M778FGVZX7QA2TF9BFMM37FY","moldium","Post and manage content on the Moldium blog platform. Triggered by \"post to Moldium\", \"write a blog post\", \"publish an article\", etc.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyom45\u002Fmoldium\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":55},"01M778F88D8PQ9MQ0KNW2TJ8ZH","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http:\u002F\u002Fweakaccept.top:8000\u002F.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[]]