AI News
Signal over noise. Daily.
一線 AI Lab
28 articlesAgent SDK reference - TypeScript
Complete API reference for the TypeScript Agent SDK, including all functions, types, and interfaces. npm install @anthropic-ai/claude-agent-sdk The SDK bundles a native Claude Code binary for your platform as an optional dependency such as `@anthropic-ai/claude-agent-sdk-darwin-arm64`. You don't need to install Claude Code separately. The SDK version tracks the bundled Claude Code version: SDK v0.3.191 bundles Claude Code v2.1.191, so a feature on this page that requires a Claude Code version needs the SDK release with the same patch number or later. If your package manager skips optional dependencies, the SDK throws `Native CLI binary for not found`; set `pathToClaudeCodeExecutable` to a separately installed `claude` binary instead.
Agent SDK reference - Python
Complete API reference for the Python Agent SDK, including all functions, types, and classes. Install the package into a virtual environment. On recent Debian, Ubuntu, and Homebrew Python installs, running `pip install` against system Python fails with `error: externally-managed-environment`. python3 -m venv .venv source .venv/bin/activate pip install claude-agent-sdk For uv, Windows PowerShell, and API key setup, see Setup in the Agent SDK quickstart. The Python SDK provides two ways to interact with Claude Code: | Feature | `query()` | `ClaudeSDKClient` | | :------------------ | :--------------------------------------------- | :--------------------------------- | | **Session** | Creates a new session by default | Reuses same session |
How the agent loop works
Understand the message lifecycle, tool execution, context window, and architecture that power your SDK agents. The Agent SDK lets you embed Claude Code's autonomous agent loop in your own applications. The SDK is a standalone package that gives you programmatic control over tools, permissions, cost limits, and output. You don't need the Claude Code CLI installed to use it. When you start an agent, the SDK runs the same execution loop that powers Claude Code: Claude evaluates your prompt, calls tools to take action, receives the results, and repeats until the task is complete. This page explains what happens inside that loop so you can build, debug, and optimize your agents effectively. Every agent session follows the same cycle:
Agent Skills in the SDK
Extend Claude with specialized capabilities using Agent Skills in the Claude Agent SDK Agent Skills extend Claude with specialized capabilities that Claude autonomously invokes when relevant. Skills are packaged as `SKILL.md` files containing instructions, descriptions, and optional supporting resources. For comprehensive information about Skills, including benefits, architecture, and authoring guidelines, see the Agent Skills overview. When using the Claude Agent SDK, Skills are: 1. **Defined as filesystem artifacts**: Created as `SKILL.md` files in specific directories (`.claude/skills/`) 2. **Loaded from filesystem**: Skills are loaded from filesystem locations governed by `settingSources` (TypeScript) or `setting_sources` (Python) 3. **Automatically discovered**: Once filesystem…
TypeScript SDK V2 session API (removed)
Reference for the removed V2 TypeScript Agent SDK session API, with session-based send/stream patterns for multi-turn conversations. The V2 session API is no longer supported. TypeScript Agent SDK 0.3.142 removes `unstable_v2_createSession`, `unstable_v2_resumeSession`, `unstable_v2_prompt`, and the `SDKSession` and `SDKSessionOptions` types. To migrate, use the `query()` API and the session options it accepts. Pass an `AsyncIterable ` for multi-turn conversations, or `options.resume` to continue a saved session. This page is kept for reference if you maintain code on Agent SDK 0.2.x or earlier. V2 was an experimental session API that removed the need for async generators and yield coordination. Instead of managing generator state across turns, each turn was a separate `send()`/`stream()`…
Scale to many tools with tool search
Scale your agent to thousands of tools by discovering and loading only what's needed, on demand. Tool search enables your agent to work with hundreds or thousands of tools by dynamically discovering and loading them on demand. Instead of loading all tool definitions into the context window upfront, the agent searches your tool catalog and loads only the tools it needs. This approach solves two challenges as tool libraries scale: * **Context efficiency:** Tool definitions can consume large portions of the context window (50 tools can use 10-20K tokens), leaving less room for actual work. * **Tool selection accuracy:** Tool selection accuracy degrades with more than 30-50 tools loaded at once. Tool search is enabled by default. When tool search is active, tool definitions are withheld from…
Data usage
Learn about Anthropic's data usage policies for Claude **Consumer users (Free, Pro, and Max plans)**: We give you the choice to allow your data to be used to improve future Claude models. We will train new models using data from Free, Pro, and Max accounts when this setting is on (including when you use Claude Code from these accounts). **Commercial users**: (Team and Enterprise plans, API, 3rd-party platforms, and Claude Gov) maintain existing policies: Anthropic does not train generative models using code or prompts sent to Claude Code under commercial terms, unless the customer has chosen to provide their data to us for model improvement (for example, the Developer Partner Program). If you explicitly opt in to methods to provide us with materials to train on, such as via the…
Quickstart
Get started with the Python or TypeScript Agent SDK to build AI agents that work autonomously Use the Agent SDK to build an AI agent that reads your code, finds bugs, and fixes them, all without manual intervention. **What you'll do:** 1. Set up a project with the Agent SDK 2. Create a file with some buggy code 3. Run an agent that finds and fixes the bugs automatically * **Node.js 18+** or **Python 3.10+** * An **Anthropic account**. If you don't have one, sign up here. Create a new directory for this quickstart: mkdir my-agent cd my-agent For your own projects, you can run the SDK from any folder; it will have access to files in that directory and its subdirectories by default. Install the Agent SDK package for your language:
Hosting the Agent SDK
Deploy the Agent SDK in production: subprocess architecture, session persistence, scaling, observability, and multi-tenant isolation for Docker, Kubernetes, and sandbox providers. The Agent SDK spawns and supervises a `claude` CLI subprocess that owns a shell, a working directory, and session files on disk. Hosting it is not like hosting a stateless API wrapper. Every running agent is a long-lived process tied to local state, which shapes how you allocate resources, persist sessions, and scale across tenants. This page covers self-hosting on your own infrastructure: understand the subprocess model, choose a session pattern, provision the container, and handle production concerns like persistence, observability, auth, and multi-tenant isolation. For deployable Dockerfiles and Kubernetes…
Agent SDK overview
Build production AI agents with Claude Code as a library An agent is an application that completes a task by planning its own steps and calling tools that read files, run commands, or edit code. The Agent SDK gives you the same tools, agent loop, and context management that power Claude Code, programmable in Python and TypeScript. The Agent SDK, the CLI, the Client SDK, and Managed Agents each fit different needs. Use the table to find the one that matches what you're building. | If you're... | Use | Why | | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |…
Intercept and control agent behavior with hooks
Intercept and customize agent behavior at key execution points with hooks Hooks are callback functions that run your code in response to agent events, like a tool being called, a session starting, or execution stopping. With hooks, you can: * **Block dangerous operations** before they execute, like destructive shell commands or unauthorized file access * **Log and audit** every tool call for compliance, debugging, or analytics * **Transform inputs and outputs** to sanitize data, inject credentials, or redirect file paths * **Require human approval** for sensitive actions like database writes or API calls * **Track session lifecycle** to manage state, clean up resources, or send notifications This guide covers how hooks work and how to configure them, with examples for common patterns like…
Monitoring
Learn how to enable and configure OpenTelemetry for Claude Code. Track Claude Code usage, costs, and tool activity across your organization by exporting telemetry data through OpenTelemetry (OTel). Claude Code exports metrics as time series data via the standard metrics protocol, events via the logs/events protocol, and optionally distributed traces via the traces protocol. Configure your metrics, logs, and traces backends to match your monitoring requirements. Configure OpenTelemetry using environment variables: export CLAUDE_CODE_ENABLE_TELEMETRY=1 export OTEL_METRICS_EXPORTER=otlp # Options: otlp, prometheus, console, none export OTEL_LOGS_EXPORTER=otlp # Options: otlp, console, none export OTEL_EXPORTER_OTLP_PROTOCOL=grpc export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
Use Claude Code on the web
Move sessions between web and terminal with `--cloud` and `--teleport`, manage and share sessions, and auto-fix pull requests from Anthropic's cloud infrastructure. Claude Code on the web is in research preview for Pro, Max, and Team users, and for Enterprise users with premium seats or Chat + Claude Code seats. Claude Code on the web runs tasks on Anthropic-managed cloud infrastructure at claude.ai/code. Sessions persist even if you close your browser, and you can monitor them from the Claude mobile app. New to Claude Code on the web? Start with Get started to connect your GitHub account and submit your first task. This page covers the web product itself: * Cloud environments: where sessions run, and where to configure that * GitHub authentication options: two ways to connect GitHub
Rewind file changes with checkpointing
Track file changes during agent sessions and restore files to any previous state File checkpointing tracks file modifications made through the Write, Edit, and NotebookEdit tools during an agent session, allowing you to rewind files to any previous state. Want to try it out? Jump to the interactive example. With checkpointing, you can: * **Undo unwanted changes** by restoring files to a known good state * **Explore alternatives** by restoring to a checkpoint and trying a different approach * **Recover from errors** when the agent makes incorrect modifications Only changes made through the Write, Edit, and NotebookEdit tools are tracked. Changes made through Bash commands (like `echo > file.txt` or `sed -i`) are not captured by the checkpoint system, and neither are edits a subagent…
Modifying system prompts
Choose between the `claude_code` preset and a custom system prompt, and customize behavior with CLAUDE.md, output styles, append, or a fully custom prompt. System prompts define Claude's behavior, capabilities, and response style. Start from the `claude_code` preset for CLI or IDE-like coding tools where a human watches and steers the work. Write your own prompt for agents with a different surface, identity, or permission model. This page covers: * How system prompts work, with a decision table for choosing between the preset, the preset with `append`, and a custom prompt * Customize agent behavior with CLAUDE.md files, output styles, `append`, or a custom string * Compare the four approaches by persistence, scope, and what they preserve * Combine approaches to layer customization methods…
Handle approvals and user input
Surface Claude's approval requests and clarifying questions to users, then return their decisions to the SDK. While working on a task, Claude sometimes needs to check in with users. It might need permission before deleting files, or need to ask which database to use for a new project. Your application needs to surface these requests to users so Claude can continue with their input. Claude requests user input in two situations: when it needs **permission to use a tool** (like deleting files or running commands), and when it has **clarifying questions** (via the `AskUserQuestion` tool). Both trigger your `canUseTool` callback, which pauses execution until you return a response. This is different from normal conversation turns where Claude finishes and waits for your next message. For…
Observability with OpenTelemetry
Export traces, metrics, and events from the Agent SDK to your observability backend using OpenTelemetry. When you run agents in production, you need visibility into what they did: * which tools they called * how long each model request took * how many tokens were spent * where failures occurred The Agent SDK can export this data as OpenTelemetry traces, metrics, and log events to any backend that accepts the OpenTelemetry Protocol (OTLP), such as Honeycomb, Datadog, Grafana, Langfuse, or a self-hosted collector. This guide explains how the SDK emits telemetry, how to configure the export, and how to tag and filter the data once it reaches your backend. To read token usage and cost directly from the SDK response stream instead of exporting to a backend, see Track cost and usage. The Agent…
Slash Commands in the SDK
Learn how to use slash commands to control Claude Code sessions through the SDK Slash commands provide a way to control Claude Code sessions with special commands that start with `/`. These commands can be sent through the SDK to perform actions like compacting context, listing context usage, or invoking custom commands. Only commands that work without an interactive terminal are dispatchable through the SDK; the `system/init` message lists the ones available in your session. The Claude Agent SDK provides information about available slash commands in the system initialization message. Access this information when your session starts: import { query } from "@anthropic-ai/claude-agent-sdk"; for await (const message of query({ prompt: "Hello Claude", options: { maxTurns: 1 } })) {
Manage costs effectively
Track token usage, set team spend limits, and reduce Claude Code costs with context management, model selection, extended thinking settings, and preprocessing hooks. Claude Code charges by API token consumption. For subscription plan pricing (Pro, Max, Team, Enterprise), see claude.com/pricing. Per-developer costs vary widely based on model selection, codebase size, and usage patterns such as running multiple instances or automation. Across enterprise deployments, the average cost is around \$13 per developer per active day and \$150-250 per developer per month, with costs remaining below \$30 per active day for 90% of users. To estimate spend for your own team, start with a small pilot group and use the tracking tools below to establish a baseline before wider rollout. This page covers…
Plugins in the SDK
Load custom plugins to extend Claude Code with skills, agents, hooks, and MCP servers through the Agent SDK Plugins allow you to extend Claude Code with custom functionality that can be shared across projects. Through the Agent SDK, you can programmatically load plugins from local directories to add skills, agents, hooks, and MCP servers to your agent sessions. Plugins are packages of Claude Code extensions that can include: * **Skills**: Model-invoked capabilities that Claude uses autonomously (can also be invoked with `/skill-name`) * **Agents**: Specialized subagents for specific tasks * **Hooks**: Event handlers that respond to tool use and other events * **MCP servers**: External tool integrations via Model Context Protocol The `commands/` directory is a legacy format. Use `skills/`…
Persist sessions to external storage
Mirror session transcripts to S3, Redis, or your own backend so any host can resume them. By default, the SDK writes session transcripts to JSONL files under `~/.claude/projects/` on the local filesystem. A `SessionStore` adapter lets you mirror those transcripts to your own backend, such as S3, Redis, or a database, so a session created on one host can be resumed on another. Common reasons to use a session store: * **Multi-host deployments.** Serverless functions, autoscaled workers, and CI runners don't share a filesystem. A shared store lets any replica resume any session. * **Durability.** Local containers are ephemeral. A store backed by S3 or a database survives restarts and redeploys. * **Compliance and audit.** Keep transcripts in storage you already govern, with your own…
Scientific computing in the age of agentic AI
A new field report shows how scientists use AI coding agents to modernize scientific computing, accelerating software development and discovery in genomics and beyond.
The OlmoEarth Platform: Geospatial inference at planetary scale
A Blog post by Ai2 on Hugging Face
Gemini API Managed Agents: 3.6 Flash, hooks, and more
We’re announcing even more new capabilities in Managed Agents in Gemini API so developers can build reliable, production-ready agents.
Position Open Weights Models
Anthropic CEO Dario Amodei on open-weights models
LFM2.5-Encoders for Fast Long-Context Inference on CPU
A Blog post by Liquid AI on Hugging Face
5 ways AI Mode in Search helps you enjoy the real world
It might sound counterintuitive, but Search's AI tools can actually help you make the most of your time offline whether you want to book concert tickets or find the perf…
5 ways to host the ultimate dinner party with Google Search
These AI features can help you craft a menu, design a tablescape, and handle other party-planning tasks.
媒體
30 articlesOpenAI’s Rogue AI Agent Hacked More Than Just Hugging Face
In a new disclosure, OpenAI says its agent used exposed logins to gain access to at least four “publicly available services” in its unhinged quest to solve a test.
Cyera agrees to acquire Oasis Security for $1B to safeguard proliferating AI agents
The deal is Cyera's third acquisition this year.
Mark Zuckerberg Blasts Centralization of A.I. Power
In an interview, Meta’s chief executive took aim at Anthropic and OpenAI, which have pushed to tightly control A.I. development, and said he supported “more openness.”
What Is Open-Weights A.I.?
As Silicon Valley debates how artificial intelligence software should be created, “open weights” have been a major part of the discussions. Here’s what to know.
We now have a better understanding how OpenAI hacked into Hugging Face
Last week’s unprecedented security event in which two OpenAI security hacking models trespassed into the network of fellow AI company Hugging Face was enabled by exploiting one or more zero-day vulnerabilities in Artifactory, JFrog, the product’s developer, said Monday. In an incident mimicking a dystopian sci-fi novel, two OpenAI models broke out of the restricted environment meant to keep them from accessing the Internet during an internal test, the AI company revealed last week . The models went on to breach Hugging Face’s network and steal confidential information and credentials. OpenAI said its agent achieved the feat by exploiting a previously unknown vulnerability. The company called the event “unprecedented,” and outsiders largely agreed. Not the triumph made out to be OpenAI…
Bot-detection startup Spur nabs $200M from Insight
Spur Intelligence has raised a $200 million round from Insight Partners for its tech that can identify legit human traffic from bots.
How A.I.’s Latest Science Fiction Scenario Came True
This week, a rogue A.I. agent acted autonomously and conducted a cyberattack on the company Hugging Face. In the latest episode of “Hard Fork,” the hosts, Kevin Roose and Casey Newtown, discuss how the attack happened and why it matters.
Is Kimi K3 ‘Distilled’ From an American A.I. Model?
In this week’s episode of “Hard Fork,” the hosts Kevin Roose and Casey Newton discuss Kimi K3, a highly efficient new A.I. model from China’s Moonshot A.I. K3 claims impressive efficiency and coding capabilities, but was it build by “distilling,” essentially copying and reworking, American technology?”
MCP startup Runlayer accuses Rippling of stealing its product idea
Runlayer is suing Rippling after Rippling evaluated the startup's MCP gateway product and then opted to build one itself.
Writers Guild Withdraws Support From Film Festival Over A.I.
Urbanworld, a New York event, has added a section for movies made with A.I. tools. The union was a sponsor but has been outspoken on the dangers of A.I.
Despite AI hype, Google's data shows workers aren't automating themselves away
Anyone following the AI space is by now familiar with lofty claims that AI models will soon be better than humans at everything and capable of replacing vast swaths of the human workforce . In a new study from Google Research, though, a team that looked at how workers are actually using Gemini "[did] not find evidence... to support the claims that AI is about to cause massive automation and displacement of white-collar work..." The paper , released last week, introduces the "AI & Economy ATLAS," an Activity, Task, Landscape, and Adoption Study of 15 million anonymized AI interactions across the Gemini App, Google's AI Mode, and the Gemini API. Their initial review of the data finds that, while AI sees some significant use across a wide variety of occupations, that use "remains shallow and…
Sam Altman is ready to decelerate
His change of position comes after "the first security incident that I have felt very viscerally."
AI leaders sign a statement asking the government to do something about automated AI
Employees of OpenAI and Anthropic, as well as Google, Meta, Thinking Machines, Microsoft, Mistral, and other leading AI labs, have written a statement to the US government supporting a potential slowdown of sorts for frontier AI development - or at least a speed-up of global coordinated governance efforts. "Al could help create a dramatically better future, but that outcome is not guaranteed," the employees wrote in the statement. "The world's leading Al companies believe they could be close to automating Al research. It is hard to predict exactly how much this will accelerate Al progress, but there is a real risk that capability developmen … Read the full story at The Verge.
AI’s finally expensive enough to make Wall Street nervous
Working hard, or bear-ly working? | Image: Cath Virginia / The Verge, Getty Images It's earnings season, and investors got an unpleasant surprise from Google: an increase on its spending estimate , to as much as $205 billion - from the last quarter's projection of up to $190 billion. Even the lower end of Google's new projected range - $195 billion - is much more than the company had previously forecast as its top end spending. Now, look, I recognize that there's an impulse to say things like "What's $15 billion between friends?" but from an investor's perspective, Google has essentially said that it can't accurately forecast its costs, which is a scary thing. Plus, Google is spending more money than it's making . And Google … Read the full story at The Verge.
The Chips Rout Goes Global
Shares in semiconductor companies plunged in South Korea and Europe, adding fresh doubts to the durability of the artificial intelligence trade.
How A.I. Books Sneak Their Way Into Stores
Big booksellers are taking different approaches to dealing with the deluge of titles generated by artificial intelligence.
An Anthropic Claude AI Model Finds Flaws in Tough-to-Crack Encryption Algorithms
Claude Mythos Preview discovered new attacks in testing against weakened cryptographic algorithms, which protect online financial transactions, private communications and more.
In This Costa Rican Forest, Monkeys Come Face-to-Face With A.I.
CapuchinAI, a portable testing station equipped with a touch screen and facial recognition software, could help scientists study primate intelligence in the wild.
Data centers may face temporary power cuts to prevent blackouts on largest US grid
The decision arrives as the breakneck pace of data center construction has grid operators scrambling to generate power.
Fish Audio raises $52M seed to build AI voice models for creators and enterprises
Since launching last year, the startup today has more than 8 million people using the open source or hosted version of its models, and now generates annual recurring revenue of $21 million.
Recursive Superintelligence signs $410M compute deal with Amazon
Recursive’s emphasis on self-improving AI systems means much of the budget that would traditionally go toward headcount and operations is put straight into compute, as the company seeks to automate its own product development process.
Apple Introduces Leasing Program for iPhones and Other Devices
The program is an effort to make products more affordable as artificial intelligence sends some component prices soaring.
Perplexity’s Personal Computer turns Windows PCs into AI agents
Perplexity has expanded its agentic Personal Computer tool to Windows, allowing computers running the world's most popular OS to be used as a locally run AI system. Like the Mac version that Perplexity launched in April, Personal Computer for Windows operates like a "general-purpose digital worker" that can access local files and apps to perform actions on your behalf, such as creating documents and updating spreadsheets. This launch builds on Personal Computer integrations that Perplexity launched for Microsoft's 365 workspace apps and Teams virtual meeting software in May. Personal Computer for Windows aims to bridge the remaining gap by … Read the full story at The Verge.
Smart rings are looking like my kind of AI gadget
Over the last few months, I've spent a lot of time talking to my computer. One underrated feature of the LLM revolution has been a remarkable leap in all kinds of dictation technology - even the fastest, cheapest models are getting very good at understanding and processing speech. I've tested lots of these apps, from WisprFlow to Monologue to Spokenly to Handy to so many others, and have found them all to be useful ways to quickly write emails, Slack messages, and more. They sometimes default to giving everything a too-formal style of formatting and love ending a text message with a period (like a sociopath), but they're getting better at th … Read the full story at The Verge.
Can the New York Times Save Journalism From Our AI Overlords?
In 2023, the Times sued OpenAI and Microsoft for copyright infringement. They’ve since spent more than $20 million on the case, and publisher A.G. Sulzberger has no plans to stop fighting it.
Silicon Valley’s Next IPO Billionaires Are Coming. Nonprofits Are Ready for Them
Anthropic and OpenAI employees are expected to give generously after their companies go public. “It’s going to be a wild ride,” says one nonprofit leader.
Samsung’s chip workers are jumping ship to rival SK Hynix
Lee, an engineer at Samsung’s semiconductor division, clocks out when his shift ends. He used to work longer hours, going the extra mile to excel at his projects. But lately, he’s been coming straight home to work on his job application for the chipmaker’s South Korean rival SK Hynix, sharing tips with his coworkers on how to draft a stellar personal statement. Even his boss encourages him to make the move. “My team lead tells us all to jump ship to SK Hynix,” says Lee. He and his coworkers are feeling demoralized by the $476,000 bonus that SK Hynix is set to pay its employees, flush with record profits from making the high-bandwidth memory (HBM) chips that power Nvidia’s AI accelerators. The figure dwarfs what chip workers at Samsung are set to receive and is sparking an exodus. As the…
Hugging Face is being used to easily undress women and children
Hugging Face isn’t doing much to prevent the AI models it hosts from spitting out sexualized deepfakes. | Image: Cath Virginia / The Verge | Photos from Getty Images Hugging Face is being used to make nonconsensual deepfakes, and the popular open-source AI model repository is doing very little to prevent it. That's according to a new report published by the European nonprofit AI Forensics , which found that seven out of the top nine image editing models hosted by Hugging Face readily complied with requests to undress women using simple prompts. While most mainstream generative AI models like Google's Gemini and OpenAI's ChatGPT have guardrails in place to block prompts that undress or sexualize people, that seemingly isn't the case for the models on Hugging Face tested by AI Forensics.…
Hugging Face Has a Deepfake Nudes Problem
Researchers tested top image editing models on Hugging Face and found they could easily create explicit deepfakes—and 1,000 image editing prompts show how people use the software.
Cursor makes its biggest India push yet ahead of SpaceX acquisition with localized pricing
Cursor says India is now its third-largest market globally and plans to expand local hiring and enterprise sales.