internet-court/internet-court-skill / vendored/openserv/openserv-client
openserv-client
VerifiedComplete guide to using @openserv-labs/client for managing agents, workflows, triggers, and tasks on the OpenServ Platform. Covers provisioning, authentication, x402 payments, ERC-8004 on-chain identity, and the full Platform API. IMPORTANT - Always read the companion skill openserv-agent-sdk alongside this skill, as both packages are required to build any agent. Read reference.md for the full API reference.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 346 B |
| SKILL.md | skill md | 17.1 KB |
| examples/agent.ts | script | 1.6 KB |
| examples/cleanup.ts | script | 2.8 KB |
| examples/create-agent.ts | script | 2.8 KB |
| examples/env.example | other | 483 B |
| reference.md | markdown | 18.1 KB |
| troubleshooting.md | markdown | 3.3 KB |
examples/create-agent.ts
View on GitHub/**
* Create Agent Example
*
* Demonstrates using PlatformClient directly for more control.
* Run with: npx tsx create-agent.ts
*/
import 'dotenv/config'
import { PlatformClient, triggers } from '@openserv-labs/client'
async function createAgent() {
// Initialize client
const client = new PlatformClient()
// Authenticate with wallet
await client.authenticate(process.env.WALLET_PRIVATE_KEY)
console.log('✅ Authenticated')
// Create agent (with optional model_parameters)
const agent = await client.agents.create({
name: 'my-custom-agent',
capabilities_description: 'Processes data and generates reports',
endpoint_url: 'https://my-agent.example.com',
model_parameters: { model: 'gpt-4o', temperature: 0.5, parallel_tool_calls: false }
})
console.log(`✅ Created agent: ${agent.id}`)
// Get API key
const apiKey = await client.agents.getApiKey({ id: agent.id })
console.log(`✅ API key: ${apiKey.slice(0, 8)}...`)
// Generate auth token for security
const { authToken, authTokenHash } = await client.agents.generateAuthToken()
await client.agents.saveAuthToken({ id: agent.id, authTokenHash })
console.log(`✅ Auth token saved`)
// Create workflow
const workflow = await client.workflows.create({
name: 'Instant AI Concierge',
goal: 'Receive incoming requests, analyze and process them with AI, and return structured responses',
agentIds: [agent.id]
})
console.log(`✅ Created workflow: ${workflow.id}`)
// Create trigger
const connId = await client.integrations.getOrCreateConnection('webhook-trigger')
const trigger = await client.triggers.create({
workflowId: workflow.id,
name: 'API Endpoint',
integrationConnectionId: connId,
props: {
waitForCompletion: true,
timeout: 600,
inputSchema: {
$schema: 'http://json-schema.org/draft-07/schema#',
type: 'object',
properties: { data: { type: 'string', title: 'Input Data' } },
required: ['data']
}
}
})
console.log(`✅ Created trigger: ${trigger.id}`)
// Create task
await client.tasks.create({
workflowId: workflow.id,
agentId: agent.id,
description: 'Process the incoming request',
body: 'Handle the request and return results'
})
console.log(`✅ Created task`)
// Activate
await client.triggers.activate({ workflowId: workflow.id, id: trigger.id })
await workflow.setRunning()
console.log(`✅ Workflow running`)
console.log('\n' + '='.repeat(50))
console.log('Setup complete!')
console.log(`Webhook: https://api.openserv.ai/webhooks/trigger/${trigger.token}`)
console.log('='.repeat(50))
// Return info for .env
return {
agentId: agent.id,
apiKey,
authToken,
workflowId: workflow.id,
triggerToken: trigger.token
}
}
createAgent().catch(err => {
console.error('Error:', err.message)
process.exit(1)
})
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 |