PydanticAI extends the Pydantic ecosystem with type-safe AI agents that validate structured outputs and integrate tools. Running them with ZenML puts these agents into production-ready pipelines, ensuring reproducibility, artifact lineage, and deployment flexibility.
from zenml import ExternalArtifact, pipeline, step
from pydanticai_agent import agent
@step
def run_pydanticai(query: str) -> str:
result = agent.run_sync(query)
return str(result.output)
@pipeline
def pydanticai_agent_pipeline() -> str:
q = ExternalArtifact(value="What is the secret data?")
return run_pydanticai(q.value)
if __name__ == "__main__":
print(pydanticai_agent_pipeline())Expand your ML pipelines with more than 50 ZenML Integrations