Skip to content

Commit 1ffe32f

Browse files
Merge pull request #291 from scaleapi/dm/retrigger-tutorial-tests
Fix temporal worker imports and streaming tutorial for CI
2 parents aa3aaa1 + 1dd4ef9 commit 1ffe32f

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

.github/workflows/agentex-tutorials-test.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,24 +145,30 @@ jobs:
145145
working-directory: ./examples/tutorials
146146
run: |
147147
echo "🚨 Test failed for tutorial: ${{ matrix.tutorial }}"
148-
echo "📋 Printing agent logs..."
149148
150-
# Look for agent log files in the tutorial directory
151-
if find "${{ matrix.tutorial }}" -name "*.log" -type f 2>/dev/null | grep -q .; then
152-
echo "Found agent log files:"
153-
find "${{ matrix.tutorial }}" -name "*.log" -type f -exec echo "=== {} ===" \; -exec cat {} \;
149+
# Print agent logs from /tmp (where run_agent_test.sh writes them)
150+
tutorial_name=$(basename "${{ matrix.tutorial }}")
151+
agent_log="/tmp/agentex-${tutorial_name}.log"
152+
if [[ -f "$agent_log" ]]; then
153+
echo "📋 Agent logs ($agent_log):"
154+
echo "----------------------------------------"
155+
tail -100 "$agent_log"
156+
echo "----------------------------------------"
154157
else
155-
echo "No .log files found, checking for other common log locations..."
158+
echo "⚠️ No agent log at $agent_log"
159+
echo "Available /tmp/agentex-*.log files:"
160+
ls -la /tmp/agentex-*.log 2>/dev/null || echo " (none)"
156161
fi
157162
158-
# Check for any output files or dumps
159-
if find "${{ matrix.tutorial }}" -name "agent_output*" -o -name "debug*" -o -name "*.out" 2>/dev/null | grep -q .; then
160-
echo "Found other output files:"
161-
find "${{ matrix.tutorial }}" -name "agent_output*" -o -name "debug*" -o -name "*.out" -exec echo "=== {} ===" \; -exec cat {} \;
162-
fi
163+
# Print Docker server logs
164+
echo ""
165+
echo "📋 AgentEx Server (Docker) logs:"
166+
echo "----------------------------------------"
167+
cd ../../scale-agentex/agentex && docker compose logs --tail=100 agentex 2>/dev/null || echo "Could not retrieve Docker logs"
168+
echo "----------------------------------------"
163169
164-
# Print the last 50 lines of any python processes that might still be running
165-
echo "🔍 Checking for running python processes..."
170+
echo ""
171+
echo "🔍 Running python processes:"
166172
ps aux | grep python || echo "No python processes found"
167173
168174
- name: Record test result

examples/tutorials/00_sync/020_streaming/project/acp.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
from agentex.lib import adk
77
from agentex.lib.types.acp import SendMessageParams
8+
from agentex.types.text_content import TextContent
89
from agentex.lib.types.converters import convert_task_messages_to_oai_agents_inputs
910
from agentex.lib.utils.model_utils import BaseModel
1011
from agentex.lib.sdk.fastacp.fastacp import FastACP
1112
from agentex.types.task_message_update import TaskMessageUpdate, StreamTaskMessageFull
12-
from agentex.types.task_message_content import TextContent, TaskMessageContent
13+
from agentex.types.task_message_content import TaskMessageContent
1314
from agentex.lib.adk.providers._modules.sync_provider import (
1415
SyncStreamingProvider,
1516
convert_openai_to_agentex_events,
@@ -56,6 +57,7 @@ async def handle_message_send(
5657
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.",
5758
),
5859
)
60+
return
5961

6062
# Try to retrieve the state. If it doesn't exist, create it.
6163
task_state = await adk.state.get_by_task_and_agent(task_id=params.task.id, agent_id=params.agent.id)

src/agentex/lib/core/temporal/workers/worker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
DefaultPayloadConverter,
2525
CompositePayloadConverter,
2626
JSONPlainPayloadConverter,
27-
_JSONTypeConverterUnhandled,
2827
)
29-
from temporalio.contrib.openai_agents import OpenAIAgentsPlugin
3028

3129
from agentex.lib.utils.logging import make_logger
3230
from agentex.lib.utils.registration import register_agent
@@ -45,7 +43,7 @@ def default(self, o: Any) -> Any:
4543

4644
class DateTimeJSONTypeConverter(JSONTypeConverter):
4745
@override
48-
def to_typed_value(self, hint: type, value: Any) -> Any | None | _JSONTypeConverterUnhandled:
46+
def to_typed_value(self, hint: type, value: Any) -> Any | None:
4947
if hint == datetime.datetime:
5048
return datetime.datetime.fromisoformat(value)
5149
return JSONTypeConverter.Unhandled
@@ -96,6 +94,8 @@ async def get_temporal_client(temporal_address: str, metrics_url: str | None = N
9694
_validate_plugins(plugins)
9795

9896
# Check if OpenAI plugin is present - it needs to configure its own data converter
97+
# Lazy import to avoid pulling in opentelemetry.sdk for non-Temporal agents
98+
from temporalio.contrib.openai_agents import OpenAIAgentsPlugin
9999
has_openai_plugin = any(
100100
isinstance(p, OpenAIAgentsPlugin) for p in (plugins or [])
101101
)

uv.lock

Lines changed: 1 addition & 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)