The OpenAI Agents SDK lets you build structured agents that use GPT models with function tools and tracing. Integrating it with ZenML wraps those agents inside reproducible pipelines with artifact tracking, observability, and deployment flexibility, so your prototypes scale into production-ready systems.
@function_tool decorator.from zenml import ExternalArtifact, pipeline, step
from openai_agent import agent
import agents
@step
def run_openai(query: str) -> str:
runner = agents.run.DEFAULT_AGENT_RUNNER
result = runner.run_sync(agent, query)
return str(result.final_output)
@pipeline
def openai_agent_pipeline() -> str:
q = ExternalArtifact(value="Tell me a fun fact about Tokyo")
return run_openai(q.value)
if __name__ == "__main__":
print(openai_agent_pipeline())Expand your ML pipelines with more than 50 ZenML Integrations