openserv-agent-sdk
Skill này làm gì
Skill này hướng dẫn xây agent AI bằng OpenServ Agent SDK viết trên TypeScript. Skill dành cho lập trình viên muốn agent của mình chạy trên nền tảng OpenServ và nhận công việc từ các workflow.
Khi nào nên dùng
- ✓Khi bạn muốn xây một agent AI tùy chỉnh chạy trên nền tảng OpenServ.
- ✓Khi agent cần các khả năng có schema và hàm run.
- ✓Khi bạn cần agent được kích hoạt bởi workflow, các agent khác hoặc các lệnh gọi có phí.
Liên kết skill
https://github.com/internet-court/internet-court-skill/blob/main/vendored/openserv/openserv-agent-sdk/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy giúp tôi xây một agent TypeScript cho OpenServ để trả lời câu hỏi về danh mục sản phẩm của tôi.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent định nghĩa system prompt và các khả năng, rồi đăng ký agent với nền tảng. Khả năng có thể là mã chạy được, hoặc là khả năng không cần chạy mã mà nền tảng xử lý bằng lệnh gọi AI riêng của nó.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
OpenServ Agent SDK
Build and deploy custom AI agents for the OpenServ platform using TypeScript.
Why build an agent?
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).
How it works (the flow)
- Define your agent — System prompt plus capabilities. Capabilities come in two flavors: runnable (with a Zod schema and a
runhandler) and runless (just a name and description—the platform handles the AI call automatically). You can also usegenerate()inside runnable capabilities to delegate LLM calls to the platform. - 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). Callprovision()(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 passagent.instanceto bind them directly). In development you can skip setting an endpoint URL; the SDK can use a built-in tunnel to the platform. - Start the agent — Call
run(agent). The agent listens for tasks, runs your capabilities (and your LLM if you use one), and responds. Usereference.mdandtroubleshooting.mdfor details;examples/has full runnable code.
What your agent can do
- Runless Capabilities — Just a name and description. The platform handles the AI call automatically—no API key, no
run()function needed. Optionally defineinputSchemaandoutputSchemafor structured I/O. - Runnable Capabilities — The tools your agent can run (e.g. search, transform data, call APIs). Each has a name, description,
inputSchema, andrun()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.- Task context — When running in a task, the agent can attach logs and uploads to that task via methods like
addLogToTask()anduploadFile(). - 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.
Reference: reference.md (patterns) · troubleshooting.md (common issues) · examples/ (full examples)
Quick Start
Installation
npm install @openserv-labs/sdk @openserv-labs/client zod
Note:
openaiis only needed if you use theprocess()method for direct OpenAI calls. Most agents don't need it—use runless capabilities orgenerate()instead.
Minimal Agent
See examples/basic-agent.ts for a complete runnable example.
The pattern is simple:
- Create an
Agentwith a system prompt - Add capabilities with
agent.addCapability() - Call
provision()to register on the platform (passagent.instanceto bind credentials) - Call
run(agent)to start
Complete Agent Template
File Structure
my-agent/
├── src/agent.ts
├── .env
├── .gitignore
├── package.json
└── tsconfig.json
Dependencies
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"inpackage.json. Add a"dev": "tsx src/agent.ts"script for local development. Only installopenaiif you use theprocess()method for direct OpenAI calls.
.env
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 # I
Câu hỏi thường gặp
Tôi có bắt buộc phải dùng LLM không?
Không. Skill cho biết agent có thể chỉ là một API đơn giản trả về dữ liệu mà không cần LLM.
Tôi có cần gói client không?
Có. Skill yêu cầu đọc skill openserv-client đi kèm, vì cần cả hai gói.
Đăng ký hoạt động thế nào?
Skill mô tả một hàm provision có thể tạo tài khoản từ ví và đăng ký agent.
Chi tiết
Mô tả gốc của tác giả
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.
Độ phổ biến
- Sao GitHub
- 7.0k
- Vị trí xếp hạng
- #13667
- Giấy phép
- —
- Cập nhật
- 26/10/2026
Bình luận
- …
Thêm skill từ kho mã này
internet-court
7.0kGiúp agent của bạn thanh toán, thuê hoặc giao dịch an toàn với một agent AI khác hoặc dịch vụ trả phí, và chỉ đến hướng dẫn chuyên sâu phù hợp.
genlayer-erc7710-connector
7.0kGiúp agent của bạn kết nối kết quả đánh giá AI với hệ thống quyền hạn, để một đánh giá xấu có thể hạn chế hoặc hủy quyền của agent.
genlayer-intelligent-contracts
7.0kGiúp agent của bạn xác định quy tắc, bằng chứng và đầu ra của một AI judge kiểm tra xem agent khác có làm đúng nhiệm vụ được ủy quyền hay không.
x402-erc7710
7.0kGiúp agent của bạn trả tiền cho dịch vụ web theo từng yêu cầu, và thiết lập chi tiêu định kỳ nằm trong ngân sách quyền hạn.
Skill tương tự
add-model-provider
394kGiúp agent của bạn kết nối nhà cung cấp mô hình AI mới với OpenClaw bằng lệnh an toàn, giữ API key khỏi văn bản thuần và chạy thử.
acp-router
394kGiúp agent của bạn gửi một tác vụ đến trợ lý lập trình như Claude Code hoặc Cursor qua OpenClaw, để công việc chạy ngay trong công cụ đó.
browser-automation
394kHướng dẫn agent của bạn điều khiển trang web từng bước, gồm đăng nhập, tab và cách khôi phục khi trang ngừng phản hồi.