展示HN:Skrun – 将任何代理技能部署为API
Show HN: Skrun – Deploy any agent skill as an API

原始链接: https://github.com/skrun-dev/skrun

## Skrun:将代理技能转化为API Skrun是一个开源工具,用于部署和调用AI代理技能作为API。它允许你轻松地将指令(定义在`SKILL.md`中)和配置(`agent.yaml`)转化为可通过`POST /run`端点调用的服务。 **主要特性:** * **简单部署:** 使用`skrun init`创建新的代理或导入现有技能,然后使用`skrun deploy`使其可通过API访问。 * **多模型支持:** 支持Anthropic、OpenAI、Google、Mistral和Groq,并具有自动回退功能。 * **有状态代理:** 代理可以使用键值状态在多次运行中记住信息。 * **工具调用:** 支持本地CLI工具和MCP服务器,以扩展功能。 * **类型化I/O:** 定义结构化输入和输出,以实现可靠的API交互。 Skrun提供了一个本地开发服务器(`skrun dev`)用于测试,以及一个CLI用于管理代理、构建和部署。示例展示了各种应用,例如代码审查、PDF处理和数据分析。云部署正在计划中,基于现成的架构。

相关文章

原文

Skrun — Deploy any Agent Skill as an API

CI npm License


Turn any Agent Skill (SKILL.md) into a callable API via POST /run. Multi-model, stateful, open source.

npm install -g @skrun-dev/cli
# Import an existing skill → deploy → call
skrun init --from-skill ./my-skill
skrun deploy

curl -X POST localhost:4000/api/agents/dev/my-skill/run \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"input": {"query": "analyze this"}}'
skrun init my-agent
cd my-agent
# Creates SKILL.md (instructions) + agent.yaml (config)
skrun init --from-skill ./path-to-skill
# Reads SKILL.md, asks 2-3 questions, generates agent.yaml
skrun dev
# ✓ Server running at http://localhost:3000
# POST /run ready — watching for changes...
skrun test
# ✓ basic-test (output.score >= 0)
# 1 passed, 0 failed
skrun deploy
# ✓ Validated → Built → Pushed
# 🚀 POST http://localhost:4000/api/agents/you/my-agent/run

v0.1 ships with a local runtime. Cloud deploy is on the roadmap — the architecture is ready (RuntimeAdapter interface).

  • Agent Skills — SKILL.md standard, compatible with Claude Code, Copilot, Codex
  • agent.yaml — Runtime config: model, inputs/outputs, permissions, state, tests
  • POST /run — Every agent is an API. Typed inputs, structured outputs.
  • Multi-model — Anthropic, OpenAI, Google, Mistral, Groq with automatic fallback
  • Stateful — Agents remember across runs via key-value state
  • Tool calling — Two approaches: CLI tools (scripts/ — write your own, bundled with the agent) and MCP servers (npxstandard ecosystem, same as Claude Desktop)

All examples use Google Gemini Flash by default. Change the model section in agent.yaml to use any supported provider.

Agent What it shows
code-review Import a skill, get a code quality API
pdf-processing Tool calling with local scripts
seo-audit Stateful — run twice, it remembers and compares
data-analyst Typed I/O — CSV in, structured insights out
email-drafter Business use case — non-dev API consumer
web-scraper MCP server — headless browser via @playwright/mcp
# 1. Start the registry
cp .env.example .env          # add your GOOGLE_API_KEY
pnpm dev:registry              # keep this terminal open

# 2. In another terminal
skrun login --token dev-token
cd examples/code-review
skrun build && skrun push

# 3. Call the agent
curl -X POST http://localhost:4000/api/agents/dev/code-review/run \
  -H "Authorization: Bearer dev-token" \
  -H "Content-Type: application/json" \
  -d '{"input": {"code": "function add(a,b) { return a + b; }"}}'

Windows (PowerShell): use curl.exe instead of curl, and use @input.json for the body.

Command Description
skrun init [dir] Create a new agent
skrun init --from-skill <path> Import existing skill
skrun dev Local server with POST /run
skrun test Run agent tests
skrun build Package .agent bundle
skrun deploy Build + push + live URL
skrun push / pull Registry upload/download
skrun login / logout Authentication
skrun logs <agent> Execution logs

Full CLI reference →

git clone https://github.com/skrun-dev/skrun.git
cd skrun
pnpm install && pnpm build && pnpm test

See CONTRIBUTING.md for conventions and setup.

MIT

联系我们 contact @ memedata.com