翻篇收录说明
翻篇网页快照

Capabilities | Pydantic Docs

https://pydantic.dev/docs/ai/capabilities/overview/

最近抓取:2026-12-03 23:24:07(北京时间)

最近内容变化:2026-11-30 18:56:24(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Bundle tools, instructions, model settings and hooks into reusable Pydantic AI capabilities, and browse the built-in capabilities you can add to any agent.

正文摘录

Capabilities A capability is a reusable, composable unit of agent behavior. Instead of threading multiple arguments through your Agent constructor — instructions here, model settings there, a toolset somewhere else, a history processor on yet another parameter — you can bundle related behavior into a single capability and pass it via the capabilities parameter. Capabilities can provide any combination of: Tools — via toolsets or native tools Lifecycle hooks — intercept and modify model requests, tool calls, and the overall run Instructions — static or dynamic instruction additions Model settings — static or per-step model settings Models — static or adaptive model selection and application-specific model ID resolution This makes them the primary extension point for Pydantic AI. Whether you’re building a memory system, a guardrail, a cost tracker, or an approval workflow, a capability is the right abstraction. Capabilities can be always-on or loaded by the model on demand: an on-demand (deferred) capability keeps its instructions and tools hidden until the model loads it, so use one to gate a workflow’s or skill’s tools as a bundle, and tool search to let the model find individual tools in a large catalog. The capability index below covers Pydantic AI and Pydantic AI Harness. Third-party packages provide many more capabilities, and you can define your own declaratively or by subclassing. To run agents durably across failures, restarts, and long waits, see Durable Execution. Available capabilities Capabilities come from two packages, and they compose with each other and with capabilities you define. Core (pydantic-ai) ships the capabilities that require model or framework support: provider-native tools, provider APIs, and deep loop integration. Pydantic AI Harness, the official capability library and harness for Pydantic AI, ships everything else, from single capabilities to complete agents. The Package column says which; every entry links to its documentation. Harnesses Complete agent stacks as regular combined capabilities: one import gives you a working agent, and you can take either apart into the blocks below. HarnessPackageWhat it providesCoderHarnessA complete coding-agent stack: files, shell, repo context, planning, a read-only explorer sub-agent, and context controlsResearcherHarnessA complete web-research stack: search, page fetching, a delegated sub-researcher, and bounded tool output Workspaces Where the agent runs commands and keeps files: this machine, a container, or a sandbox. Compare them. CapabilityPackageWhat it doesLocal WorkspaceCoreCommands and files in a directory on this machine; no isolation. Adds no tools: pair it with the Files & shell tools or your ownDocker ContainerHarnessCommands and files in a local Docker or Podman containerSmol SandboxHarnessCommands and files in a smolvm microVM on your own machine; no cloud accountBoxLite SandboxHarnessCommands and files in a BoxLite micro-VM on your own machine, with an optional egress allow-list; no cloud accountOpenSandboxHarnessCommands and files in a sandbox on your own OpenSandbox server, on Docker or KubernetesKubernetes SandboxHarnessCommands and files in a sandbox pod from a Kubernetes agent-sandbox warm poolModal SandboxHarnessCommands and files in an isolated Modal cloud sandboxE2B SandboxHarnessCommands and files in an isolated E2B cloud sandboxDaytona SandboxHarnessCommands and files in an isolated Daytona cloud sandboxRender SandboxHarnessCommands and files in an isolated Render sandboxSprites SandboxHarnessCommands and files in a persistent Fly.io Spriteboxd SandboxHarnessCommands and files in an isolated boxd cloud machineSSH WorkspaceHarnessCommands and files on a remote host over your ssh client, as your SSH user; not sandboxed thereBubblewrapped WorkspaceHarnessWraps another workspace capability so its commands run in a Linux bubblewrap wrapper on that workspace’s host (best-effort convenience, not a security boundary) Files & shell The tools the model uses in the run’s workspace, whichever one it is. CapabilityPackageWhat it doesFileSystemHarnessRead, write, edit, search files under a root; path-traversal and symlink safe, secrets read-onlySmart SearchHarnessCode search by behavior in the run’s workspace: plain-English queries, ranked excerpts, judged by any model (a decision model over System One, or TypeSafe’s Jev, recommended)ShellHarnessCommand execution with allowlists, denylists, timeouts, and credential-stripping Tools & native abilities Abilities the provider executes natively, and connections to any MCP server. CapabilityPackageWhat it doesMCPCoreConnect any MCP server’s tools; local by default, provider-native connectors opt-inImage GenerationCoreGenerate and edit images; provider-native where supported, direct image-model fallback elsewhereFile UnderstandingCoreDescribe images, documents, audio and video the model cannot read, with a model that canNative ToolCoreRegister any provider-native tool with the agent Integrations Tools from third-party services, most through the service’s own hosted MCP server. The Integrations page groups them by what they connect to. CapabilityPackageWhat it doesGitHubHarnessRead and change repositories, issues, and pull requests through GitHub’s hosted MCP serverLinearHarnessRead and update issues, projects, and comments through Linear’s hosted MCP serverMacroscopeHarnessRun a local Macroscope code review and hand the findings to the agentLocalStackHarnessAn emulated AWS environment with AWS CLI toolsGoogle WorkspaceHarnessUse Gmail, Calendar, Drive, Docs, Sheets, Slides, Chat, and People through Google’s hosted MCP serversNotionHarnessSearch and edit pages in a Notion workspace through Notion’s hosted MCP serverSlackHarnessRead and send messages, browse channels, and edit canvases through Slack’s hosted MCP serverDay AIHarnessSearch and update CRM records and read meeting context through Day AI’s hosted MCP serverGrainHarnessSearch and read meetings, transcripts, and notes, and create clips and tag meetings, through Grain’s hosted MCP serverPylonHarnessWork with support issues, accounts, and contacts through Pylon’s hosted MCP serverStackOneHarnessAct on linked SaaS accounts (HRIS, ATS, CRM, …) via StackOnePostHogHarnessQuery product analytics and manage feature flags, experiments, and dashboards through PostHog’s hosted MCP serverLogfire MCPHarnessQuery traces and telemetry and manage projects through the hosted Logfire MCP serverOrdinalHarnessDraft, schedule, and analyze social posts through Ordinal’s hosted MCP server Web & research Finding and reading things on the open web. CapabilityPackageWhat it doesWeb SearchCoreProvider-native search where available, local DuckDuckGo fallback everywhereWeb FetchCoreFetch and read URLs, native or localX SearchCoreSearch X; native on xAI, subagent fallback elsewhereCitationsCoreAsk providers to cite the documents and pages behind the answerExa SearchHarnessWeb research via Exa: excerpted search, full-page reads, opt-in cited deep searchExa AgentHarnessDelegate open-ended research to the Exa Agent APIYou.com SearchHarnessWeb search and page reads via You.com: query-relevant excerpts or full-page markdownYou.com ResearchHarnessCited answers and multi-step research via the You.com Answer, Research, and Finance Research APIsKeenable SearchHarnessWeb research via Keenable: excerpted search and full-page reads, keyless and with no extra to installBrowser UseHarnessHand web tasks to an autonomous browser-use agent driving a real browserCDP BrowserHarnessDrive a throwaway Chrome tab with raw DevTools Protocol commands, best from Code ModePlaywright BrowserHarnessDrive a real Chromium page yourself: navigate, click, type, read, and inspect what the page didComputer UseHarnessSee and control the desktop of the run’s workspace with screenshots, mouse, and keyboard Reasoning, planning & delegation How the agent thinks and divides the work. CapabilityPackageWhat it doesThinkingCoreProvider-adaptive extended thinking at configurable effortPlanningHarnessModel-owned task plans with a cache-safe live reminderSubagentsHarnessDelegate self-contained tasks to named child agentsDynamic WorkflowHarnessThe model orchestrates sub-agents from one Python script: fan-out, chain, vote in a single tool call, with hard max_agent_calls budgetsAdvisorHarnessLet an executor consult a stronger model mid-runBackground ToolsHarnessRun selected tools concurrently; results arrive as follow-up messages Context management How the agent spends its context window: the difference between an agent that degrades over a long run and one that doesn’t, and between paying for tokens N times or once. CapabilityPackageWhat it doesCode ModeHarnessThe model writes one Python script that calls many tools inside a Monty sandbox: one round-trip instead of N, and intermediate results never enter the context windowIPython Code ModeHarnessCode Mode with a persistent IPython kernel in place of the Monty sandbox: full CPython and any installed package, with state kept between calls. For local agents only; not a sandboxTool BridgeHarnessKeep the tool list the model sees fixed behind tool_search, tool_describe and tool_call, so the prompt cache holds however many tools sit behind themTool SearchCoreLoad tool definitions on demand instead of carrying hundreds in every promptCachingCoreProvider-adaptive prompt caching of tools, instructions and the conversation, at a configurable retentionCompactionCoreProvider-native compaction on OpenAI and Anthropic; the provider summarizes history server-sideCompactionHarnessModel-agnostic strategies: tool-result clearing, sliding-window trimming, LLM summarization, tiered; all window-relative, with live usage reportingTool Output LimitsHarnessTruncate, spill to a queryable file, or summarize oversized tool returns at the sourceWarn On Cache BustsHarnessDetect prompt-cache prefix collapses between requests, from the provider’s own numbersLabel Cross Model HistoryHar