feat: suppress SSE events for internal graph nodes#204
Open
skattoju wants to merge 5 commits into
Open
Conversation
Add explicit depends_on for destination_research, hotel_research, and flight_research nodes so the pipeline executes sequentially instead of fan-out racing ahead of its data source. Made-with: Cursor
Add an `internal` flag to graph node configs. When set to true, the node still executes and its output flows through graph state to downstream nodes, but no node_started/response/node_completed SSE events are emitted to the frontend. This keeps intermediate data (e.g. the places_list_task JSON array) out of the user-facing chat. Mark places_list_task as internal in the vacation planner template. Made-with: Cursor
Internal node outputs were still leaking to users because _run_llm_node dumps all prior outputs into the prompt as "Outputs so far". Downstream LLMs (e.g. itinerary_options_task) would see the raw places JSON and echo it in their response. Filter internal node IDs out of the outputs dict before passing it to LLM nodes. MCP tool nodes still receive the full outputs so items_path resolution continues to work. Made-with: Cursor
Nodes that exist solely to produce a list for mcp_tool_map fan-out (referenced via items_path) are now automatically treated as internal even when the graph_config stored in the database lacks the explicit internal: true flag. This fixes the case where agents created before the YAML update still expose intermediate data to users. Also consolidates the internal flag in task output to use the merged _internal_ids set (explicit + auto-detected) instead of only checking the step config. Made-with: Cursor
Both tasks only depend on itinerary_options_task, not on each other. Changing flight_research_task to depend on itinerary_options_task instead of hotel_research_task lets them fan out concurrently. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal: trueflag for graph node configs. Internal nodes still execute and pass data through graph state to downstream nodes, but their SSE events (node_started,response,node_completed) are suppressed so intermediate data (e.g. raw JSON arrays) never appears in the user's chat.depends_onfordestination_research_task,hotel_research_task, andflight_research_taskso the pipeline executes in the correct sequence.places_list_taskasinternal: truein the vacation planner template since it only exists to feed the downstreamdestination_research_taskfan-out.Test plan
pytest tests/unit/test_graph_engine.py— all 38 tests pass including the newtest_internal_node_suppresseddestination_research_taskviaitems_path)Made with Cursor