Repository navigation
Description
🔴 Required Information
Describe the Bug:
SequentialAgent carries a deprecation warning saying "Please use Workflow instead."
However, Workflow is not a BaseAgent subclass and cannot be used in Agent.sub_agents,
which requires list[BaseAgent]. This leaves no ADK-native migration path for the
sub_agent composition pattern.
Steps to Reproduce:
- Install
google-adk==2.1.0 - Try to replace a
SequentialAgentsub_agent with aWorkflow:
from google.adk.workflow import Workflow
from google.adk.agents import Agent
pipeline = Workflow(name="pipeline", edges=[...])
root = Agent(
name="orchestrator",
sub_agents=[pipeline], # TypeError: Workflow is not BaseAgent
)- Observe Workflow is rejected because it is not a BaseAgent.
Expected Behavior:
Either Workflow implements BaseAgent so it can be passed as a sub_agent, or the
deprecation notice documents an explicit migration path for this composition pattern.
Observed Behavior:
from google.adk.workflow import Workflow
from google.adk.agents.base_agent import BaseAgent
issubclass(Workflow, BaseAgent) # False
from google.adk.agents import SequentialAgent
issubclass(SequentialAgent, BaseAgent) # True ← deprecated
Workflow → BaseNode only.
SequentialAgent → BaseAgent → BaseNode (deprecated, will be removed).
After removal, there is no BaseAgent-compatible sequential composition class.
Environment Details:
ADK Library Version: google-adk==2.1.0
Desktop OS: macOS
Python Version: 3.12
Model Information:
Are you using LiteLLM: Yes
Which model is being used: gpt-5.1 (via LiteLLM)
🟡 Optional Information
Regression:
N/A — SequentialAgent worked in prior versions. The deprecation was introduced in 2.x.
Logs:
N/A
Additional Context:
The workbench pattern (root Agent → SequentialAgent sub_agent → [gen_agent, review_agent])
is a common production pattern. Without a BaseAgent-compatible replacement, users must
either keep the deprecated class or abandon the sub_agent composition pattern entirely
and move all routing into a top-level Workflow, which has its own limitations
Activity
ruben-cid commentedon May 28, 2026
HI
There was this discussions for a similar topic / constraint if you are interested in the findings.
#5581
deepakbatham572 commentedon May 28, 2026
HI @GWeale could you please help here ?
surajksharma07 commentedon May 29, 2026
@deepakbatham572 A workaround worth trying: subclass BaseAgent, hold the Workflow as a field, and in _run_async_impl bridge via wf_ctx = Context(invocation_context=ctx, node=self.workflow), then delegate to self.workflow.run(ctx=wf_ctx, node_input=None).
Could you validate this covers your pipeline pattern and test it thoroughly on your side before we look at wiring it in natively?
deepakbatham572 commentedon Jun 4, 2026
Hi @surajksharma07 ,
Thanks — Two notes:
class WorkflowAgent(BaseAgent):
workflow: Workflow
async def _run_async_impl(self, ctx): # InvocationContext
wf_ctx = Context(invocation_context=ctx, node=self.workflow)
async for event in self.workflow.run(ctx=wf_ctx, node_input=...):
yield event
should Workflow expose a BaseAgent-compatible adapter natively so callers don't have to get this bridging right by hand?
surajksharma07 commentedon Jun 4, 2026
@deepakbatham572 You're right on all three points.
On re-yield: Yes, async for event in self.workflow.run(...): yield event is required — both sides are async generators. fix_5872.py already implements this correctly; the initial comment was imprecise in not making the generator delegation explicit.
On node_input: Pass ctx.user_content (the InvocationContext field that holds the original user message) instead of None. Internally, _seed_start_triggers() distributes node_input as trigger.input to all of START's direct successors, so None silently gives entry nodes no message to branch on.
The corrected bridge:
One caveat on resume turns (HITL): node_input becomes the latest user message rather than the original task brief — ADK itself flags this in _validate_no_task_mode_graph_nodes() in _workflow.py and blocks task-mode LlmAgents as static graph nodes for exactly this reason.
For single-turn, stateless functional nodes (pure transform/fetch), passing ctx.user_content is safe.
On Context without parent_ctx: What IS correctly threaded is everything flowing through the shared invocation_context — session, session_service, artifact_service, memory_service, user_content. Persistent session state writes from workflow nodes do propagate.
What is NOT wired: node_path starts from root rather than nested under the parent agent's path, so temp:* state written by workflow nodes operates in a separate namespace from the parent agent and won't be readable by it.
The more serious risk is HITL resumability — if a workflow node raises RequestInput, the suspended node's state lives in the workflow's own Context; on the next user turn the parent runner re-enters _run_async_impl and constructs a fresh Context, losing the scheduler's knowledge of which node was suspended. Multi-turn HITL inside the bridged workflow will silently restart rather than resume.
On the native adapter question: Yes, a first-class WorkflowAgent that handles node_input threading, proper parent_ctx construction, and HITL re-entry is the right answer — this is exactly the gap tracked in #5581.
We'll flag it to the team.
Until then, the workaround is reliable for single-turn, non-HITL pipelines with stateless nodes — avoid it for multi-turn workflows or any node that writes temp: scoped state the parent agent needs to read back.
deepakbatham572 commentedon Jun 9, 2026
Hi @surajksharma07 / @GWeale / @klateefa ,
is there any ETA when we are getting the fix ?
deepakbatham572 commentedon Jun 10, 2026
Hi @surajksharma07
any update ?
surajksharma07 commentedon Jun 12, 2026
@deepakbatham572 Honest status: no PR is linked to this or #5581 yet, and I re-checked v2.2.0 (released this week) — Workflow is still BaseNode-only, so nothing has landed for this.
Per the discussion in #5581, the team's current direction is the "node as a tool" pattern rather than making Workflow a BaseAgent, and the native WorkflowAgent adapter is still under internal discussion — I've flagged it again, but I can't commit to an ETA from my side.
Until then the bridge above remains the reliable path for single-turn, non-HITL pipelines.
I'll post here the moment a PR goes up!
deepakbatham572 commentedon Jul 2, 2026
Hi @GWeale , @surajksharma07, is there any update on this ?
fix: correct misleading workflow-agent deprecation messages
surajksharma07 commentedon Jul 13, 2026
@deepakbatham572 Good update — v2.4.0 shipped two real changes here.
The deprecation messages now say plainly that Workflow can't be used as an LlmAgent sub-agent yet (commit 53a8ab1), which matches your exact ask. More importantly, there's now a first-class "Workflow as Tool" feature (commit 1263ed6) — pass your Workflow straight into Agent(tools=[pipeline]) and ADK auto-wraps it as a callable NodeTool. It just needs pipeline.description set, or it raises a ValueError.
It's still not a sub_agent — the LLM decides when to invoke it rather than it running as a deterministic pipeline step, and Workflow is still BaseNode-only under the hood — but it's the officially supported path the team was pointing at back in #5581.
Could you try that in place of the WorkflowAgent bridge and confirm whether it covers your workbench pattern?
surajksharma07 commentedon Jul 31, 2026
Rechecked against the latest release (2.6.0) — Workflow is still BaseNode-only, so it can't be a sub_agent yet, that part's genuinely unresolved.
That said, both things called out here did ship in 2.4.0 and are still there: the deprecation message no longer implies Workflow is a drop-in replacement, and "Workflow as Tool" is now the officially supported path.
Since there's been no reply on whether that covers your workbench pattern, closing this for now — please reopen if it doesn't hold up, and #5581 is where the native sub_agent ask is being tracked!
fix: correct misleading workflow-agent deprecation messages