A simple documentation assistant built with LangGraph.
This is a documentation assistant agent that helps answer questions about LangChain, LangGraph, and LangSmith. It demonstrates how to build a production-ready agent using:
- LangGraph - For agent orchestration and state management
- LangChain Agents - For agent creation with middleware support
- Guardrails - To keep conversations on-topic
- Documentation Search - Searches official LangChain docs
- Support KB - Searches the Pylon knowledge base for known issues
- Link Validation - Verifies URLs before including in responses
- Guardrails - Filters off-topic queries
- Python 3.11+
- uv (recommended) or pip
# Clone the repository
git clone https://github.com/langchain-ai/chat-langchain.git
cd chat-langchain
# Install dependencies with uv
uv sync
# Or with pip
pip install -e . "langgraph-cli[inmem]"# Copy environment template
cp .env.example .env
# Edit .env with your API keys| Variable | Description |
|---|---|
ANTHROPIC_API_KEY |
Anthropic API key (or use another provider) |
MINTLIFY_API_KEY |
Mintlify API key for docs search |
PYLON_API_KEY |
Pylon API key for support KB |
# Start LangGraph development server
uv run langgraph dev
# Or with pip
langgraph devOpen LangGraph Studio: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
├── src/
│ ├── agent/
│ │ ├── docs_graph.py # Main docs agent
│ │ └── config.py # Model configuration
│ ├── tools/
│ │ ├── docs_tools.py # Documentation search
│ │ ├── pylon_tools.py # Support KB tools
│ │ └── link_check_tools.py # URL validation
│ ├── prompts/
│ │ └── docs_agent_prompt.py
│ └── middleware/
│ ├── guardrails_middleware.py
│ └── retry_middleware.py
├── langgraph.json # LangGraph configuration
└── pyproject.toml # Python project configThe agent uses a docs-first research strategy:
- Guardrails Check - Validates the query is LangChain-related
- Documentation Search - Searches official docs via Mintlify
- Knowledge Base - Searches Pylon for known issues/solutions
- Link Validation - Verifies any URLs before including them
- Response Generation - Synthesizes a helpful answer
- Push to GitHub
- Connect repository in LangSmith
- Configure environment variables
- Deploy
MIT