TypeScript Agent SDK
Benchmarked against: Anthropic — TypeScript Agent SDK Line: Line 1 (Claude Agentic) Package:
@anthropic-ai/claude-agent-sdk
The TypeScript Agent SDK provides Claude Code as a library — programmatic access to Claude's agent capabilities including tool use, file operations, and conversation management.
Overview
| Feature | Detail |
|---|---|
| Language | TypeScript / Node.js |
| Provider | Anthropic (Claude Agent SDK) |
| Line | Line 1 — Claude Agentic |
| Tools | Full MCP tool access via SDK |
| Use case | Building custom agent workflows, integrating Claude into applications |
Installation
npm install @anthropic-ai/claude-agent-sdk
Basic usage
import { Agent } from '@anthropic-ai/claude-agent-sdk';
const agent = new Agent({
model: 'claude-sonnet-4-6',
tools: ['file_read', 'file_write', 'bash'],
});
const result = await agent.run('Search the codebase for TODO comments');
console.log(result.output);
SuperPortia integration
To use the TypeScript SDK within SuperPortia's ecosystem:
Connect to MCP servers
const agent = new Agent({
model: 'claude-sonnet-4-6',
mcpServers: {
'cloud-ub': { url: process.env.CLOUD_UB_URL },
'local-ubi': {
command: 'python',
args: ['-m', 'ub.mcp_server'],
},
},
});
Agent identity
// Set ship and agent identity for UB tagging
process.env.SP_SHIP_ID = 'SS1';
process.env.SP_AGENT_ID = 'Mac CLI 小A';
When to use TypeScript SDK
| Scenario | TypeScript SDK | Claude Code CLI |
|---|---|---|
| Build a custom agent app | Yes | No |
| Automate agent workflows | Yes | Limited |
| Interactive terminal work | No | Yes |
| Captain-directed tasks | No | Yes |
| CI/CD integration | Yes | Limited |
Relationship to Line 1
The TypeScript SDK is a component of Line 1 (Claude Agentic). It provides:
- Programmatic agent control (vs. interactive CLI)
- Embeddable agent capabilities (vs. standalone process)
- Custom workflow building (vs. ad-hoc conversation)
Line 1 designs blueprints using both Claude Code CLI and the TypeScript SDK.
Related pages
| Page | Relationship |
|---|---|
| Agent SDK Overview | Dual agentic lines |
| Python SDK | Line 2 alternative |
| Agent SDK Quickstart | Getting started |