diff --git a/src/agentex/lib/cli/templates/default-langgraph/.env.example.j2 b/src/agentex/lib/cli/templates/default-langgraph/.env.example.j2 index 1e81b15dd..015f49ef7 100644 --- a/src/agentex/lib/cli/templates/default-langgraph/.env.example.j2 +++ b/src/agentex/lib/cli/templates/default-langgraph/.env.example.j2 @@ -10,3 +10,4 @@ LITELLM_API_KEY= # SGP Configuration (optional - for tracing) # SGP_API_KEY= # SGP_ACCOUNT_ID= +# SGP_CLIENT_BASE_URL= diff --git a/src/agentex/lib/cli/templates/default/.env.example.j2 b/src/agentex/lib/cli/templates/default/.env.example.j2 index 1e81b15dd..015f49ef7 100644 --- a/src/agentex/lib/cli/templates/default/.env.example.j2 +++ b/src/agentex/lib/cli/templates/default/.env.example.j2 @@ -10,3 +10,4 @@ LITELLM_API_KEY= # SGP Configuration (optional - for tracing) # SGP_API_KEY= # SGP_ACCOUNT_ID= +# SGP_CLIENT_BASE_URL= diff --git a/src/agentex/lib/cli/templates/sync-langgraph/.env.example.j2 b/src/agentex/lib/cli/templates/sync-langgraph/.env.example.j2 index 1e81b15dd..015f49ef7 100644 --- a/src/agentex/lib/cli/templates/sync-langgraph/.env.example.j2 +++ b/src/agentex/lib/cli/templates/sync-langgraph/.env.example.j2 @@ -10,3 +10,4 @@ LITELLM_API_KEY= # SGP Configuration (optional - for tracing) # SGP_API_KEY= # SGP_ACCOUNT_ID= +# SGP_CLIENT_BASE_URL= diff --git a/src/agentex/lib/cli/templates/sync-openai-agents/.env.example.j2 b/src/agentex/lib/cli/templates/sync-openai-agents/.env.example.j2 index 1e81b15dd..015f49ef7 100644 --- a/src/agentex/lib/cli/templates/sync-openai-agents/.env.example.j2 +++ b/src/agentex/lib/cli/templates/sync-openai-agents/.env.example.j2 @@ -10,3 +10,4 @@ LITELLM_API_KEY= # SGP Configuration (optional - for tracing) # SGP_API_KEY= # SGP_ACCOUNT_ID= +# SGP_CLIENT_BASE_URL= diff --git a/src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2 b/src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2 index 2295eccb3..0b3b482fe 100644 --- a/src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2 +++ b/src/agentex/lib/cli/templates/sync-openai-agents/project/acp.py.j2 @@ -13,7 +13,12 @@ from agentex.types.task_message_update import TaskMessageUpdate, StreamTaskMessa from agentex.types.task_message_content import TaskMessageContent from agentex.types.text_content import TextContent from agentex.lib.utils.logging import make_logger -from agents import Agent, Runner, RunConfig, function_tool +from agents import Agent, Runner, RunConfig, function_tool, set_tracing_disabled + +# Disable the openai-agents SDK's native tracer so it doesn't ship traces to +# api.openai.com using OPENAI_API_KEY (which may be a LiteLLM proxy key). +# SGP tracing below still runs via the Agentex tracing manager. +set_tracing_disabled(True) logger = make_logger(__name__) @@ -25,12 +30,14 @@ if _litellm_key: SGP_API_KEY = os.environ.get("SGP_API_KEY", "") SGP_ACCOUNT_ID = os.environ.get("SGP_ACCOUNT_ID", "") +SGP_CLIENT_BASE_URL = os.environ.get("SGP_CLIENT_BASE_URL", "") if SGP_API_KEY and SGP_ACCOUNT_ID: add_tracing_processor_config( SGPTracingProcessorConfig( sgp_api_key=SGP_API_KEY, sgp_account_id=SGP_ACCOUNT_ID, + sgp_base_url=SGP_CLIENT_BASE_URL, ) ) diff --git a/src/agentex/lib/cli/templates/sync/.env.example.j2 b/src/agentex/lib/cli/templates/sync/.env.example.j2 index 1e81b15dd..015f49ef7 100644 --- a/src/agentex/lib/cli/templates/sync/.env.example.j2 +++ b/src/agentex/lib/cli/templates/sync/.env.example.j2 @@ -10,3 +10,4 @@ LITELLM_API_KEY= # SGP Configuration (optional - for tracing) # SGP_API_KEY= # SGP_ACCOUNT_ID= +# SGP_CLIENT_BASE_URL= diff --git a/src/agentex/lib/cli/templates/temporal-openai-agents/.env.example.j2 b/src/agentex/lib/cli/templates/temporal-openai-agents/.env.example.j2 index 1e81b15dd..015f49ef7 100644 --- a/src/agentex/lib/cli/templates/temporal-openai-agents/.env.example.j2 +++ b/src/agentex/lib/cli/templates/temporal-openai-agents/.env.example.j2 @@ -10,3 +10,4 @@ LITELLM_API_KEY= # SGP Configuration (optional - for tracing) # SGP_API_KEY= # SGP_ACCOUNT_ID= +# SGP_CLIENT_BASE_URL= diff --git a/src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2 b/src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2 index 94b5221fb..5b95d4479 100644 --- a/src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2 +++ b/src/agentex/lib/cli/templates/temporal-openai-agents/project/workflow.py.j2 @@ -10,7 +10,13 @@ from agentex.lib.core.temporal.types.workflow import SignalName from agentex.lib.utils.logging import make_logger from agentex.types.text_content import TextContent from agentex.lib.environment_variables import EnvironmentVariables -from agents import Agent, Runner +from agents import Agent, Runner, set_tracing_disabled + +# Disable the openai-agents SDK's native tracer so it doesn't ship traces to +# api.openai.com using OPENAI_API_KEY (which may be a LiteLLM proxy key). +# SGP tracing below still runs via the Agentex tracing manager. +set_tracing_disabled(True) + from agentex.lib.core.temporal.plugins.openai_agents.hooks.hooks import TemporalStreamingHooks from pydantic import BaseModel from typing import List, Dict, Any @@ -39,6 +45,7 @@ add_tracing_processor_config( SGPTracingProcessorConfig( sgp_api_key=os.environ.get("SGP_API_KEY", ""), sgp_account_id=os.environ.get("SGP_ACCOUNT_ID", ""), + sgp_base_url=os.environ.get("SGP_CLIENT_BASE_URL", ""), ) ) diff --git a/src/agentex/lib/cli/templates/temporal/.env.example.j2 b/src/agentex/lib/cli/templates/temporal/.env.example.j2 index 1e81b15dd..015f49ef7 100644 --- a/src/agentex/lib/cli/templates/temporal/.env.example.j2 +++ b/src/agentex/lib/cli/templates/temporal/.env.example.j2 @@ -10,3 +10,4 @@ LITELLM_API_KEY= # SGP Configuration (optional - for tracing) # SGP_API_KEY= # SGP_ACCOUNT_ID= +# SGP_CLIENT_BASE_URL=