Skip to content

basimakram/langgraph-react-template

Repository files navigation

LangGraph Minimal ReAct Agent (Calculator-only)

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)

Screenshot: Graph view in LangGraph studio UI

Requirements

Setup

  1. Create your .env:
cp .env.example .env
  1. Add your model API key in .env. Default in this template is OpenAI:
OPENAI_API_KEY=your-openai-key
  1. Install dependencies with uv:
uv sync

Run in LangGraph Studio

Start the dev server:

uv run langgraph dev

Notes:

  • langgraph.json maps the graph:
    {
      "dependencies": ["."],
      "graphs": {
        "agent": "./src/react_agent/graph.py:graph"
      },
      "env": ".env"
    }
  • Studio will load the graph and hot-reload your local edits.

Quick CLI test (optional)

uv run python examples/minimal_demo.py

This will send a prompt like “What is (25 * 4) + 3?” and the agent should call the calculator tool to compute the answer.

Customize

  • Tools: add functions in src/react_agent/tools.py and include them in TOOLS.
  • Model: change default in src/react_agent/configuration.py (format provider/model, default is openai/gpt-4o-mini-2024-07-18) or configure in Studio.
  • Prompt: edit the minimal prompt in src/react_agent/prompts.py.

Credits

Template maker: basim akram

License

See LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published