From 9a7b760f13af1d3701928693e66cc8a2443401c7 Mon Sep 17 00:00:00 2001 From: Declan Brady Date: Thu, 9 Jul 2026 20:14:22 -0400 Subject: [PATCH] fix: cap openai <2.45 for openai-agents 0.14.x compatibility openai 2.45.0 made `InputTokensDetails.cache_write_tokens` a required field, but openai-agents 0.14.x (the latest release) still constructs `InputTokensDetails(cached_tokens=0)` in agents/usage.py. As a result every `Runner.run_streamed` call raises a pydantic ValidationError at context setup, before any LLM request. The repo's own uv.lock pins openai 2.40.0 so unit tests pass, but the tutorial agents resolve their dependencies fresh (no lockfile) and pick up openai 2.45.0, which is why the "Test Tutorial Agents" workflow fails on every branch for all openai-agents based tutorials (010_multiturn, 020_streaming, temporal openai-agents tools/HIL, state_machine, and the other-SDKs base tutorial). Capping openai <2.45 in the agentex-sdk deps makes fresh resolves land on openai 2.44.0, which is compatible. Drop the ceiling once openai-agents ships a fix. Co-Authored-By: Claude Opus 4.8 --- adk/pyproject.toml | 9 ++++++++- uv.lock | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/adk/pyproject.toml b/adk/pyproject.toml index 183d2999a..d8968334e 100644 --- a/adk/pyproject.toml +++ b/adk/pyproject.toml @@ -41,7 +41,14 @@ dependencies = [ # LLM provider integrations "litellm>=1.83.7,<2", "openai-agents>=0.14.3,<0.15", - "openai>=2.2,<3", # Required by openai-agents; litellm now supports openai 2.x (issue #13711 resolved: https://github.com/BerriAI/litellm/issues/13711) + # Cap <2.45: openai 2.45.0 makes InputTokensDetails.cache_write_tokens a + # required field, but openai-agents 0.14.x still builds + # InputTokensDetails(cached_tokens=0) (agents/usage.py), so every + # Runner.run_streamed raises a pydantic ValidationError at context setup. + # openai-agents 0.14.8 is the latest release, so there is no newer version + # to bump to; drop this ceiling once openai-agents ships a fix. + # litellm now supports openai 2.x (issue #13711 resolved: https://github.com/BerriAI/litellm/issues/13711) + "openai>=2.2,<2.45", "claude-agent-sdk>=0.1.0", "pydantic-ai-slim>=1.0,<2", "langgraph-checkpoint>=2.0.0", diff --git a/uv.lock b/uv.lock index 6262ccc38..43de6493c 100644 --- a/uv.lock +++ b/uv.lock @@ -91,7 +91,7 @@ dev = [ [[package]] name = "agentex-sdk" -version = "0.13.0" +version = "0.17.0" source = { editable = "adk" } dependencies = [ { name = "agentex-client" }, @@ -144,7 +144,7 @@ requires-dist = [ { name = "langgraph-checkpoint", specifier = ">=2.0.0" }, { name = "litellm", specifier = ">=1.83.7,<2" }, { name = "mcp", specifier = ">=1.4.1" }, - { name = "openai", specifier = ">=2.2,<3" }, + { name = "openai", specifier = ">=2.2,<2.45" }, { name = "openai-agents", specifier = ">=0.14.3,<0.15" }, { name = "opentelemetry-api", specifier = ">=1.20.0" }, { name = "opentelemetry-sdk", specifier = ">=1.20.0" },