Agent SDK — TypeScript

Agent

by davila7 · Added 5mo ago

Claude

Install

npx claude-code-templates@latest --agent=cli-tool/components/skills/development/claude-api/typescript/agent-sdk --yes

Add to Claude

claude mcp add agent-sdk-typescript

About

Agent SDK — TypeScript

The Claude Agent SDK provides a higher-level interface for building AI agents with built-in tools, safety features, and agentic capabilities.

Installation

npm install @anthropic-ai/claude-agent-sdk

Quick Start

import { query } from "@anthropic-ai/claude-agent-sdk";

for await (const message of query({
  prompt: "Explain this codebase",
  options: { allowedTools: ["Read", "Glob", "Grep"] },
})) {
  if ("result" in message) {
    console.log(message.result);
  }
}

Built-in Tools

ToolDescription
ReadRead files in the workspace
WriteCreate new files
EditMake precise edits to existing files
BashExecute shell commands
GlobFind files by pattern
GrepSearch files by content
WebSearchSearch the web for information
WebFetchFetch and analyze web pages
AskUserQuestionAsk user clarifying questions
AgentSpawn subagents

Permission System

for await (const message of query({
  prompt: "Refactor the authentication module",
  options: {
    allowedTools: ["Read", "Edit", "Write"],
    permissionMode: "acceptEdits",
  },
})) {
  if ("result" in message) console.log(message.result);
}

Permission modes:

  • "default": Prompt for dangerous operations
  • "plan": Planning only, no execution
  • "acceptEdits": Auto-accept file edits
  • "dontAsk": Don't prompt (useful for CI/CD)
  • "bypassPermissions": Skip all prompts (requires allowDangerouslySkipPermissions: true in options)

MCP (Model Context Protocol) Support

for await (const message of query({
  prompt: "Open example.com and describe what you see",
  options: {
    mcpServers: {
      

Tags

FullStackaitmplclaude-code-templates

From Our Store

View all →
Claude Code

Claude Code Power User Kit

$39+

Advanced Claude Code skills and configurations

OpenClaw

OpenClaw Business Starter Kit

$59+

Set Up Your AI Assistant in 60 Minutes