Repository navigation
feat(chatbot): Enable coordinator node routing - #1330
Open
AkhileshNegi wants to merge 1 commit into
Open
AkhileshNegi wants to merge 1 commit into
AkhileshNegi wants to merge 1 commit into
Conversation
Coordinator node classifies each message against its outgoing edges' intents and silently hands off to the matched onboarding node in the same turn, or asks a clarifying question. A finished onboarding sub-flow returns the session to the coordinator. Publish validates a single coordinator with unique, non-empty edge intents targeting onboarding nodes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 1
Please check the settings in the CodeRabbit UI or the
|
OpenAPI changes ⚪ No API surface changesNote This PR does not modify the API contract.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This branch has not been deployed
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.
Issue
Closes #PLEASE_TYPE_ISSUE_NUMBER
Summary
coordinatornode resulted in a 422 error as coordinators were not supported, and sessions only executedonboardingnodes.Checklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.Notes
Please add here if any other information is required for the reviewer.
Original PR description
Summary
coordinatornodes now run. A coordinator reads each message, matches it to one of its outgoing edges bydata.intent, and hands off to thatonboardingnode in the same turn. If nothing matches, it asks a clarifying question. When an onboarding sub-flow finishes, the session goes back to the coordinator.sequenceDiagram participant Worker as process_chatbot_session_message participant Coord as run_coordinator_turn participant Agent as run_chatbot_turn (onboarding) Worker->>Worker: resolve coordinator + every route target's settings (one DB session, before any LLM call) Worker->>Coord: history + message + routes alt intent matched Coord-->>Worker: target_node_id Worker->>Agent: target prompt/config, shared collected_fields Agent-->>Worker: reply, is_complete Worker->>Worker: active_node_id = complete ? coordinator : target else no clear match Coord-->>Worker: clarifying_question Worker->>Worker: active_node_id unchanged end Worker-->>Worker: store reply (node_id = replying node), POST webhookThe coordinator is one structured-output call (
RouteDecision{intent, clarifying_question}). It doesn't use LangGraph. Intents are matched case-insensitively.New publish rules (
_list_coordinator_problems):Other changes:
to_provider_errorandSTRUCTURED_OUTPUT_METHODmoved from the onboarding graph toservices/chatbot/utils.py, so both agents share them.update_chatbot_session_progresstakes an optionalactive_node_id. PassingNoneleaves it unchanged.publish_flow,save_flow,send_session_message) and the wiki (modules/chatbot.md,domain-map.md) are updated.Evidence
coordinatornode → 422coordinator ... not supported yet. Sessions only ranonboardingnodes.After: the flow publishes, and a routed turn returns the onboarding agent's reply with
node_id= the agent node.New tests:
Local run:
coordinator/+services/chatbot/test_flow.py→ 36 passed. I couldn't run the DB-backed suites locally because my test DB is stamped with a migration from another branch (089). CI should run them.Merge Danger
Door: two-way
No migration and no schema change. Reverting brings back the old publish rule. A live flow published with a coordinator would then fail its turns with a failure webhook (
not supported yet) until it's republished without one.Blast Radius: chatbot-only
completion_statusnow applies to one sub-flow in coordinator flows: it'scompleteon the turn that finishes a sub-flow andin_progressagain on the next turn. Webhook consumers that treatcompleteas "session done" need to know this (documented insend_session_message.md).🤖 Generated with Claude Code