UAT: PlanGenerationGraph missing astream() method — async token streaming not available for plan generation workflow #5579

Open
opened 2026-04-09 07:39:51 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: LangGraph Integration — Streaming
Milestone: v3.2.0 (Runtime + Sessions)
Severity: Medium — async streaming path missing from primary workflow


What Was Tested

Code-level analysis of PlanGenerationGraph in src/cleveragents/agents/graphs/plan_generation.py compared to ContextAnalysisAgent and AutoDebugAgent.

Expected Behavior (from spec)

The spec requires both synchronous and asynchronous streaming for LangGraph workflows:

The runtime must support both synchronous (invoke) and asynchronous (ainvoke) methods with full streaming capabilities for events and results.

All three LangGraph workflow classes should expose the same streaming interface. ContextAnalysisAgent and AutoDebugAgent both implement astream() for async streaming.

Actual Behavior

PlanGenerationGraph implements:

  • invoke() — sync execution
  • ainvoke() — async execution
  • stream() — sync streaming
  • astream()MISSING — async streaming not implemented

Compare with ContextAnalysisAgent (lines 325–340 in context_analysis.py):

async def astream(
    self, input_state: ContextAnalysisState, config: dict[str, Any] | None = None
) -> AsyncIterator[dict[str, Any]]:
    """Asynchronously stream the context analysis workflow execution."""
    config = config or {}
    app_obj = cast(Any, self.app)
    astream_iter = cast(
        AsyncIterator[dict[str, Any]],
        app_obj.astream(cast(dict[str, Any], input_state), config),
    )
    async for event in astream_iter:
        yield event

PlanGenerationGraph has no equivalent method. The stream() method (lines 742–787) is synchronous only.

Code location: src/cleveragents/agents/graphs/plan_generation.pyastream() method absent.

Impact

  • Callers that need async streaming of plan generation events (e.g., TUI real-time updates) cannot use PlanGenerationGraph asynchronously.
  • The plan generation workflow is the primary workflow in the system; missing async streaming blocks real-time progress reporting.
  • Inconsistent API surface across the three LangGraph workflow classes.

Fix Direction

Add astream() to PlanGenerationGraph following the same pattern as ContextAnalysisAgent.astream():

async def astream(
    self,
    project: Project,
    plan: Plan,
    contexts: list[Context],
    thread_id: str = "default",
    actor_context: ActorInvocationContext | None = None,
) -> AsyncIterator[dict[str, Any]]:
    """Asynchronously stream the plan generation workflow execution."""
    initial_state = self._build_initial_state(project, plan, contexts, actor_context)
    config = {"configurable": {"thread_id": thread_id}}
    async for event in self.app.astream(initial_state, config):
        yield event

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area**: LangGraph Integration — Streaming **Milestone**: v3.2.0 (Runtime + Sessions) **Severity**: Medium — async streaming path missing from primary workflow --- ## What Was Tested Code-level analysis of `PlanGenerationGraph` in `src/cleveragents/agents/graphs/plan_generation.py` compared to `ContextAnalysisAgent` and `AutoDebugAgent`. ## Expected Behavior (from spec) The spec requires both synchronous and asynchronous streaming for LangGraph workflows: > The runtime must support both synchronous (`invoke`) and asynchronous (`ainvoke`) methods with full streaming capabilities for events and results. All three LangGraph workflow classes should expose the same streaming interface. `ContextAnalysisAgent` and `AutoDebugAgent` both implement `astream()` for async streaming. ## Actual Behavior `PlanGenerationGraph` implements: - ✅ `invoke()` — sync execution - ✅ `ainvoke()` — async execution - ✅ `stream()` — sync streaming - ❌ `astream()` — **MISSING** — async streaming not implemented Compare with `ContextAnalysisAgent` (lines 325–340 in `context_analysis.py`): ```python async def astream( self, input_state: ContextAnalysisState, config: dict[str, Any] | None = None ) -> AsyncIterator[dict[str, Any]]: """Asynchronously stream the context analysis workflow execution.""" config = config or {} app_obj = cast(Any, self.app) astream_iter = cast( AsyncIterator[dict[str, Any]], app_obj.astream(cast(dict[str, Any], input_state), config), ) async for event in astream_iter: yield event ``` `PlanGenerationGraph` has no equivalent method. The `stream()` method (lines 742–787) is synchronous only. **Code location**: `src/cleveragents/agents/graphs/plan_generation.py` — `astream()` method absent. ## Impact - Callers that need async streaming of plan generation events (e.g., TUI real-time updates) cannot use `PlanGenerationGraph` asynchronously. - The plan generation workflow is the primary workflow in the system; missing async streaming blocks real-time progress reporting. - Inconsistent API surface across the three LangGraph workflow classes. ## Fix Direction Add `astream()` to `PlanGenerationGraph` following the same pattern as `ContextAnalysisAgent.astream()`: ```python async def astream( self, project: Project, plan: Plan, contexts: list[Context], thread_id: str = "default", actor_context: ActorInvocationContext | None = None, ) -> AsyncIterator[dict[str, Any]]: """Asynchronously stream the plan generation workflow execution.""" initial_state = self._build_initial_state(project, plan, contexts, actor_context) config = {"configurable": {"thread_id": thread_id}} async for event in self.app.astream(initial_state, config): yield event ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-09 07:45:47 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#5579
No description provided.