Skip to content

feat(examples): rewrite LangGraph integration with customer support domain#300

Merged
sanjeed5 merged 2 commits intofederated-sdk-release-candidatefrom
feat/langgraph-example-update
Mar 10, 2026
Merged

feat(examples): rewrite LangGraph integration with customer support domain#300
sanjeed5 merged 2 commits intofederated-sdk-release-candidatefrom
feat/langgraph-example-update

Conversation

@sanjeed5
Copy link
Contributor

@sanjeed5 sanjeed5 commented Mar 2, 2026

Example Update: langgraph

File: python-sdk/examples/integrations/langgraph_integration.py
Framework version: langgraph 1.0.10
Status: Updated

Summary

  • Rewrote the LangGraph example from scratch to match the customer support domain used by other integration examples (ADK, PydanticAI)
  • Upgraded from deprecated create_react_agent (langgraph.prebuilt) to create_agent (langchain.agents)
  • Added three comprehensive scenarios showcasing key LangGraph patterns

Patterns Covered

  • Agent names/hierarchy: yes (support_agent, order_specialist, policy_specialist, support_agent_with_memory)
  • System instructions: yes (each agent has explicit system prompts)
  • User input/model output: yes
  • Tool calls (args + results): yes (lookup_order_status, lookup_policy with ORD-1001 through ORD-1003)
  • Session continuity: yes (Scenario 3 uses MemorySaver checkpointer with thread_id)
  • Multi-agent delegation: yes (Scenario 2: coordinator routes to specialist subgraphs)
  • Routing with structured output: yes (RouteDecision Pydantic model with conditional edges)

Changes Made

  • Replaced generic calculator/knowledge-base scenarios with customer support domain
  • Added Scenario 1: Single agent with tools via create_agent
  • Added Scenario 2: Multi-agent delegation with coordinator StateGraph + specialist subgraph agents
  • Added Scenario 3: Multi-turn conversation with MemorySaver checkpointing
  • Switched imports from langchain.messages to langchain_core.messages
  • Added langchain to install deps (required for create_agent)
  • Wrapped all execution in main() function with proper force_flush()

Tracing Issues Found

  • None found. 60 events captured correctly: 1 session, 38 chain, 15 model, 6 tool. All agent names, tool calls, and hierarchy properly traced.

Links


Open with Devin

…omain

- Switch from generic calculator/knowledge-base scenarios to customer
  support domain (ORD-1001 through ORD-1003, lookup_order_status,
  lookup_policy) matching other integration examples
- Add three scenarios: single agent with tools, multi-agent delegation
  via subgraphs (coordinator + specialists), and multi-turn with
  checkpointing (session continuity)
- Upgrade from deprecated create_react_agent to langchain.agents.create_agent
- Use langchain_core.messages imports (no full langchain.messages dependency)
- Add proper agent names and system instructions for each scenario
@sanjeed5 sanjeed5 requested a review from a team March 2, 2026 18:10
@snyk-io
Copy link

snyk-io bot commented Mar 2, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@claude
Copy link
Contributor

claude bot commented Mar 2, 2026

Claude finished @sanjeed5's task in 3m 6s —— View job


  • Read PR diff and changed files
  • Analyze code for issues, best practices, and patterns
  • Post inline comments for specific feedback
  • Post top-level review summary

Result

Reviewed the LangGraph integration rewrite. This is a clean, well-structured update that properly migrates to the new create_agent API from LangChain 1.0 and aligns the example with the customer support domain used by other integration examples. No blocking issues found — left two minor inline nits on type annotations and a positive note on the os.getenv improvement.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

📚 Documentation preview built — Download artifact

Review instructions & validation status

How to Review

  1. Download the artifact from the link above
  2. Extract the files
  3. Open index.html in your browser

Validation Status

  • API validation: ✅ Passed
  • Build process: ✅ Successful
  • Import tests: ✅ All imports working

claude[bot]

This comment was marked as resolved.

claude[bot]

This comment was marked as resolved.

@claude
Copy link
Contributor

claude bot commented Mar 2, 2026

Review Summary

Overall: Looks great — this is a clean, well-structured rewrite that significantly improves the LangGraph example.

What looks good:

  • Clean migration from deprecated create_react_agent (langgraph.prebuilt) to the new create_agent (langchain.agents), aligned with LangChain 1.0
  • The customer support domain is consistent with the PydanticAI and ADK examples — same lookup_order_status / lookup_policy tools and mock data
  • Proper main() entry point with if __name__ == "__main__" guard (previously ran at module level)
  • try/finally ensures force_flush() is called even on error — good pattern for examples
  • Switch from os.environ[] (crash on missing key) to os.getenv() (graceful None) follows the SDK's graceful degradation principle
  • Three scenarios demonstrate progressively more advanced patterns: single agent → multi-agent delegation → stateful multi-turn

No blocking issues found. Two minor inline nits left on the diff.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

📚 Documentation preview built — Download artifact

Review instructions & validation status

How to Review

  1. Download the artifact from the link above
  2. Extract the files
  3. Open index.html in your browser

Validation Status

  • API validation: ✅ Passed
  • Build process: ✅ Successful
  • Import tests: ✅ All imports working

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@sanjeed5 sanjeed5 merged commit 57b83ce into federated-sdk-release-candidate Mar 10, 2026
7 checks passed
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