Community: LangGraph three-agent debate with dynamic routing#1288
Merged
ed-donner merged 3 commits intoed-donner:mainfrom Apr 23, 2026
Merged
Conversation
Made-with: Cursor
…gchain-google-genai - Start graph at for_agent (drop coin_toss); refresh ASCII diagram and copy - Comment out Step 6 streaming with note to uncomment when needed - Add langchain-google-genai dependency for init_chat_model(google_genai) Made-with: Cursor
70635eb to
297b423
Compare
Owner
|
Hi - thank you for the contribution. It's not practical or feasible to change dependencies for the entire repo. With 200,000 people on the course, and the need for all labs to work on all systems, merging this PR would involve very significant retesting. If you have additional project dependencies, simply note that in your contribution; others can run "uv add" themselves. Thanks so much |
Contributor
Author
|
Makes sense I will remove the dependency and resubmit the PR. Thanks! |
…add in notebook Per maintainer request, community contributions avoid repo-wide dependency changes; notebook notes uv add langchain-google-genai and raises a clear ImportError if the package is missing. Made-with: Cursor
Owner
|
Great - thanks so much! |
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.
Title
Community: LangGraph three-agent debate (dynamic routing + debiasing)
Description
Adds
4_langgraph/community_contributions/three_agent_debate_langgraph/three_agent_debate.ipynb: a for / against / moderator debate on a shared topic, orchestrated as a LangGraph workflow.Pattern: Supervisor-style moderator routes turns; two debater nodes produce arguments. Runtime routing via
Command(goto=..., update=...)(not only static edges). SharedDebateStatewith list reducers (Annotated[list[str], add]) for growing transcripts.MemorySavercheckpointer. Moderator/judge use structured outputs (Pydantic) for decisions and final verdict. Optional Step 6 (app.stream(..., stream_mode="updates")) is included but commented out in the notebook—uncomment that cell if you want live node-by-node output.Anchoring bias: LLMs can overweight early arguments or a one-sided view. The graph always opens with
for_agent→against_agentso the moderator’s first pass happens only after both openings exist; it requires at least one follow-up before allowing an early end, and caps moderator rounds with a forced winner/tie when stopping.Dependencies: Adds
langchain-google-genaitopyproject.tomlsoinit_chat_model(..., model_provider="google_genai")works (runuv lock/uv synclocally to refreshuv.lockif needed).Run: Set
GEMINI_API_KEY(and optionallyGEMINI_MODEL) in.env.