Skip to content

Commit 8b48ca2

Browse files
Merge branch 'main' into fs/reasoning
2 parents f1a167d + d73c1b0 commit 8b48ca2

File tree

11 files changed

+43
-18
lines changed

11 files changed

+43
-18
lines changed

examples/tutorials/10_agentic/10_temporal/000_hello_acp/project/run_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from agentex.lib.utils.debug import setup_debug_if_enabled
77
from agentex.lib.environment_variables import EnvironmentVariables
88

9-
from workflow import At000HelloAcpWorkflow
9+
from project.workflow import At000HelloAcpWorkflow
1010

1111

1212

examples/tutorials/10_agentic/10_temporal/010_agent_chat/project/run_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from agentex.lib.utils.debug import setup_debug_if_enabled
77
from agentex.lib.environment_variables import EnvironmentVariables
88

9-
from workflow import At010AgentChatWorkflow
9+
from project.workflow import At010AgentChatWorkflow
1010

1111

1212

examples/tutorials/10_agentic/10_temporal/020_state_machine/project/run_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from agentex.lib.utils.debug import setup_debug_if_enabled
77
from agentex.lib.environment_variables import EnvironmentVariables
88

9-
from workflow import At020StateMachineWorkflow
9+
from project.workflow import At020StateMachineWorkflow
1010

1111

1212
environment_variables = EnvironmentVariables.refresh()

examples/tutorials/10_agentic/10_temporal/020_state_machine/project/workflow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
from agentex.lib.environment_variables import EnvironmentVariables
1313
from agentex.lib.sdk.state_machine.state import State
1414

15-
from state_machines.deep_research import DeepResearchStateMachine, DeepResearchState, DeepResearchData
16-
from workflows.deep_research.clarify_user_query import ClarifyUserQueryWorkflow
17-
from workflows.deep_research.waiting_for_user_input import WaitingForUserInputWorkflow
18-
from workflows.deep_research.performing_deep_research import PerformingDeepResearchWorkflow
15+
from project.state_machines.deep_research import DeepResearchStateMachine, DeepResearchState, DeepResearchData
16+
from project.workflows.deep_research.clarify_user_query import ClarifyUserQueryWorkflow
17+
from project.workflows.deep_research.waiting_for_user_input import WaitingForUserInputWorkflow
18+
from project.workflows.deep_research.performing_deep_research import PerformingDeepResearchWorkflow
1919

2020
environment_variables = EnvironmentVariables.refresh()
2121

examples/tutorials/10_agentic/10_temporal/020_state_machine/project/workflows/deep_research/clarify_user_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from agentex.lib.types.llm_messages import LLMConfig, SystemMessage, UserMessage
77
from agentex.lib.utils.logging import make_logger
88

9-
from state_machines.deep_research import DeepResearchData, DeepResearchState
9+
from project.state_machines.deep_research import DeepResearchData, DeepResearchState
1010

1111
logger = make_logger(__name__)
1212

examples/tutorials/10_agentic/10_temporal/020_state_machine/project/workflows/deep_research/performing_deep_research.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from agentex.types.text_content import TextContent
1111
from agentex.lib.utils.logging import make_logger
1212

13-
from state_machines.deep_research import DeepResearchData, DeepResearchState
13+
from project.state_machines.deep_research import DeepResearchData, DeepResearchState
1414

1515
logger = make_logger(__name__)
1616

examples/tutorials/10_agentic/10_temporal/020_state_machine/project/workflows/deep_research/waiting_for_user_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from agentex.lib.sdk.state_machine import StateWorkflow, StateMachine
33
from agentex.lib.utils.logging import make_logger
44
from temporalio import workflow
5-
from state_machines.deep_research import DeepResearchData, DeepResearchState
5+
from project.state_machines.deep_research import DeepResearchData, DeepResearchState
66

77
logger = make_logger(__name__)
88

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies = [
3232
"jinja2>=3.1.3,<4",
3333
"mcp[cli]>=1.4.1",
3434
"scale-gp>=0.1.0a59",
35-
"openai-agents>=0.0.7,!=0.2.3", # 0.2.3 bug - https://github.com/openai/openai-agents-python/issues/1276
35+
"openai-agents==0.2.7", # 0.2.3 bug - https://github.com/openai/openai-agents-python/issues/1276
3636
"tzlocal>=5.3.1",
3737
"tzdata>=2025.2",
3838
"pytest>=8.4.0",

src/agentex/lib/cli/handlers/run_handlers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ async def start_temporal_worker_with_reload(
8989
worker_path: Path, env: dict[str, str], process_manager: ProcessManager, manifest_dir: Path
9090
) -> asyncio.Task[None]:
9191
"""Start temporal worker with auto-reload using watchfiles"""
92-
9392
try:
9493
from watchfiles import awatch
9594
except ImportError:
9695
console.print("[yellow]watchfiles not installed, falling back to basic worker start[/yellow]")
9796
console.print("[dim]Install with: pip install watchfiles[/dim]")
9897
# Fallback to regular worker without reload
99-
worker_process = await start_temporal_worker(worker_path, env)
98+
worker_process = await start_temporal_worker(worker_path, env, manifest_dir)
10099
process_manager.add_process(worker_process)
101100
return asyncio.create_task(stream_process_output(worker_process, "WORKER"))
102101

@@ -114,6 +113,7 @@ async def start_worker() -> asyncio.subprocess.Process:
114113
# Extract agent name from worker path for cleanup
115114

116115
agent_name = env.get("AGENT_NAME")
116+
console.print(f"FOUND AGENT_NAME FROM ENV VARS: {agent_name} {agent_name is None}")
117117
if agent_name is None:
118118
agent_name = worker_path.parent.parent.name
119119

@@ -150,12 +150,12 @@ async def start_worker() -> asyncio.subprocess.Process:
150150

151151
try:
152152
# Start initial worker
153-
await start_worker()
153+
current_process = await start_worker()
154154
if current_process:
155155
output_task = asyncio.create_task(stream_process_output(current_process, "WORKER"))
156156

157157
# Watch for file changes
158-
async for changes in awatch(worker_path.parent):
158+
async for changes in awatch(manifest_dir, recursive=True):
159159
# Filter for Python files
160160
py_changes = [(change, path) for change, path in changes if str(path).endswith('.py')]
161161

@@ -225,7 +225,9 @@ async def start_temporal_worker(
225225
worker_path: Path, env: dict[str, str], manifest_dir: Path
226226
) -> asyncio.subprocess.Process:
227227
"""Start the temporal worker process"""
228-
cmd = [sys.executable, "-m", "run_worker"]
228+
run_worker_target = calculate_uvicorn_target_for_local(worker_path, manifest_dir)
229+
230+
cmd = [sys.executable, "-m", run_worker_target]
229231

230232
console.print(f"[blue]Starting Temporal worker from {worker_path}...[/blue]")
231233

src/agentex/lib/core/services/adk/providers/openai.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,30 @@ async def run_agent_streamed_auto_send(
657657
),
658658
)
659659

660+
elif event.item.type == "reasoning_item":
661+
# Handle reasoning items
662+
reasoning_item = event.item.raw_item
663+
664+
reasoning_content = ReasoningContent(
665+
author="agent",
666+
summary=[summary.text for summary in reasoning_item.summary],
667+
content=[content.text for content in reasoning_item.content] if hasattr(reasoning_item, "content") else None,
668+
)
660669

670+
# Create reasoning content using streaming context (immediate completion)
671+
async with (
672+
self.streaming_service.streaming_task_message_context(
673+
task_id=task_id,
674+
initial_content=reasoning_content,
675+
) as streaming_context
676+
):
677+
# The message has already been persisted, but we still need to send an update
678+
await streaming_context.stream_update(
679+
update=StreamTaskMessageFull(
680+
parent_task_message=streaming_context.task_message,
681+
content=reasoning_content,
682+
),
683+
)
661684

662685
elif event.type == "raw_response_event":
663686
if isinstance(event.data, ResponseTextDeltaEvent):

0 commit comments

Comments
 (0)