Agent Spec API¶
Declarative agent definitions in YAML or JSON. See Agent Spec (YAML/JSON) for the conceptual overview.
DeepAgentSpec¶
pydantic_deep.spec.DeepAgentSpec
¶
Bases: BaseModel
Declarative agent specification - mirrors create_deep_agent() params.
All fields have the same defaults as create_deep_agent().
Only serializable parameters are included (callbacks and Python objects
like backend, tools, toolsets must be passed as overrides).
DeepAgent¶
pydantic_deep.spec.DeepAgent
¶
Factory for creating deep agents from declarative specs.
Provides class methods to load agent configurations from YAML/JSON files or dicts, and save configurations to files.
from_file(path, **overrides)
classmethod
¶
Create an agent from a YAML or JSON spec file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to YAML (.yaml/.yml) or JSON (.json) file. |
required |
**overrides
|
Any
|
Override spec values (e.g., |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[Any, DeepAgentDeps]
|
Tuple of (agent, deps) ready for |
from_spec(data, **overrides)
classmethod
¶
Create an agent from a dict specification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Dict with |
required |
**overrides
|
Any
|
Override spec values. Takes precedence over data. |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[Any, DeepAgentDeps]
|
Tuple of (agent, deps) ready for |
to_file(path, **params)
classmethod
¶
Save agent parameters as a YAML or JSON spec file.
Only serializable parameters are saved. Non-serializable params (callbacks, Python objects) are silently excluded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Output path. Extension determines format (.yaml/.yml or .json). |
required |
**params
|
Any
|
|
{}
|