MCPcopy Index your code
hub / github.com/christian-bromann/langchat

github.com/christian-bromann/langchat @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
105 symbols 239 edges 46 files 7 documented · 7%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

LangChat

A sandbox for showcasing different use cases of LangChain's createAgent with various agent scenarios and capabilities.

Overview

This is a Next.js application that demonstrates various LangChain agent patterns and capabilities, including tool use, human-in-the-loop, context management, and more.

Agent Scenarios

The application includes the following agent scenarios:

  • Simple Agent - Basic agent with tool calling capabilities
  • Human In the Loop - Agents that request human approval before executing actions
  • Summarization - Context summarization for managing long conversations
  • Model Call Limits - Controlling the number of model calls
  • Tool Call Limits - Limiting tool execution attempts
  • Tool Retry - Automatic retry logic for failed tool calls
  • Model Fallback - Fallback to alternative models on failure
  • Tool Emulator - Emulating tool behavior for testing
  • Todo List - Task management agent
  • Context Editing - Dynamic context manipulation
  • PII Redaction - Automatic redaction of personally identifiable information
  • Content Moderation - Content filtering and moderation
  • Cloudflare MCP Agent - Integration with Anthropic's built-in MCP toolset and Cloudflare's managed MCP servers

Getting Started

First, install dependencies:

pnpm install

Then, run the development server:

pnpm dev

Open http://localhost:3000 with your browser to see the result.

API Keys

You'll need an Anthropic API key to use the application. Enter it in the sidebar when prompted.

For the Cloudflare MCP Agent, you can optionally provide a Cloudflare API token for authenticated access to Cloudflare's MCP servers.

For the Content Moderation Agent, you have to provide additionally an OPENAI_API_KEY environment variable with your OpenAI API key.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

Extension points exported contracts — how you extend this code

LangChainMessage (Interface)
(no doc)
app/types.ts
ThemeProviderProps (Interface)
(no doc)
app/components/ThemeProvider.tsx
Statistics (Interface)
(no doc)
app/contexts/StatisticsContext.tsx
Customer (Interface)
(no doc)
app/agents/pii-redaction.ts
HumanMessage (Interface)
(no doc)
app/types.ts
WelcomeScreenProps (Interface)
(no doc)
app/components/Welcome.tsx
StatisticsContextType (Interface)
(no doc)
app/contexts/StatisticsContext.tsx
TokenDetails (Interface)
(no doc)
app/types.ts

Core symbols most depended-on inside this repo

transformLangGraphEvent
called by 3
app/components/ChatInterface.tsx
determineEventTypeFromPayload
called by 3
app/components/ChatInterface.tsx
handleEvent
called by 3
app/components/ChatInterface.tsx
createMockedFetch
called by 3
app/agents/model-fallback.ts
updateToolCallWithMessage
called by 2
app/components/ChatInterface.tsx
extractIncrementalTextFromChunk
called by 2
app/components/ChatInterface.tsx
countTokensApproximately
called by 2
app/contexts/StatisticsContext.tsx
useStatistics
called by 2
app/contexts/StatisticsContext.tsx

Shape

Function 69
Interface 33
Class 2
Method 1

Languages

TypeScript100%

Modules by API surface

app/types.ts18 symbols
app/components/ChatInterface.tsx12 symbols
app/components/InterruptBubble.tsx9 symbols
app/contexts/StatisticsContext.tsx5 symbols
app/agents/tool-retry.ts5 symbols
app/components/ToolCall.tsx4 symbols
app/components/Welcome.tsx3 symbols
app/components/ThemeSwitcher.tsx3 symbols
app/components/SummarizationBubble.tsx3 symbols
app/components/Sidebar.tsx3 symbols
app/components/ThemeProvider.tsx2 symbols
app/components/ErrorBubble.tsx2 symbols

For agents

$ claude mcp add langchat \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact