Close Menu

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Your PC deserves around-the-clock privacy protection—get AdGuard’s Family Plan for $16

    At $75, who gives a crap if you drop this Chromebook?

    Getting sick of all the Prime Video ads? Amazon quietly doubled them

    Facebook X (Twitter) Instagram
    • Artificial Intelligence
    • Business Technology
    • Cryptocurrency
    • Gadgets
    • Gaming
    • Health
    • Software and Apps
    • Technology
    Facebook X (Twitter) Instagram Pinterest Vimeo
    Tech AI Verse
    • Home
    • Artificial Intelligence

      How far will AI go to defend its own survival?

      June 2, 2025

      The internet thinks this video from Gaza is AI. Here’s how we proved it isn’t.

      May 30, 2025

      Nvidia CEO hails Trump’s plan to rescind some export curbs on AI chips to China

      May 22, 2025

      AI poses a bigger threat to women’s work, than men’s, report says

      May 21, 2025

      AMD CEO Lisa Su calls China a ‘large opportunity’ and warns against strict U.S. chip controls

      May 8, 2025
    • Business

      Google links massive cloud outage to API management issue

      June 13, 2025

      The EU challenges Google and Cloudflare with its very own DNS resolver that can filter dangerous traffic

      June 11, 2025

      These two Ivanti bugs are allowing hackers to target cloud instances

      May 21, 2025

      How cloud and AI transform and improve customer experiences

      May 10, 2025

      Cookie-Bite attack PoC uses Chrome extension to steal session tokens

      April 22, 2025
    • Crypto

      Another LastPass User Loses $200,000 in Crypto to Hackers

      June 13, 2025

      Stellar (XLM) Price Hits Monthly Low – What’s Next?

      June 13, 2025

      Crypto Founder Sentenced to 8 Months in Prison on Wash Trading Charges

      June 13, 2025

      3 Altcoins That Are Thriving Despite Today’s Brief Market Crash

      June 13, 2025

      Top Altcoins Trending in Nigeria as Traders Shift Beyond Bitcoin, Ethereum

      June 13, 2025
    • Technology

      Your PC deserves around-the-clock privacy protection—get AdGuard’s Family Plan for $16

      June 14, 2025

      At $75, who gives a crap if you drop this Chromebook?

      June 14, 2025

      Getting sick of all the Prime Video ads? Amazon quietly doubled them

      June 14, 2025

      Bad news for older PCs: DDR4 memory is nearing an end

      June 14, 2025

      Want the best iPadOS 26 experience this fall? Get this M3 iPad Air for just $499

      June 14, 2025
    • Others
      • Gadgets
      • Gaming
      • Health
      • Software and Apps
    Shop Now
    Tech AI Verse
    You are at:Home»Technology»Claude Code SDK – Anthropic
    Technology

    Claude Code SDK – Anthropic

    TechAiVerseBy TechAiVerseMay 19, 2025No Comments3 Mins Read4 Views
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Share
    Facebook Twitter LinkedIn Pinterest WhatsApp Email

    Claude Code SDK – Anthropic

    The Claude Code SDK allows developers to programmatically integrate Claude Code into their applications. It enables running Claude Code as a subprocess, providing a way to build AI-powered coding assistants and tools that leverage Claude’s capabilities.

    The SDK currently support command line usage. TypeScript and Python SDKs are coming soon.

    Basic SDK usage

    The Claude Code SDK allows you to use Claude Code in non-interactive mode from your applications. Here’s a basic example:

    Advanced usage

    Multi-turn conversations

    For multi-turn conversations, you can resume conversations or continue from the most recent session:

    Custom system prompts

    You can provide custom system prompts to guide Claude’s behavior:

    You can also append instructions to the default system prompt:

    MCP Configuration

    The Model Context Protocol (MCP) allows you to extend Claude Code with additional tools and resources from external servers. Using the --mcp-config flag, you can load MCP servers that provide specialized capabilities like database access, API integrations, or custom tooling.

    Create a JSON configuration file with your MCP servers:

    Then use it with Claude Code:

    Note: When using MCP tools, you must explicitly allow them using the --allowedTools flag. MCP tool names follow the pattern mcp____ where:

    • serverName is the key from your MCP configuration file
    • toolName is the specific tool provided by that server

    This security measure ensures that MCP tools are only used when explicitly permitted.

    Available CLI options

    The SDK leverages all the CLI options available in Claude Code. Here are the key ones for SDK usage:

    Flag Description Example
    --print, -p Run in non-interactive mode claude -p "query"
    --output-format Specify output format (text, json, stream-json) claude -p --output-format json
    --resume, -r Resume a conversation by session ID claude --resume abc123
    --continue, -c Continue the most recent conversation claude --continue
    --verbose Enable verbose logging claude --verbose
    --max-turns Limit agentic turns in non-interactive mode claude --max-turns 3
    --system-prompt Override system prompt (only with --print) claude --system-prompt "Custom instruction"
    --append-system-prompt Append to system prompt (only with --print) claude --append-system-prompt "Custom instruction"
    --allowedTools Comma/space-separated list of allowed tools (includes MCP tools) claude --allowedTools "Bash(npm install),mcp__filesystem__*"
    --disallowedTools Comma/space-separated list of denied tools claude --disallowedTools "Bash(git commit),mcp__github__*"
    --mcp-config Load MCP servers from a JSON file claude --mcp-config servers.json
    --permission-prompt-tool MCP tool for handling permission prompts (only with --print) claude --permission-prompt-tool mcp__auth__prompt

    For a complete list of CLI options and features, see the CLI usage documentation.

    Output formats

    The SDK supports multiple output formats:

    Text output (default)

    Returns just the response text:

    JSON output

    Returns structured data including metadata:

    Response format:

    Streaming JSON output

    Streams each message as it is received:

    Each conversation begins with an initial init system message, followed by a list of user and assistant messages, followed by a final result system message with stats. Each message is emitted as a separate JSON object.

    Message schema

    Messages returned from the JSON API are strictly typed according to the following schema:

    We will soon publish these types in a JSONSchema-compatible format. We use semantic versioning for the main Claude Code package to communicate breaking changes to this format.

    Examples

    Simple script integration

    Processing files with Claude

    Session management

    Best practices

    1. Use JSON output format for programmatic parsing of responses:

    2. Handle errors gracefully – check exit codes and stderr:

    3. Use session management for maintaining context in multi-turn conversations

    4. Consider timeouts for long-running operations:

    5. Respect rate limits when making multiple requests by adding delays between calls

    Real-world applications

    The Claude Code SDK enables powerful integrations with your development workflow. One notable example is the Claude Code GitHub Actions, which uses the SDK to provide automated code review, PR creation, and issue triage capabilities directly in your GitHub workflow.

    Share. Facebook Twitter Pinterest LinkedIn Reddit WhatsApp Telegram Email
    Previous ArticleMicrosoft’s ICC blockade: digital dependence comes at a cost
    Next Article The forbidden railway: Vienna-Pyongyang (2008)
    TechAiVerse
    • Website

    Jonathan is a tech enthusiast and the mind behind Tech AI Verse. With a passion for artificial intelligence, consumer tech, and emerging innovations, he deliver clear, insightful content to keep readers informed. From cutting-edge gadgets to AI advancements and cryptocurrency trends, Jonathan breaks down complex topics to make technology accessible to all.

    Related Posts

    Your PC deserves around-the-clock privacy protection—get AdGuard’s Family Plan for $16

    June 14, 2025

    At $75, who gives a crap if you drop this Chromebook?

    June 14, 2025

    Getting sick of all the Prime Video ads? Amazon quietly doubled them

    June 14, 2025
    Leave A Reply Cancel Reply

    Top Posts

    New Akira ransomware decryptor cracks encryptions keys using GPUs

    March 16, 202523 Views

    OpenAI details ChatGPT-o3, o4-mini, o4-mini-high usage limits

    April 19, 202518 Views

    Rsync replaced with openrsync on macOS Sequoia

    April 7, 202514 Views

    Arizona moves to ban AI use in reviewing medical claims

    March 12, 202511 Views
    Don't Miss
    Technology June 14, 2025

    Your PC deserves around-the-clock privacy protection—get AdGuard’s Family Plan for $16

    Your PC deserves around-the-clock privacy protection—get AdGuard’s Family Plan for $16 Skip to content Image:…

    At $75, who gives a crap if you drop this Chromebook?

    Getting sick of all the Prime Video ads? Amazon quietly doubled them

    Bad news for older PCs: DDR4 memory is nearing an end

    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    About Us
    About Us

    Welcome to Tech AI Verse, your go-to destination for everything technology! We bring you the latest news, trends, and insights from the ever-evolving world of tech. Our coverage spans across global technology industry updates, artificial intelligence advancements, machine learning ethics, and automation innovations. Stay connected with us as we explore the limitless possibilities of technology!

    Facebook X (Twitter) Pinterest YouTube WhatsApp
    Our Picks

    Your PC deserves around-the-clock privacy protection—get AdGuard’s Family Plan for $16

    June 14, 20250 Views

    At $75, who gives a crap if you drop this Chromebook?

    June 14, 20250 Views

    Getting sick of all the Prime Video ads? Amazon quietly doubled them

    June 14, 20250 Views
    Most Popular

    Ethereum must hold $2,000 support or risk dropping to $1,850 – Here’s why

    March 12, 20250 Views

    Xiaomi 15 Ultra Officially Launched in China, Malaysia launch to follow after global event

    March 12, 20250 Views

    Apple thinks people won’t use MagSafe on iPhone 16e

    March 12, 20250 Views
    © 2025 TechAiVerse. Designed by Divya Tech.
    • Home
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms & Conditions

    Type above and press Enter to search. Press Esc to cancel.