You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[`Agent.from_spec`][pydantic_ai.Agent.from_spec] accepts a dict or [`AgentSpec`][pydantic_ai.agent.spec.AgentSpec] instance and supports additional keyword arguments that supplement or override the spec:
37
+
[`Agent.from_spec`][pydantic_ai.agent.Agent.from_spec] accepts a dict or [`AgentSpec`](#agentspec-reference) instance and supports additional keyword arguments that supplement or override the spec:
38
38
39
39
```python {title="from_spec_example.py"}
40
40
from dataclasses import dataclass
@@ -71,15 +71,15 @@ For more control over spec loading, use [`AgentSpec.from_file`][pydantic_ai.agen
71
71
72
72
## Template strings
73
73
74
-
[`TemplateStr`][pydantic_ai.TemplateStr] provides Handlebars-style templates (`{{variable}}`) that are rendered against the agent's [dependencies](dependencies.md) at runtime. In spec files, strings containing `{{` are automatically converted to template strings:
74
+
[`TemplateStr`][pydantic_ai._template.TemplateStr] provides Handlebars-style templates (`{{variable}}`) that are rendered against the agent's [dependencies](dependencies.md) at runtime. In spec files, strings containing `{{` are automatically converted to template strings:
75
75
76
76
```yaml {test="skip"}
77
77
instructions: "You are assisting {{name}}, who is a {{role}}."
78
78
```
79
79
80
80
Template variables are resolved from the fields of the `deps` object. When a `deps_type` (or [`deps_schema`](#deps_schema)) is provided, template variable names are validated at construction time.
81
81
82
-
In Python code, [`TemplateStr`][pydantic_ai.TemplateStr] can be used explicitly, but a callable with [`RunContext`][pydantic_ai.tools.RunContext] is generally preferred for IDE autocomplete and type checking:
82
+
In Python code, [`TemplateStr`][pydantic_ai._template.TemplateStr] can be used explicitly, but a callable with [`RunContext`][pydantic_ai.tools.RunContext] is generally preferred for IDE autocomplete and type checking:
83
83
84
84
```python {title="template_instructions.py"}
85
85
from dataclasses import dataclass
@@ -117,7 +117,7 @@ See [Publishing capabilities](capabilities.md#publishing-capabilities) for how t
117
117
118
118
## `AgentSpec` reference
119
119
120
-
The [`AgentSpec`][pydantic_ai.agent.spec.AgentSpec] model represents the full spec structure:
120
+
The [`AgentSpec`](#agentspec-reference) model represents the full spec structure:
Copy file name to clipboardExpand all lines: docs/capabilities.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -362,11 +362,11 @@ The callable receives a [`RunContext`][pydantic_ai.tools.RunContext] where `ctx.
362
362
363
363
| Method | Return type | Purpose |
364
364
|---|---|---|
365
-
|[`get_toolset()`][pydantic_ai.capabilities.AbstractCapability.get_toolset]|[`AgentToolset`][pydantic_ai.toolsets.AgentToolset]`\| None`| A [toolset](toolsets.md) to register (or a callable for [dynamic toolsets](toolsets.md#dynamically-building-a-toolset)) |
365
+
|[`get_toolset()`][pydantic_ai.capabilities.AbstractCapability.get_toolset]|[`AgentToolset`][pydantic_ai.toolsets.AgentToolset]\|`None`| A [toolset](toolsets.md) to register (or a callable for [dynamic toolsets](toolsets.md#dynamically-building-a-toolset)) |
366
366
|[`get_builtin_tools()`][pydantic_ai.capabilities.AbstractCapability.get_builtin_tools]|`Sequence[`[`AgentBuiltinTool`][pydantic_ai.tools.AgentBuiltinTool]`]`|[Builtin tools](builtin-tools.md) to register (including callables) |
367
-
|[`get_wrapper_toolset()`][pydantic_ai.capabilities.AbstractCapability.get_wrapper_toolset]|[`AbstractToolset`][pydantic_ai.toolsets.AbstractToolset]`\| None`|[Wrap the agent's assembled toolset](#toolset-wrapping)|
368
-
|[`get_instructions()`][pydantic_ai.capabilities.AbstractCapability.get_instructions]|[`AgentInstructions`][pydantic_ai.agent.AgentInstructions]`\| None`|[Instructions](agent.md#instructions) (static strings, [template strings](agent-spec.md#template-strings), or callables) |
369
-
|[`get_model_settings()`][pydantic_ai.capabilities.AbstractCapability.get_model_settings]|[`AgentModelSettings`][pydantic_ai.agent.AgentModelSettings]`\| None`|[Model settings](agent.md#model-run-settings) dict, or a callable for per-step settings |
367
+
|[`get_wrapper_toolset()`][pydantic_ai.capabilities.AbstractCapability.get_wrapper_toolset]|[`AbstractToolset`][pydantic_ai.toolsets.AbstractToolset]\|`None`|[Wrap the agent's assembled toolset](#toolset-wrapping)|
368
+
|[`get_instructions()`][pydantic_ai.capabilities.AbstractCapability.get_instructions]|[`AgentInstructions`][pydantic_ai.agent.AgentInstructions]\|`None`|[Instructions](agent.md#instructions) (static strings, [template strings](agent-spec.md#template-strings), or callables) |
369
+
|[`get_model_settings()`][pydantic_ai.capabilities.AbstractCapability.get_model_settings]|[`AgentModelSettings`][pydantic_ai.agent.AgentModelSettings]\|`None`|[Model settings](agent.md#model-run-settings) dict, or a callable for per-step settings |
Copy file name to clipboardExpand all lines: docs/extensibility.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ To make a capability installable and usable in [agent specs](agent-spec.md):
25
25
26
26
3.**Package naming** — use the `pydantic-ai-` prefix (e.g. `pydantic-ai-guardrails`) so users can find your package.
27
27
28
-
4.**Registration** — users pass custom capability types via `custom_capability_types` on [`Agent.from_spec`][pydantic_ai.Agent.from_spec] or [`Agent.from_file`][pydantic_ai.Agent.from_file].
28
+
4.**Registration** — users pass custom capability types via `custom_capability_types` on [`Agent.from_spec`][pydantic_ai.agent.Agent.from_spec] or [`Agent.from_file`][pydantic_ai.agent.Agent.from_file].
To enable thinking, use the [`AnthropicModelSettings.anthropic_thinking`][pydantic_ai.models.anthropic.AnthropicModelSettings.anthropic_thinking][model setting](agent.md#model-run-settings).
92
92
93
93
!!! note
94
-
Extended thinking (`type: 'enabled'` with `budget_tokens`) is deprecated on `claude-opus-4-6`+. For those models, use [adaptive thinking](#adaptive-thinking--effort) instead.
94
+
Extended thinking (`type: 'enabled'` with `budget_tokens`) is deprecated on `claude-opus-4-6`+. For those models, use [adaptive thinking](#adaptive-thinking-effort) instead.
0 commit comments