internet-court/internet-court-skill / vendored/openserv/openserv-multi-agent-workflows
openserv-multi-agent-workflows
VerifiedMulti-agent workflow examples to work together on the OpenServ Platform. Covers agent discovery, multi-agent workspaces, task dependencies, and workflow orchestration using the Platform Client. Read reference.md for the full API reference. Read openserv-agent-sdk and openserv-client for building and running agents.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 346 B |
| SKILL.md | skill md | 6.8 KB |
| examples/blog-pipeline.md | markdown | 7.7 KB |
| examples/content-creation-pipeline.md | markdown | 7.0 KB |
| examples/crypto-alpha-pipeline.md | markdown | 6.1 KB |
| examples/life-coaching-pipeline.md | markdown | 11.8 KB |
| examples/paid-image-pipeline.md | markdown | 5.6 KB |
| examples/podcast-production-line.md | markdown | 6.3 KB |
| examples/polymarket-intelligence.md | markdown | 6.2 KB |
| examples/social-media-pipeline.md | markdown | 6.3 KB |
| examples/tokenomics-design-pipeline.md | markdown | 6.8 KB |
| examples/video-content-factory.md | markdown | 6.0 KB |
| examples/youtube-to-blog-pipeline.md | markdown | 6.4 KB |
| reference.md | markdown | 6.8 KB |
| troubleshooting.md | markdown | 5.3 KB |
examples/paid-image-pipeline.md
View on GitHub# Paid Image Pipeline Example
A 2-agent workflow using `provision()` with x402 monetization: a custom agent acknowledges a message, then a marketplace image agent generates a visual.
## Pipeline
```mermaid
flowchart LR
T["x402 Trigger (paid)"] --> A[Custom Agent]
A --> B[Image Agent]
```
## Complete Agent Code
### Project Structure
```
paid-image-pipeline/
├── src/
│ └── agent.ts
├── .env
├── package.json
└── tsconfig.json
```
### .env
```env
OPENAI_API_KEY=your-openai-key
# Auto-populated by provision():
WALLET_PRIVATE_KEY=
```
### Dependencies
```bash
npm init -y && npm pkg set type=module
npm i @openserv-labs/sdk @openserv-labs/client dotenv openai 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.
### src/agent.ts
```typescript
import 'dotenv/config'
import { Agent, run } from '@openserv-labs/sdk'
import { provision, triggers } from '@openserv-labs/client'
import { z } from 'zod'
const IMAGE_AGENT_ID = 1044 // Nano Banana Pro Agent (from marketplace)
const agent = new Agent({
systemPrompt:
'You are a concise agent. When a user sends you any message, respond with "Roger that".'
})
agent.addCapability({
name: 'roger-that',
description: 'Acknowledge any message with "Roger that"',
schema: z.object({
message: z.string().describe('The incoming message')
}),
async run({ args }) {
console.log(`Received: ${args.message}`)
return 'Roger that'
}
})
async function main() {
const result = await provision({
agent: {
instance: agent,
name: 'roger-that',
description: 'Acknowledges messages with "Roger that"'
},
workflow: {
name: 'Roger That Image',
goal: 'Acknowledge user messages and generate a bold, eye-catching "Roger that" image in response',
trigger: triggers.x402({
name: 'Roger That Image',
description: 'Send any message and get a "Roger that" image',
price: '0.01',
timeout: 600,
input: {
message: {
type: 'string',
title: 'Your Message',
description: 'Say anything'
}
}
}),
tasks: [
{
name: 'acknowledge',
description: 'Read the user message and respond with "Roger that" using the roger-that capability',
input: '{{trigger.message}}'
// No agentId -- defaults to the provisioned agent
},
{
name: 'generate-image',
description: 'Generate a bold image that says "Roger that" in a confident, eye-catching style',
agentId: IMAGE_AGENT_ID // Marketplace agent
}
]
// No edges needed -- sequential edges auto-generated:
// trigger -> acknowledge -> generate-image
// No agentIds needed -- derived from tasks automatically
}
})
console.log(`Agent ID: ${result.agentId}`)
console.log(`Paywall: ${result.paywallUrl}`)
await run(agent)
}
main().catch(console.error)
```
## How It Works
1. `provision()` registers the custom agent on the platform
2. It creates a multi-agent workflow with:
- **x402 trigger** -- paid paywall at $0.01 per request
- **Task 1** (custom agent) -- acknowledges the message with "Roger that"
- **Task 2** (Nano Banana Pro) -- generates an image based on the acknowledgment
3. `x402WalletAddress` is auto-injected from the provisioned wallet (no manual setup)
4. `agentIds` are derived from tasks (no need to specify `[agentId, 1044]` manually)
5. Sequential edges are auto-generated: trigger -> acknowledge -> generate-image
6. `run(agent)` starts the local agent with built-in tunnel
## Adding ERC-8004 On-Chain Registration
Add on-chain identity after provisioning so the agent is discoverable via the Identity Registry. **Requires ETH on Base** for gas. Always wrap in try/catch so failures don't prevent `run(agent)` from starting. Reload `.env` after `provision()` to pick up the freshly written `WALLET_PRIVATE_KEY`.
```typescript
import { PlatformClient } from '@openserv-labs/client'
// ... after provision(), before run():
// Reload .env to pick up WALLET_PRIVATE_KEY written by provision()
dotenv.config({ override: true })
try {
const client = new PlatformClient()
await client.authenticate(process.env.WALLET_PRIVATE_KEY)
const erc8004 = await client.erc8004.registerOnChain({
workflowId: result.workflowId,
privateKey: process.env.WALLET_PRIVATE_KEY!,
name: 'Roger That Image',
description: 'Send any message and get a "Roger that" image',
})
console.log(`ERC-8004 Agent ID: ${erc8004.agentId}`)
console.log(`Block Explorer: ${erc8004.blockExplorerUrl}`)
console.log(`Scan: ${erc8004.scanUrl}`)
} catch (error) {
console.warn('ERC-8004 registration skipped:', error instanceof Error ? error.message : error)
}
await run(agent)
```
**Re-runs update the agent card URI** — the agent ID stays the same. Never clear the wallet state unless you intentionally want a new on-chain identity.
## Key Points
1. **No manual wallet injection**: `provision()` handles `x402WalletAddress` automatically via `client.resolveWalletAddress()`
2. **No manual agentIds**: Derived from `tasks[].agentId` automatically
3. **No manual edges**: Sequential edges are auto-generated when no explicit edges are provided
4. **Backward compatible**: The `task` shorthand (single task) still works for simple agents
5. **Idempotent**: Re-running `npm run dev` updates the existing workflow via `sync()` rather than creating duplicates
6. **ERC-8004 re-deploy**: `registerOnChain` detects existing agent and calls `setAgentURI` instead of minting new
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 198k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |