This repository provides a minimal ReAct-style agent built with LangGraph. It includes a single calculator tool (powered by numexpr) for arithmetic expressions, keeping everything simple for testing and extension.
Graph entrypoint: src/react_agent/graph.py:graph (via langgraph.json)
- Python 3.11+
- uv (fast Python package manager)
- Install:
pip install uv(or see https://github.com/astral-sh/uv)
- Install:
- Create your
.env:
cp .env.example .env- Add your model API key in
.env. Default in this template is OpenAI:
OPENAI_API_KEY=your-openai-key
- Install dependencies with uv:
uv syncStart the dev server:
uv run langgraph devNotes:
langgraph.jsonmaps the graph:{ "dependencies": ["."], "graphs": { "agent": "./src/react_agent/graph.py:graph" }, "env": ".env" }- Studio will load the graph and hot-reload your local edits.
uv run python examples/minimal_demo.pyThis will send a prompt like “What is (25 * 4) + 3?” and the agent should call the calculator tool to compute the answer.
- Tools: add functions in
src/react_agent/tools.pyand include them inTOOLS. - Model: change default in
src/react_agent/configuration.py(formatprovider/model, default isopenai/gpt-4o-mini-2024-07-18) or configure in Studio. - Prompt: edit the minimal prompt in
src/react_agent/prompts.py.
Template maker: basim akram
See LICENSE.
