Skip to content

Commit 6dc883b

Browse files
Merge pull request #290 from scaleapi/dm/fix-sync-openai-agents-template
Fix missing imports in sync-openai-agents template
2 parents b1f5ff8 + 50a0d78 commit 6dc883b

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ dependencies = [
4949
"claude-agent-sdk>=0.1.0",
5050
"anthropic>=0.40.0",
5151
"langgraph-checkpoint>=2.0.0",
52+
"opentelemetry-sdk>=1.20.0",
53+
"opentelemetry-api>=1.20.0",
5254
]
5355

5456
requires-python = ">= 3.12,<4"

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ from agentex.lib.core.tracing.tracing_processor_manager import add_tracing_proce
99
from agentex.lib.types.tracing import SGPTracingProcessorConfig
1010
from agentex.lib.utils.model_utils import BaseModel
1111

12-
from agentex.types.task_message_update import TaskMessageUpdate
12+
from agentex.types.task_message_update import TaskMessageUpdate, StreamTaskMessageFull
1313
from agentex.types.task_message_content import TaskMessageContent
14+
from agentex.types.text_content import TextContent
1415
from agentex.lib.utils.logging import make_logger
1516
from agents import Agent, Runner, RunConfig, function_tool
1617

@@ -83,6 +84,7 @@ async def handle_message_send(
8384
content="Hey, sorry I'm unable to respond to your message because you're running this example without an OpenAI API key. Please set the OPENAI_API_KEY environment variable to run this example. Do this by either by adding a .env file to the project/ directory or by setting the environment variable in your terminal.",
8485
),
8586
)
87+
return
8688

8789
user_prompt = params.content.content
8890

src/agentex/lib/core/clients/temporal/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from temporalio.worker import Interceptor
77
from temporalio.runtime import Runtime, TelemetryConfig, OpenTelemetryConfig
88
from temporalio.contrib.pydantic import pydantic_data_converter
9-
from temporalio.contrib.openai_agents import OpenAIAgentsPlugin
109

1110
# class DateTimeJSONEncoder(AdvancedJSONEncoder):
1211
# def default(self, o: Any) -> Any:
@@ -97,6 +96,8 @@ async def get_temporal_client(temporal_address: str, metrics_url: str | None = N
9796
validate_client_plugins(plugins)
9897

9998
# Check if OpenAI plugin is present - it needs to configure its own data converter
99+
# Lazy import to avoid pulling in opentelemetry.sdk for non-Temporal agents
100+
from temporalio.contrib.openai_agents import OpenAIAgentsPlugin
100101
has_openai_plugin = any(
101102
isinstance(p, OpenAIAgentsPlugin) for p in (plugins or [])
102103
)

uv.lock

Lines changed: 32 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)