A small experimental project built while learning LangChain and tool integrations.
This app uses FastAPI, LangChain, and Next.js to demonstrate how LLMs can interact with external tools like SerpAPI (for web search), LLMMathChain (for math evaluation), and simple custom logic functions.
The goal of this project was to explore multi-tool reasoning and build a minimal interactive interface using an Ollama-served LLM backend.
It’s a learning-focused implementation rather than a production-level AI assistant.
- LLM Agent (LangChain) with multi-tool capabilities
- Web search using SerpAPI
- Custom logic tools for reasoning tasks
- Memory-enabled conversation flow
- FastAPI backend + Next.js frontend
- Easily customizable and extendable
- Backend: FastAPI, LangChain, DeepInfra / Ollama
- Frontend: Next.js (in
research_agent/directory) - LLMs: Mistral, LLaMA 2, or any Ollama/DeepInfra-supported model
- Tools: SerpAPI, LLMMathChain, custom logic tools
git clone https://github.com/Rakesh-46-VR/LangChainAssistant.git
cd AutoResearchAgentCopy the .env.example file and fill in the necessary values:
cp .env.example .envEdit .env:
SERP_API_KEY="your-serpapi-key"
MODEL_ID="mistral"
OLLAMA_BASE_URL="http://127.0.0.1:11434"
ALLOWED_ORIGIN="http://localhost:3000"cd fastapi
pip install -r req.txtuvicorn app:app --reloadBy default, it runs at http://localhost:8000.
The frontend is located in the research_agent/ directory:
cd ../research_agent
pnpm install
pnpm devFrontend runs at http://localhost:3000
Make sure the ALLOWED_ORIGIN in your .env matches this URL.
Send a POST request to /ask endpoint:
curl -X POST http://localhost:8000/ask \
-H "Content-Type: application/json" \
-d '{"query": "Evaluate the expression 2+6-9*3+6?"}'Response:
{
"content": "The result of the expression 2 + 6 - 9 * 3 + 6 is -13."
}Or use the chat interface in the research_agent frontend to interact via a sleek UI.
This project supports easily pluggable custom tools. You can create your own logic tools like this:
def frequency_count(word: str, char: str):
return word.count(char)And register it in the tools list via LangChain's Tool interface.