https://github.com/muhammadhamzaazhar/react-agent-langchain
From-scratch implementation of a ReAct agent using LangChain, showcasing manual control over tool invocation, prompt design, and reasoning loop without relying on built-in abstractions.
https://github.com/muhammadhamzaazhar/react-agent-langchain
langchain mistral-7b openrouter react-agent
Last synced: 3 months ago
JSON representation
From-scratch implementation of a ReAct agent using LangChain, showcasing manual control over tool invocation, prompt design, and reasoning loop without relying on built-in abstractions.
- Host: GitHub
- URL: https://github.com/muhammadhamzaazhar/react-agent-langchain
- Owner: muhammadhamzaazhar
- Created: 2025-06-30T05:19:00.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2025-06-30T06:01:05.000Z (3 months ago)
- Last Synced: 2025-06-30T07:22:13.885Z (3 months ago)
- Topics: langchain, mistral-7b, openrouter, react-agent
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ReAct Agent from Scratch using LangChain
This project is a minimal, transparent implementation of a **ReAct (Reasoning and Acting) Agent** built manually using the [LangChain](https://github.com/langchain-ai/langchain) framework.
Instead of relying on high-level abstractions like `initialize_agent`, this repo walks through **how a ReAct agent works under the hood** — from formatting the prompt, invoking tools, to parsing LLM responses.
---
## Features
- Custom ReAct-style Prompt Template
- Tool execution (e.g., `get_text_length`)
- Manual ReAct-style reasoning/action loop
- Intermediate step tracking (scratchpad)
- Callback handler for logging LLM input/output---
### **Note**:
> This project uses the **`mistralai/mistral-7b-instruct`** model hosted for **free via [OpenRouter](https://openrouter.ai)**.
> The model is accessed using the OpenAI-compatible API base