Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/agentex-tutorials-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ jobs:
id: run-test
working-directory: ./examples/tutorials
env:
OPENAI_API_KEY: ${{ secrets.TUTORIAL_OPENAI_API_KEY }}
# OpenAI calls go through an internal gateway that passes the OpenAI API through
# unchanged. The key and the gateway URL are both secrets, scoped to this CI.
OPENAI_API_KEY: ${{ secrets.TUTORIAL_SMIG_API_KEY }}
OPENAI_BASE_URL: ${{ secrets.TUTORIAL_OPENAI_BASE_URL }}
# The OpenAI Agents SDK exports traces to api.openai.com with OPENAI_API_KEY and ignores
# OPENAI_BASE_URL, which would send the gateway key to OpenAI. CI doesn't need those traces.
OPENAI_AGENTS_DISABLE_TRACING: "1"
ANTHROPIC_API_KEY: ${{ secrets.TUTORIAL_ANTHROPIC_API_KEY }}
# Enable the gated live tests only for the matching subprocess-CLI
# harness tutorial (the CLI is installed for it in the step above).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class StateModel(BaseModel):
turn_number: int


def _websearch_env():
"""Env for the web search MCP server: the OpenAI key, plus OPENAI_BASE_URL when set (for a gateway)."""
env = {"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")}
if os.environ.get("OPENAI_BASE_URL"):
env["OPENAI_BASE_URL"] = os.environ["OPENAI_BASE_URL"]
return env


MCP_SERVERS = [
StdioServerParameters(
command="npx",
Expand All @@ -59,7 +67,7 @@ class StateModel(BaseModel):
# unpinned, so cap it until the server allows a newer mcp.
command="uvx",
args=["--with", "pydantic<2.14", "openai-websearch-mcp"],
env={"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")},
env=_websearch_env(),
),
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class StateModel(BaseModel):
turn_number: int


def _websearch_env():
"""Env for the web search MCP server: the OpenAI key, plus OPENAI_BASE_URL when set (for a gateway)."""
env = {"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")}
if os.environ.get("OPENAI_BASE_URL"):
env["OPENAI_BASE_URL"] = os.environ["OPENAI_BASE_URL"]
return env


MCP_SERVERS = [ # No longer needed due to reasoning
# StdioServerParameters(
# command="npx",
Expand All @@ -59,7 +67,7 @@ class StateModel(BaseModel):
# pydantic helper that pydantic 2.14 removed; uvx resolves pydantic
# unpinned, so cap it until the server allows a newer mcp.
args=["--with", "pydantic<2.14", "openai-websearch-mcp"],
env={"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")},
env=_websearch_env(),
),
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@

logger = make_logger(__name__)


def _websearch_env():
"""Env for the web search MCP server: the OpenAI key, plus OPENAI_BASE_URL when set (for a gateway)."""
env = {"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")}
if os.environ.get("OPENAI_BASE_URL"):
env["OPENAI_BASE_URL"] = os.environ["OPENAI_BASE_URL"]
return env


# These reference MCP servers still import the mcp 1.x API (``McpError``), which
# mcp 2.0.0 renamed to ``MCPError``. uvx gives each server its own isolated env and
# resolves ``mcp`` unpinned there, ignoring the version this project pins, so without
Expand All @@ -31,9 +40,7 @@
StdioServerParameters(
command="uvx",
args=[*_MCP_PIN, "openai-websearch-mcp"],
env={
"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")
}
env=_websearch_env(),
),
StdioServerParameters(
command="uvx",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ class StateModel(BaseModel):
turn_number: int


def _websearch_env():
"""Env for the web search MCP server: the OpenAI key, plus OPENAI_BASE_URL when set (for a gateway)."""
env = {"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")}
if os.environ.get("OPENAI_BASE_URL"):
env["OPENAI_BASE_URL"] = os.environ["OPENAI_BASE_URL"]
return env


MCP_SERVERS = [
StdioServerParameters(
command="npx",
Expand All @@ -75,7 +83,7 @@ class StateModel(BaseModel):
StdioServerParameters(
command="uvx",
args=["openai-websearch-mcp"],
env={"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", "")},
env=_websearch_env(),
),
]

Expand Down
Loading