Skip to content

Commit 0060113

Browse files
committed
Update tests
1 parent a9501c0 commit 0060113

File tree

13 files changed

+82
-53
lines changed

13 files changed

+82
-53
lines changed

examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/manifest.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ agent:
9696
- env_var_name: REDIS_URL
9797
secret_name: redis-url-secret
9898
secret_key: url
99-
# - env_var_name: OPENAI_API_KEY
100-
# secret_name: openai-api-key
101-
# secret_key: api-key
99+
# - env_var_name: OPENAI_API_KEY
100+
# secret_name: openai-api-key
101+
# secret_key: api-key
102102

103103
# Optional: Set Environment variables for running your agent locally as well
104104
# as for deployment later on
105-
env: {}
106-
# OPENAI_API_KEY: ""
105+
env:
106+
OPENAI_API_KEY: ""
107107
# OPENAI_BASE_URL: "<YOUR_OPENAI_BASE_URL_HERE>"
108-
# OPENAI_ORG_ID: ""
108+
OPENAI_ORG_ID: ""
109109

110110

111111
# Deployment Configuration

examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/run_worker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ async def main():
3434
# ============================================================================
3535
# This is where the streaming magic is configured! Two key components:
3636
#
37-
# 1. ContextInterceptor (StreamingInterceptor)
37+
# 1. ContextInterceptor
3838
# - Threads task_id through activity headers using Temporal's interceptor pattern
3939
# - Outbound: Reads _task_id from workflow instance, injects into activity headers
4040
# - Inbound: Extracts task_id from headers, sets streaming_task_id ContextVar
4141
# - This enables runtime context without forking the Temporal plugin!
4242
#
4343
# 2. TemporalStreamingModelProvider
44-
# - Returns StreamingModel instances that read task_id from ContextVar
45-
# - StreamingModel.get_response() streams tokens to Redis in real-time
44+
# - Returns TemporalStreamingModel instances that read task_id from ContextVar
45+
# - TemporalStreamingModel.get_response() streams tokens to Redis in real-time
4646
# - Still returns complete response to Temporal for determinism/replay safety
4747
# - Uses AgentEx ADK streaming infrastructure (Redis XADD to stream:{task_id})
4848
#

examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/project/workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ async def on_task_event_send(self, params: SendEventParams) -> None:
176176
# 5. The conversation state is preserved even if the worker restarts
177177
#
178178
# STREAMING MAGIC (via Interceptors + Model Provider):
179-
# - The StreamingInterceptor threads task_id through activity headers
180-
# - The StreamingModelProvider returns a model that streams to Redis
179+
# - The ContextInterceptor threads task_id through activity headers
180+
# - The TemporalStreamingModelProvider returns a model that streams to Redis
181181
# - The model streams tokens in real-time while maintaining determinism
182182
# - Complete response is still returned to Temporal for replay safety
183183
#

examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/manifest.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ agent:
100100

101101
# Optional: Set Environment variables for running your agent locally as well
102102
# as for deployment later on
103-
env: {}
104-
# OPENAI_API_KEY: ""
103+
env:
104+
OPENAI_API_KEY: ""
105105
# OPENAI_BASE_URL: "<YOUR_OPENAI_BASE_URL_HERE>"
106-
# OPENAI_ORG_ID: ""
106+
OPENAI_ORG_ID: ""
107107

108108

109109
# Deployment Configuration

examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/run_worker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ async def main():
3636
# ============================================================================
3737
# This is where the streaming magic is configured! Two key components:
3838
#
39-
# 1. ContextInterceptor (StreamingInterceptor)
39+
# 1. ContextInterceptor
4040
# - Threads task_id through activity headers using Temporal's interceptor pattern
4141
# - Outbound: Reads _task_id from workflow instance, injects into activity headers
4242
# - Inbound: Extracts task_id from headers, sets streaming_task_id ContextVar
4343
# - This enables runtime context without forking the Temporal plugin!
4444
#
4545
# 2. TemporalStreamingModelProvider
46-
# - Returns StreamingModel instances that read task_id from ContextVar
47-
# - StreamingModel.get_response() streams tokens to Redis in real-time
46+
# - Returns TemporalStreamingModel instances that read task_id from ContextVar
47+
# - TemporalStreamingModel.get_response() streams tokens to Redis in real-time
4848
# - Still returns complete response to Temporal for determinism/replay safety
4949
# - Uses AgentEx ADK streaming infrastructure (Redis XADD to stream:{task_id})
5050
#

examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/project/workflow.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,17 @@ async def on_task_event_send(self, params: SendEventParams) -> None:
210210
# ============================================================================
211211
# STREAMING SETUP: Store task_id for the Interceptor
212212
# ============================================================================
213-
# These instance variables are read by StreamingWorkflowOutboundInterceptor
213+
# These instance variables are read by ContextWorkflowOutboundInterceptor
214214
# which injects them into activity headers. This enables streaming without
215215
# forking the Temporal plugin!
216216
#
217217
# How streaming works (Interceptor + Model Provider + Hooks):
218218
# 1. We store task_id in workflow instance variable (here)
219-
# 2. StreamingWorkflowOutboundInterceptor reads it via workflow.instance()
219+
# 2. ContextWorkflowOutboundInterceptor reads it via workflow.instance()
220220
# 3. Interceptor injects task_id into activity headers
221-
# 4. StreamingActivityInboundInterceptor extracts from headers
221+
# 4. ContextActivityInboundInterceptor extracts from headers
222222
# 5. Sets streaming_task_id ContextVar inside the activity
223-
# 6. StreamingModel reads from ContextVar and streams to Redis
223+
# 6. TemporalStreamingModel reads from ContextVar and streams to Redis
224224
# 7. TemporalStreamingHooks creates placeholder messages for tool calls
225225
#
226226
# This approach uses STANDARD Temporal components - no forked plugin needed!
@@ -237,7 +237,7 @@ async def on_task_event_send(self, params: SendEventParams) -> None:
237237
# What hooks do:
238238
# - on_tool_call_start(): Creates tool_request message with arguments
239239
# - on_tool_call_done(): Creates tool_response message with result
240-
# - on_model_stream_part(): Called for each streaming chunk (handled by StreamingModel)
240+
# - on_model_stream_part(): Called for each streaming chunk (handled by TemporalStreamingModel)
241241
# - on_run_done(): Marks the final response as complete
242242
#
243243
# These hooks create the messages you see in the test output:

examples/tutorials/10_async/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,8 @@ async def test_send_event_and_poll(self, client: AsyncAgentex, agent_id: str):
9999
task_id=task.id,
100100
user_message=user_message,
101101
timeout=60,
102-
sleep_interval=1.0,
103-
yield_updates=True, # Get all streaming chunks
104-
):
102+
sleep_interval=1.0
103+
):
105104
assert isinstance(message, TaskMessage)
106105
print(f"[DEBUG 070 POLL] Received message - Type: {message.content.type if message.content else 'None'}, Author: {message.content.author if message.content else 'None'}, Status: {message.streaming_status}")
107106

examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/manifest.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ agent:
102102

103103
# Optional: Set Environment variables for running your agent locally as well
104104
# as for deployment later on
105-
env: {}
106-
# OPENAI_API_KEY: "" # Set this in your shell environment instead
105+
env:
106+
OPENAI_API_KEY: ""
107107
# OPENAI_BASE_URL: "<YOUR_OPENAI_BASE_URL_HERE>"
108-
# OPENAI_ORG_ID: ""
108+
OPENAI_ORG_ID: ""
109109

110110

111111
# Deployment Configuration

examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/acp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444
# ============================================================================
4545
# This is where the streaming magic is configured! Two key components:
4646
#
47-
# 1. ContextInterceptor (StreamingInterceptor)
47+
# 1. ContextInterceptor
4848
# - Threads task_id through activity headers using Temporal's interceptor pattern
4949
# - Outbound: Reads _task_id from workflow instance, injects into activity headers
5050
# - Inbound: Extracts task_id from headers, sets streaming_task_id ContextVar
5151
# - This enables runtime context without forking the Temporal plugin!
5252
#
5353
# 2. TemporalStreamingModelProvider
54-
# - Returns StreamingModel instances that read task_id from ContextVar
55-
# - StreamingModel.get_response() streams tokens to Redis in real-time
54+
# - Returns TemporalStreamingModel instances that read task_id from ContextVar
55+
# - TemporalStreamingModel.get_response() streams tokens to Redis in real-time
5656
# - Still returns complete response to Temporal for determinism/replay safety
5757
# - Uses AgentEx ADK streaming infrastructure (Redis XADD to stream:{task_id})
5858
#

examples/tutorials/10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/project/run_worker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ async def main():
3838
# ============================================================================
3939
# This is where the streaming magic is configured! Two key components:
4040
#
41-
# 1. ContextInterceptor (StreamingInterceptor)
41+
# 1. ContextInterceptor
4242
# - Threads task_id through activity headers using Temporal's interceptor pattern
4343
# - Outbound: Reads _task_id from workflow instance, injects into activity headers
4444
# - Inbound: Extracts task_id from headers, sets streaming_task_id ContextVar
4545
# - This enables runtime context without forking the Temporal plugin!
4646
#
4747
# 2. TemporalStreamingModelProvider
48-
# - Returns StreamingModel instances that read task_id from ContextVar
49-
# - StreamingModel.get_response() streams tokens to Redis in real-time
48+
# - Returns TemporalStreamingModel instances that read task_id from ContextVar
49+
# - TemporalStreamingModel.get_response() streams tokens to Redis in real-time
5050
# - Still returns complete response to Temporal for determinism/replay safety
5151
# - Uses AgentEx ADK streaming infrastructure (Redis XADD to stream:{task_id})
5252
#

0 commit comments

Comments
 (0)