Skip to content

Commit c074afc

Browse files
author
Fox Qin
committed
fix(workflow): Allow workflow tasks access results from previous dependent tasks
1 parent fb32b51 commit c074afc

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/strands_tools/browser/agent_core_browser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
DEFAULT_IDENTIFIER = "aws.browser.v1"
2020

21+
2122
class AgentCoreBrowser(Browser):
2223
"""Bedrock AgentCore browser implementation."""
2324

src/strands_tools/workflow.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,11 @@ def execute_task(self, task: Dict, workflow: Dict) -> Dict:
445445

446446
# Extract response content - handle both dict and custom object return types
447447
try:
448-
content = result.get("content", []) if hasattr(result, "get") else getattr(result, "content", [])
448+
content = (
449+
result.message.get("content", [])
450+
if hasattr(result.message, "get")
451+
else getattr(result.message, "content", [])
452+
)
449453
except AttributeError:
450454
content = [{"text": str(result)}]
451455

tests/test_workflow.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import pytest
1111
from strands import Agent
12+
from strands.agent import AgentResult
1213
from strands_tools import workflow as workflow_module
1314

1415

@@ -415,14 +416,11 @@ def test_execute_task_success(self, mock_parent_agent, mock_agent_result):
415416
):
416417
# Create a proper mock agent result that returns structured data
417418
mock_task_agent = MagicMock()
418-
mock_result = MagicMock()
419-
mock_result.__str__ = MagicMock(return_value="Task completed successfully")
420-
mock_result.get = MagicMock(
421-
side_effect=lambda k, default=None: {
422-
"content": [{"text": "Task completed successfully"}],
423-
"stop_reason": "completed",
424-
"metrics": None,
425-
}.get(k, default)
419+
mock_result = AgentResult(
420+
message={"content": [{"text": "Task completed successfully"}]},
421+
stop_reason="completed",
422+
metrics=None,
423+
state=MagicMock(),
426424
)
427425

428426
mock_task_agent.return_value = mock_result

0 commit comments

Comments
 (0)