From ecbd3deadfe9ffba3026c332b25b69d20a022d53 Mon Sep 17 00:00:00 2001 From: Alex Strick van Linschoten Date: Tue, 28 Oct 2025 14:09:16 +0100 Subject: [PATCH 1/5] bump openai model version --- .../openai_agents_sdk/openai_agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/agent_framework_integrations/openai_agents_sdk/openai_agent.py b/examples/agent_framework_integrations/openai_agents_sdk/openai_agent.py index cdbe2d9d2b..e0499a61a0 100644 --- a/examples/agent_framework_integrations/openai_agents_sdk/openai_agent.py +++ b/examples/agent_framework_integrations/openai_agents_sdk/openai_agent.py @@ -14,7 +14,7 @@ def get_weather(city: str) -> str: A string describing the weather conditions """ return ( - f"It's always sunny in {city}! Temperature is 72°F with clear skies." + f"It's always sunny in {city}! Temperature is 27°C with clear skies." ) @@ -48,6 +48,6 @@ def get_city_info(city: str) -> str: instructions="""You are a helpful travel assistant. You can provide weather information and general facts about cities around the world. When users ask about cities, use your available tools to get specific information. Be friendly and informative in your responses.""", - model="gpt-4o-mini", + model="gpt-5-nano", tools=[get_weather, get_city_info], ) From b1c2cfbd06d35d3baa23b5f95d9f964a78a40436 Mon Sep 17 00:00:00 2001 From: Alex Strick van Linschoten Date: Tue, 28 Oct 2025 14:12:42 +0100 Subject: [PATCH 2/5] Fix weather description and update city information in OpenAI agent example This commit corrects the temperature unit in the weather description from Celsius to Fahrenheit and updates the city information to provide a more accurate representation of the cities mentioned in the OpenAI agent example. No functional changes are expected as a result of this update. --- .../openai_agents_sdk/openai_agent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/agent_framework_integrations/openai_agents_sdk/openai_agent.py b/examples/agent_framework_integrations/openai_agents_sdk/openai_agent.py index e0499a61a0..efe20f13dd 100644 --- a/examples/agent_framework_integrations/openai_agents_sdk/openai_agent.py +++ b/examples/agent_framework_integrations/openai_agents_sdk/openai_agent.py @@ -14,7 +14,7 @@ def get_weather(city: str) -> str: A string describing the weather conditions """ return ( - f"It's always sunny in {city}! Temperature is 27°C with clear skies." + f"It's always sunny in {city}! Temperature is 72°F with clear skies." ) @@ -33,6 +33,7 @@ def get_city_info(city: str) -> str: "paris": "Paris is the capital of France, famous for the Eiffel Tower, art museums, and cuisine.", "new york": "New York City is the most populous city in the United States, known for its skyline, culture, and diversity.", "london": "London is the capital of England and the United Kingdom, famous for its history, architecture, and royal heritage.", + "munich": "Munich is the capital of Bavaria, Germany's third-largest city, famous for Oktoberfest, beer gardens, BMW headquarters, and its proximity to the Alps.", } city_lower = city.lower() From ef3127e4e02d44cb3c4471ee5a0f3ced853f0670 Mon Sep 17 00:00:00 2001 From: Alex Strick van Linschoten Date: Tue, 28 Oct 2025 15:10:20 +0100 Subject: [PATCH 3/5] added ui --- .../openai_agents_sdk/ui/index.html | 664 ++++++++++++++++++ 1 file changed, 664 insertions(+) create mode 100644 examples/agent_framework_integrations/openai_agents_sdk/ui/index.html diff --git a/examples/agent_framework_integrations/openai_agents_sdk/ui/index.html b/examples/agent_framework_integrations/openai_agents_sdk/ui/index.html new file mode 100644 index 0000000000..2766e2ac46 --- /dev/null +++ b/examples/agent_framework_integrations/openai_agents_sdk/ui/index.html @@ -0,0 +1,664 @@ + + + + + + Travel Assistant | ZenML + + + + + + + + +
+
+ +
+
+

OpenAI Agents Travel Assistant

+

+ Ask free‑form travel questions—fun facts, quick weather checks, and city info—powered by the OpenAI Agents SDK. +

+
+ +
+ + +
+

Try it

+
+ + + +
+ Fun fact: Tokyo + Weather: Paris + NYC highlights + Quick facts: London + Tips: Berlin +
+ +
+ + + +
+
+ +
+ + +
+
+ + + +
+
+ + + + + + From c142a2a6aaa744a6e3a1b1242b79b5085d162b2c Mon Sep 17 00:00:00 2001 From: Alex Strick van Linschoten Date: Tue, 28 Oct 2025 15:10:56 +0100 Subject: [PATCH 4/5] Update run.py to use new ui --- .../openai_agents_sdk/run.py | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/examples/agent_framework_integrations/openai_agents_sdk/run.py b/examples/agent_framework_integrations/openai_agents_sdk/run.py index 36b94b117f..7bcf440e42 100644 --- a/examples/agent_framework_integrations/openai_agents_sdk/run.py +++ b/examples/agent_framework_integrations/openai_agents_sdk/run.py @@ -8,10 +8,30 @@ from typing import Annotated, Any, Dict from zenml import pipeline, step -from zenml.config import DockerSettings, PythonPackageInstaller +from zenml.config import ( + DeploymentSettings, + DockerSettings, + SecureHeadersConfig, +) + +deploy_settings = DeploymentSettings( + app_title="Travel Assistant", + app_description=( + "A travel assistant that can provide weather information and general facts about cities around the world." + ), + app_version="0.1", + dashboard_files_path="ui", + secure_headers=SecureHeadersConfig( + csp=( + "default-src 'none'; " + "script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; " + "connect-src 'self' https://cdn.jsdelivr.net; " + "style-src 'self' 'unsafe-inline'" + ), + ), +) docker_settings = DockerSettings( - python_package_installer=PythonPackageInstaller.UV, requirements="requirements.txt", # relative to the pipeline directory environment={ "OPENAI_API_KEY": os.getenv("OPENAI_API_KEY"), @@ -162,7 +182,13 @@ def format_openai_response( return formatted.strip() -@pipeline(settings={"docker": docker_settings}, enable_cache=False) +@pipeline( + settings={ + "docker": docker_settings, + "deployment": deploy_settings, + }, + enable_cache=False, +) def agent_pipeline(query: str = "Tell me a fun fact about Tokyo") -> str: """ZenML pipeline that orchestrates the OpenAI Agents SDK. From ad3a27a740b345e47ef67e136ae5e0cd255c788b Mon Sep 17 00:00:00 2001 From: Alex Strick van Linschoten Date: Tue, 28 Oct 2025 15:13:17 +0100 Subject: [PATCH 5/5] Update OpenAI agent SDK README with deployment instructions Enhance the README for the OpenAI agent SDK by adding detailed instructions for deploying the pipeline as an HTTP service. This includes information on interacting with the service via CLI and HTTP API, as well as providing a custom web UI and API documentation links. This update aims to improve user experience and accessibility of the OpenAI agent integration. --- .../openai_agents_sdk/README.md | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/examples/agent_framework_integrations/openai_agents_sdk/README.md b/examples/agent_framework_integrations/openai_agents_sdk/README.md index 50a89b8059..312cf9d89c 100644 --- a/examples/agent_framework_integrations/openai_agents_sdk/README.md +++ b/examples/agent_framework_integrations/openai_agents_sdk/README.md @@ -29,11 +29,37 @@ Deploy this agent as a real-time HTTP service: ```bash # Deploy the pipeline as an HTTP service zenml pipeline deploy run.agent_pipeline --name openai-agents-agent +``` + +Once deployed, you can interact with the service in multiple ways: -# Invoke via CLI +### 🎨 Custom Web UI +Navigate to the root endpoint in your browser to access an interactive web interface: +``` +http://localhost:8000/ +``` + +The UI provides: +- Free-form query input with example suggestions +- Real-time agent responses with markdown rendering +- Visual feedback and error handling + +### 📚 API Documentation +FastAPI automatically generates interactive API documentation: +``` +http://localhost:8000/docs # Swagger UI +http://localhost:8000/redoc # ReDoc alternative +``` + +### 🔧 Programmatic Access + +**Via ZenML CLI:** +```bash zenml deployment invoke openai-agents-agent --query="Tell me a fun fact about Tokyo" +``` -# Invoke via HTTP API +**Via HTTP API:** +```bash curl -X POST http://localhost:8000/invoke \ -H "Content-Type: application/json" \ -d '{"parameters": {"query": "What are some interesting facts about space exploration?"}}' @@ -45,4 +71,4 @@ curl -X POST http://localhost:8000/invoke \ - **Function Tools**: Built-in tools with `@function_tool` decorator - **Tracing & Monitoring**: Comprehensive execution tracking - **Real-time Deployment**: Deploy as HTTP API for instant responses -- **ZenML Orchestration**: Full pipeline tracking and artifact management \ No newline at end of file +- **ZenML Orchestration**: Full pipeline tracking and artifact management