Skip to content

Commit 870324e

Browse files
fix: wire SGP_CLIENT_BASE_URL and silence openai-agents tracer in templates (#352)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent dcb1cb4 commit 870324e

9 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/agentex/lib/cli/templates/default-langgraph/.env.example.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ LITELLM_API_KEY=
1010
# SGP Configuration (optional - for tracing)
1111
# SGP_API_KEY=
1212
# SGP_ACCOUNT_ID=
13+
# SGP_CLIENT_BASE_URL=

src/agentex/lib/cli/templates/default/.env.example.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ LITELLM_API_KEY=
1010
# SGP Configuration (optional - for tracing)
1111
# SGP_API_KEY=
1212
# SGP_ACCOUNT_ID=
13+
# SGP_CLIENT_BASE_URL=

src/agentex/lib/cli/templates/sync-langgraph/.env.example.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ LITELLM_API_KEY=
1010
# SGP Configuration (optional - for tracing)
1111
# SGP_API_KEY=
1212
# SGP_ACCOUNT_ID=
13+
# SGP_CLIENT_BASE_URL=

src/agentex/lib/cli/templates/sync-openai-agents/.env.example.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ LITELLM_API_KEY=
1010
# SGP Configuration (optional - for tracing)
1111
# SGP_API_KEY=
1212
# SGP_ACCOUNT_ID=
13+
# SGP_CLIENT_BASE_URL=

src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ from agentex.types.task_message_update import TaskMessageUpdate, StreamTaskMessa
1313
from agentex.types.task_message_content import TaskMessageContent
1414
from agentex.types.text_content import TextContent
1515
from agentex.lib.utils.logging import make_logger
16-
from agents import Agent, Runner, RunConfig, function_tool
16+
from agents import Agent, Runner, RunConfig, function_tool, set_tracing_disabled
17+
18+
# Disable the openai-agents SDK's native tracer so it doesn't ship traces to
19+
# api.openai.com using OPENAI_API_KEY (which may be a LiteLLM proxy key).
20+
# SGP tracing below still runs via the Agentex tracing manager.
21+
set_tracing_disabled(True)
1722

1823

1924
logger = make_logger(__name__)
@@ -25,12 +30,14 @@ if _litellm_key:
2530

2631
SGP_API_KEY = os.environ.get("SGP_API_KEY", "")
2732
SGP_ACCOUNT_ID = os.environ.get("SGP_ACCOUNT_ID", "")
33+
SGP_CLIENT_BASE_URL = os.environ.get("SGP_CLIENT_BASE_URL", "")
2834

2935
if SGP_API_KEY and SGP_ACCOUNT_ID:
3036
add_tracing_processor_config(
3137
SGPTracingProcessorConfig(
3238
sgp_api_key=SGP_API_KEY,
3339
sgp_account_id=SGP_ACCOUNT_ID,
40+
sgp_base_url=SGP_CLIENT_BASE_URL,
3441
)
3542
)
3643

src/agentex/lib/cli/templates/sync/.env.example.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ LITELLM_API_KEY=
1010
# SGP Configuration (optional - for tracing)
1111
# SGP_API_KEY=
1212
# SGP_ACCOUNT_ID=
13+
# SGP_CLIENT_BASE_URL=

src/agentex/lib/cli/templates/temporal-openai-agents/.env.example.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ LITELLM_API_KEY=
1010
# SGP Configuration (optional - for tracing)
1111
# SGP_API_KEY=
1212
# SGP_ACCOUNT_ID=
13+
# SGP_CLIENT_BASE_URL=

src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ from agentex.lib.core.temporal.types.workflow import SignalName
1010
from agentex.lib.utils.logging import make_logger
1111
from agentex.types.text_content import TextContent
1212
from agentex.lib.environment_variables import EnvironmentVariables
13-
from agents import Agent, Runner
13+
from agents import Agent, Runner, set_tracing_disabled
14+
15+
# Disable the openai-agents SDK's native tracer so it doesn't ship traces to
16+
# api.openai.com using OPENAI_API_KEY (which may be a LiteLLM proxy key).
17+
# SGP tracing below still runs via the Agentex tracing manager.
18+
set_tracing_disabled(True)
19+
1420
from agentex.lib.core.temporal.plugins.openai_agents.hooks.hooks import TemporalStreamingHooks
1521
from pydantic import BaseModel
1622
from typing import List, Dict, Any
@@ -39,6 +45,7 @@ add_tracing_processor_config(
3945
SGPTracingProcessorConfig(
4046
sgp_api_key=os.environ.get("SGP_API_KEY", ""),
4147
sgp_account_id=os.environ.get("SGP_ACCOUNT_ID", ""),
48+
sgp_base_url=os.environ.get("SGP_CLIENT_BASE_URL", ""),
4249
)
4350
)
4451

src/agentex/lib/cli/templates/temporal/.env.example.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ LITELLM_API_KEY=
1010
# SGP Configuration (optional - for tracing)
1111
# SGP_API_KEY=
1212
# SGP_ACCOUNT_ID=
13+
# SGP_CLIENT_BASE_URL=

0 commit comments

Comments
 (0)