Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计提醒

open-agent-sdkopen Agent SDK 搜索

Agent Skill

open-agent-sdk 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

11,184

周安装

466

GitHub Stars

39

下载量

3,728
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:open-agent-sdk(open Agent SDK 搜索)
来源仓库:https://github.com/aradotso/trending-skills
仓库路径:skills/open-agent-sdk
安装命令:
npx skills add https://github.com/aradotso/trending-skills --skill open-agent-sdk
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/aradotso/trending-skills --skill open-agent-sdk

简介

open-agent-sdk 用于查找和筛选相关信息。

  • 适合根据关键词快速定位候选结果。
  • 可结合任务场景调整检索策略。open-agent-sdk 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 安装前建议确认权限和维护状态。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。
  • 注意可能触发的网络请求和数据访问。

SKILL.md

Open Agent SDK

Skill by ara.so — Daily 2026 Skills collection.

Open Agent SDK (@shipany/open-agent-sdk) is a fully open-source, in-process AI agent framework for TypeScript/Node.js. It runs the complete Claude Code agent engine directly — no local CLI subprocess required — making it suitable for cloud servers, serverless functions, Docker containers, and CI/CD pipelines. It is API-compatible with @anthropic-ai/claude-agent-sdk.


Installation

npm install @shipany/open-agent-sdk

Requires Node.js 18+.


Authentication & Configuration

Set the Anthropic API key as an environment variable:

export ANTHROPIC_API_KEY=your-api-key

Or use a third-party provider (e.g. OpenRouter):

export ANTHROPIC_BASE_URL=https://openrouter.ai/api
export ANTHROPIC_API_KEY=your-openrouter-key
export ANTHROPIC_MODEL=anthropic/claude-sonnet-4-6

These can also be passed programmatically via options.env or apiKey/baseURL in createAgent().


Core API

query({prompt, options}) — Streaming, compatible with official SDK

Returns an AsyncGenerator<SDKMessage>. Drop-in replacement for @anthropic-ai/claude-agent-sdk.

import { query } from '@shipany/open-agent-sdk'

for await (const message of query({
  prompt: 'Find and fix the bug in auth.ts',
  options: {
    allowedTools: ['Read', 'Edit', 'Bash'],
    permissionMode: 'acceptEdits',
  },
})) {
  if (message.type === 'assistant' && message.message?.content) {
    for (const block of message.message.content) {
      if ('text' in block) process.stdout.write(block.text)
      else if ('name' in block) console.log(`\n[Tool used: ${block.name}]`)
    }
  } else if (message.type === 'result') {
    console.log(`\nDone: ${message.subtype}`)
  }
}

createAgent(options) — Reusable agent with session state

import { createAgent } from '@shipany/open-agent-sdk'

const agent = createAgent({
  model: 'claude-sonnet-4-6',
  systemPrompt: 'You are a senior TypeScript engineer. Be concise.',
  maxTurns: 20,
})

// Blocking call
const result = await agent.prompt('Read package.json and describe the project')
console.log(result.text)
console.log(`Tokens used: ${result.usage.input_tokens + result.usage.output_tokens}`)

// Streaming call
for await (const msg of agent.query('Now add JSDoc to all exported functions')) {
  if (msg.type === 'assistant' && msg.message?.content) {
    for (const block of msg.message.content) {
      if ('text' in block) process.stdout.write(block.text)
    }
  }
}

// Session management
const history = agent.getMessages()  // full conversation history
agent.clear()                        // reset session

Options Reference

OptionTypeDefaultDescription
modelstringclaude-sonnet-4-6Claude model ID
apiKeystringANTHROPIC_API_KEY envAPI key
baseURLstringAnthropic APIOverride for third-party providers
cwdstringprocess.cwd()Working directory for file/shell tools
systemPromptstringCustom system prompt prepended to agent
toolsTool[]All built-inOverride the full tool list
allowedToolsstring[]allWhitelist specific tools by name
permissionModestringbypassPermissionsacceptEdits, bypassPermissions, plan, default
maxTurnsnumber100Maximum agentic loop iterations
maxBudgetUsdnumberSpend cap in USD
mcpServersobjectMCP server configs (stdio/SSE/HTTP)
agentsobjectNamed subagent definitions
hooksobjectLifecycle hooks: PreToolUse, PostToolUse, Stop
thinkingobjectExtended thinking config
envobjectEnvironment variables passed to tools
resumestringResume prior session by session ID
canUseToolfunctionCustom permission callback (tool, input) => boolean
includePartialMessagesbooleanfalseEmit raw streaming events

Common Patterns

Multi-turn conversation with context

import { createAgent } from '@shipany/open-agent-sdk'

const agent = createAgent({ model: 'claude-sonnet-4-6' })

const r1 = await agent.prompt('Read src/index.ts and explain the architecture')
console.log(r1.text)

// Context from r1 is preserved automatically
const r2 = await agent.prompt('Refactor the error handling to use a Result type')
console.log(r2.text)

Restrict to read-only tools

import { query } from '@shipany/open-agent-sdk'

for await (const message of query({
  prompt: 'Review this codebase for security issues',
  options: {
    allowedTools: ['Read', 'Glob', 'Grep'],
    // No Write, Edit, or Bash — agent cannot modify files
  },
})) {
  if (message.type === 'result') console.log('Review complete')
}

Custom tools

import { createAgent, getAllBaseTools } from '@shipany/open-agent-sdk'

const dbQueryTool = {
  name: 'QueryDatabase',
  description: 'Run a read-only SQL query and return results as JSON',
  inputJSONSchema: {
    type: 'object',
    properties: {
      sql: { type: 'string', description: 'The SQL query to run' },
    },
    required: ['sql'],
  },
  get inputSchema() {
    return { safeParse: (v: unknown) => ({ success: true, data: v }) }
  },
  async prompt() { return this.description },
  async call(input: { sql: string }) {
    // Replace with your actual DB client
    const rows = [{ id: 1, name: 'Example' }]
    return { data: JSON.stringify(rows) }
  },
  userFacingName: () => 'QueryDatabase',
  isReadOnly: () => true,
  isConcurrencySafe: () => true,
  mapToolResultToToolResultBlockParam: (data: string, id: string) => ({
    type: 'tool_result' as const,
    tool_use_id: id,
    content: data,
  }),
}

const agent = createAgent({
  tools: [...getAllBaseTools(), dbQueryTool],
})

const result = await agent.prompt('How many users signed up in the last 7 days?')
console.log(result.text)

MCP server integration

import { createAgent } from '@shipany/open-agent-sdk'

const agent = createAgent({
  mcpServers: {
    filesystem: {
      command: 'npx',
      args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
    },
    playwright: {
      command: 'npx',
      args: ['@playwright/mcp@latest'],
    },
  },
})

const result = await agent.prompt('List all .json files in /tmp')
console.log(result.text)

Subagents for parallel / delegated work

import { query } from '@shipany/open-agent-sdk'

for await (const message of query({
  prompt: 'Use the security-auditor agent to audit src/ for vulnerabilities',
  options: {
    allowedTools: ['Read', 'Glob', 'Grep', 'Agent'],
    agents: {
      'security-auditor': {
        description: 'Expert security auditor for TypeScript codebases.',
        prompt: 'Identify OWASP Top 10 vulnerabilities and suggest fixes.',
        tools: ['Read', 'Glob', 'Grep'],
      },
    },
  },
})) {
  if (message.type === 'assistant' && message.message?.content) {
    for (const block of message.message.content) {
      if ('text' in block) console.log(block.text)
    }
  }
}

Custom permission callback

import { createAgent } from '@shipany/open-agent-sdk'

const agent = createAgent({
  canUseTool: (toolName: string, input: unknown) => {
    // Prevent deletion commands
    if (toolName === 'Bash') {
      const cmd = (input as { command?: string }).command ?? ''
      if (cmd.includes('rm ') || cmd.includes('drop table')) return false
    }
    return true
  },
})

Lifecycle hooks

import { createAgent } from '@shipany/open-agent-sdk'

const agent = createAgent({
  hooks: {
    PreToolUse: async ({ tool, input }) => {
      console.log(`About to run tool: ${tool} with input:`, input)
    },
    PostToolUse: async ({ tool, output }) => {
      console.log(`Tool ${tool} finished`)
    },
    Stop: async ({ result }) => {
      console.log('Agent stopped. Final result:', result)
    },
  },
})

Resume a previous session

import { createAgent } from '@shipany/open-agent-sdk'

// First session
const agent1 = createAgent({ model: 'claude-sonnet-4-6' })
const r1 = await agent1.prompt('Read ARCHITECTURE.md')
const sessionId = r1.sessionId  // save this

// Later — resume where you left off
const agent2 = createAgent({
  model: 'claude-sonnet-4-6',
  resume: sessionId,
})
const r2 = await agent2.prompt('Now implement the TODO in section 3')

Built-in Tools Reference

ToolRead-onlyDescription
ReadRead files, images, PDFs with line numbers
GlobFind files by glob pattern
GrepSearch file contents with regex (uses ripgrep)
WebFetchFetch and parse web pages
WebSearchWeb search
WriteCreate or overwrite files
EditPrecise string replacement in files
BashExecute shell commands
AgentSpawn subagents
TodoWriteManage todo lists
NotebookEditEdit Jupyter notebooks
TaskCreate/Update/ListTask management
TeamCreate/DeleteAgent team management
EnterPlanMode/ExitPlanModePlan approval workflow
EnterWorktree/ExitWorktreeGit worktree isolation
ListMcpResources/ReadMcpResourceMCP resource access

Architecture: How It Differs from Official SDK

Official @anthropic-ai/claude-agent-sdk:

Your code → SDK → spawn cli.js subprocess → stdin/stdout JSON → Anthropic API

Open Agent SDK:

Your code → SDK → QueryEngine (in-process) → Anthropic API (direct HTTP)

This means:

  • No CLI installation required in the deployment environment
  • Works in serverless (AWS Lambda, Vercel, Cloudflare Workers with Node.js compat)
  • Works in Docker with just npm install
  • Works in CI/CD without CLI setup steps
  • Programmatic access to the full agent engine

Troubleshooting

Error: ANTHROPIC_API_KEY is not set → Export the env var or pass apiKey directly in createAgent({apiKey: process.env.MY_KEY}).

Agent exceeds maxTurns without completing → Increase maxTurns or narrow the task. Check message.subtype === 'max_turns' in the result.

Tool not found / allowedTools not working → Tool names are case-sensitive: 'Read', 'Edit', 'Bash', 'Glob', 'Grep', 'WebFetch', etc.

Using with OpenRouter or other providers → Set ANTHROPIC_BASE_URL to the provider's base URL and use their model string format, e.g. anthropic/claude-sonnet-4-6 for OpenRouter.

Agent modifies files unexpectedly → Use allowedTools: ['Read', 'Glob', 'Grep'] to restrict to read-only tools, or set permissionMode: 'plan' to require approval before edits.

MCP server fails to start → Ensure the MCP server package is installed or accessible via npx. Check command and args match what the MCP package expects.

TypeScript types missing → The package ships its own types. Ensure "moduleResolution": "bundler" or "node16" in tsconfig.json and "esModuleInterop": true.


Quick Reference

// Minimal one-shot agent
import { createAgent } from '@shipany/open-agent-sdk'
const agent = createAgent({ model: 'claude-sonnet-4-6' })
const { text } = await agent.prompt('Summarize README.md in 3 bullet points')
console.log(text)

适合场景

01

调用多模型

02

代码和文本生成

03

Agent 推理流程

04

OpenRouter 模型接入

能力概览

能力 1

统一调用多种 LLM

能力 2

支持 Claude、Gemini、Kimi 等模型

能力 3

适合聊天、代码和推理任务

能力 4

可作为 Agent 模型调用入口

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.32%
按下载量换算1,429

Claude

26.8%
按下载量换算999

Cursor

18.17%
按下载量换算677

Gemini CLI

8.99%
按下载量换算335

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills