Skip to content

Community: LangGraph three-agent debate with dynamic routing#1288

Merged
ed-donner merged 3 commits intoed-donner:mainfrom
srinivasrk:community/three-agent-debate-langgraph
Apr 23, 2026
Merged

Community: LangGraph three-agent debate with dynamic routing#1288
ed-donner merged 3 commits intoed-donner:mainfrom
srinivasrk:community/three-agent-debate-langgraph

Conversation

@srinivasrk
Copy link
Copy Markdown
Contributor

@srinivasrk srinivasrk commented Apr 10, 2026

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). Shared DebateState with list reducers (Annotated[list[str], add]) for growing transcripts. MemorySaver checkpointer. 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_agentagainst_agent so 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-genai to pyproject.toml so init_chat_model(..., model_provider="google_genai") works (run uv lock / uv sync locally to refresh uv.lock if needed).

Run: Set GEMINI_API_KEY (and optionally GEMINI_MODEL) in .env.

…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
@srinivasrk srinivasrk force-pushed the community/three-agent-debate-langgraph branch from 70635eb to 297b423 Compare April 10, 2026 01:58
@ed-donner
Copy link
Copy Markdown
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

@srinivasrk
Copy link
Copy Markdown
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
@ed-donner
Copy link
Copy Markdown
Owner

Great - thanks so much!

@ed-donner ed-donner merged commit d3e9cf9 into ed-donner:main Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants