open-agent-sdk
Build and deploy autonomous AI agents in-process using Open Agent SDK, an open-source alternative to @anthropic-ai/claude-agent-sdk that works anywhere without CLI dependencies.
What this skill does
# Open Agent SDK
> Skill by [ara.so](https://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
```sh
npm install @shipany/open-agent-sdk
```
Requires Node.js 18+.
---
## Authentication & Configuration
Set the Anthropic API key as an environment variable:
```sh
export ANTHROPIC_API_KEY=your-api-key
```
Or use a third-party provider (e.g. OpenRouter):
```sh
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`.
```typescript
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
```typescript
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
| Option | Type | Default | Description |
|---|---|---|---|
| `model` | `string` | `claude-sonnet-4-6` | Claude model ID |
| `apiKey` | `string` | `ANTHROPIC_API_KEY` env | API key |
| `baseURL` | `string` | Anthropic API | Override for third-party providers |
| `cwd` | `string` | `process.cwd()` | Working directory for file/shell tools |
| `systemPrompt` | `string` | — | Custom system prompt prepended to agent |
| `tools` | `Tool[]` | All built-in | Override the full tool list |
| `allowedTools` | `string[]` | all | Whitelist specific tools by name |
| `permissionMode` | `string` | `bypassPermissions` | `acceptEdits`, `bypassPermissions`, `plan`, `default` |
| `maxTurns` | `number` | `100` | Maximum agentic loop iterations |
| `maxBudgetUsd` | `number` | — | Spend cap in USD |
| `mcpServers` | `object` | — | MCP server configs (stdio/SSE/HTTP) |
| `agents` | `object` | — | Named subagent definitions |
| `hooks` | `object` | — | Lifecycle hooks: `PreToolUse`, `PostToolUse`, `Stop` |
| `thinking` | `object` | — | Extended thinking config |
| `env` | `object` | — | Environment variables passed to tools |
| `resume` | `string` | — | Resume prior session by session ID |
| `canUseTool` | `function` | — | Custom permission callback `(tool, input) => boolean` |
| `includePartialMessages` | `boolean` | `false` | Emit raw streaming events |
---
## Common Patterns
### Multi-turn conversation with context
```typescript
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
```typescript
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
```typescript
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
```typescript
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
```typescript
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
```typescript
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
```typescript
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 }) => {
conRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.