Skip to content

fix(workflow): Allow workflow tasks access results from previous dependent tasks #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/strands_tools/browser/agent_core_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

DEFAULT_IDENTIFIER = "aws.browser.v1"


class AgentCoreBrowser(Browser):
"""Bedrock AgentCore browser implementation."""

Expand Down
6 changes: 5 additions & 1 deletion src/strands_tools/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,11 @@ def execute_task(self, task: Dict, workflow: Dict) -> Dict:

# Extract response content - handle both dict and custom object return types
try:
content = result.get("content", []) if hasattr(result, "get") else getattr(result, "content", [])
content = (
result.message.get("content", [])
if hasattr(result.message, "get")
else getattr(result.message, "content", [])
)
except AttributeError:
content = [{"text": str(result)}]

Expand Down
14 changes: 6 additions & 8 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import pytest
from strands import Agent
from strands.agent import AgentResult
from strands_tools import workflow as workflow_module


Expand Down Expand Up @@ -415,14 +416,11 @@ def test_execute_task_success(self, mock_parent_agent, mock_agent_result):
):
# Create a proper mock agent result that returns structured data
mock_task_agent = MagicMock()
mock_result = MagicMock()
mock_result.__str__ = MagicMock(return_value="Task completed successfully")
mock_result.get = MagicMock(
side_effect=lambda k, default=None: {
"content": [{"text": "Task completed successfully"}],
"stop_reason": "completed",
"metrics": None,
}.get(k, default)
mock_result = AgentResult(
message={"content": [{"text": "Task completed successfully"}]},
stop_reason="completed",
metrics=None,
state=MagicMock(),
)

mock_task_agent.return_value = mock_result
Expand Down