This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a LangGraph ReAct (Reasoning and Action) Agent template that implements an iterative reasoning agent using LangGraph framework. The agent processes user queries through a cycle of reasoning, action execution, and observation. Version 0.2.0 introduces comprehensive evaluation systems and expanded model provider support.
The core architecture follows a modular stateful graph pattern:
- Common Module: Shared components in
src/common/provide reusable functionality across agents - State Management: Uses
StateandInputStatedataclasses (defined insrc/react_agent/state.py) to track conversation messages and execution state - Graph Structure: The main graph is defined in
src/react_agent/graph.pywith two primary nodes:call_model: Handles LLM reasoning and tool selectiontools: Executes selected tools via ToolNode
- Execution Flow:
call_model→ conditional routing → eithertools(if tool calls needed) or__end__(if ready to respond) → back tocall_model(creates the ReAct loop) - Context System: Runtime context defined in
src/common/context.pyprovides model configuration, system prompts, and DeepWiki integration control - Dynamic Tools: Runtime tool loading with MCP integration for external documentation sources (DeepWiki MCP server)
- Model Providers: Multi-provider support including Anthropic, OpenAI, Qwen, QwQ, QvQ, and SiliconFlow with regional endpoint configuration
# Run specific test types
make test # Run unit and integration tests (default)
make test_unit # Run unit tests only
make test_integration # Run integration tests only
make test_e2e # Run e2e tests only (requires running LangGraph server)
make test_all # Run all tests (unit + integration + e2e)
# Watch mode for continuous testing
make test_watch # Run unit tests in watch mode
make test_watch_unit # Run unit tests in watch mode
make test_watch_integration # Run integration tests in watch mode
make test_watch_e2e # Run e2e tests in watch mode
# Additional test options
make extended_tests # Run extended test suite# Comprehensive evaluation suite (NEW in v0.2.0)
make evals # Run all evaluations (graph + multiturn)
make eval_graph # Run graph trajectory evaluations (LLM-as-judge)
make eval_multiturn # Run multi-turn chat evaluations (role-persona simulations)
# Model-specific evaluations
make eval_graph_qwen # Test with Qwen/Qwen3-8B model
make eval_graph_glm # Test with THUDM/GLM-4-9B model
# Persona-specific evaluations
make eval_multiturn_polite # Test with polite persona
make eval_multiturn_hacker # Test with hacker personamake lint # Run linters (ruff + mypy)
make format # Auto-format code with ruff
make lint_package # Lint only src/ directory
make lint_tests # Lint only tests/ directorymake dev # Start LangGraph development server
make dev_ui # Start LangGraph development server with UI- Copy
.env.exampleto.envand configure API keys - Required:
TAVILY_API_KEYfor web search functionality - Model Providers:
ANTHROPIC_API_KEYfor Anthropic modelsOPENAI_API_KEYfor OpenAI modelsDASHSCOPE_API_KEYfor Qwen/QwQ/QvQ modelsSILICONFLOW_API_KEYfor SiliconFlow models (NEW in v0.2.0)
- Optional:
REGION(set toprc/cnorinternational/enfor regional API endpoints) - Optional:
ENABLE_DEEPWIKI=trueto enable DeepWiki MCP documentation tools - Default Model: Uses
qwen:qwen-flashas default model (configurable viaMODELenvironment variable)
src/react_agent/graph.py: Main graph definition and ReAct loop implementationsrc/react_agent/state.py: State management with message tracking viaadd_messagesannotation
src/common/context.py: Runtime context and configuration with environment variable support and DeepWiki integrationsrc/common/tools.py: Tool definitions including web search and dynamic MCP tool loadingsrc/common/mcp.py: MCP client management for external documentation sources (e.g. DeepWiki)src/common/models/: Model provider integrations with regional API supportqwen.py: Qwen, QwQ, QvQ model integrations via DashScopesiliconflow.py: SiliconFlow model integrations (NEW in v0.2.0)
src/common/prompts.py: System prompt templatessrc/common/utils.py: Shared utility functions including model loading
langgraph.json: LangGraph Studio configuration pointing to the main graph.env: Environment variables for API keys and configuration
tests/evaluations/: Comprehensive evaluation frameworkgraph.py: Graph trajectory evaluation using AgentEvals with LLM-as-judge methodologymultiturn.py: Multi-turn chat evaluation with role-persona simulationsconfig.py: Evaluation configuration and test scenariosutils.py: Shared evaluation utilities and scoring functions
This project works seamlessly with LangGraph Studio. The langgraph.json config file defines:
- Graph entry point:
./src/react_agent/graph.py:graph - Environment file:
.env - Dependencies: current directory (
.)
This project integrates with Model Context Protocol (MCP) servers for dynamic external tool loading:
- DeepWiki MCP Server: Provides documentation tools for GitHub repositories
- Dynamic Loading: Tools are loaded at runtime based on context configuration
- Caching: MCP client and tools are cached for performance
- Configuration: Enable via
ENABLE_DEEPWIKI=trueenvironment variable or context parameter - Server Configuration: MCP servers configured in
src/common/mcp.py
- Set
enable_deepwiki=Truein Context to load DeepWiki tools - Tools include repository documentation access and Q&A capabilities
- Integrated seamlessly with LangGraph ReAct pattern for tool execution
- Python requirement:
>=3.11,<4.0 - Main dependencies: LangGraph, LangChain, provider-specific packages, langchain-mcp-adapters, langchain-siliconflow
- Development tools: mypy, ruff, pytest, langgraph-cli, langgraph-sdk
- Evaluation dependencies: openevals, agentevals, langsmith (NEW in v0.2.0)
- Package structure supports both standalone and LangGraph template usage
- Research Tools: Use
context7and/ordeepwikito study unfamiliar projects or frameworks - Code Quality: Always run
make lintafter completing tasks - Testing: Comprehensive test suite includes unit, integration, and e2e tests with DeepWiki MCP integration coverage
- Evaluation: Use
make evalsto run comprehensive agent evaluations (NEW in v0.2.0)- Graph trajectory evaluation with LLM-as-judge methodology
- Multi-turn conversation evaluation with role-persona simulations
- Model-specific testing across different providers (Qwen, GLM, etc.)
- MCP Integration: DeepWiki tools are dynamically loaded when
enable_deepwiki=Truein context configuration - Multi-Model Support: Test across different providers using evaluation commands for comprehensive coverage