This template showcases a ReAct agent implemented using LangGraph, extended with a Claude-style "think" tool that enables structured internal reasoning before taking any action—ideal for complex multi-step workflows and policy-compliant environments.
Inspired by Anthropic’s "think" tool for Claude 3.7 and τ-Bench benchmark: Read the blog post
- 🧠
thinkTool: Forces the agent to reflect before acting, logging structured reasoning steps. - 🔁 ReAct Agent Loop: Reason → Act → Observe → Repeat.
- 🔌 Pluggable Tooling: Easily integrate new tools (e.g., search, APIs).
- 📚 Optimized Prompting: Includes domain-style guidance for better decision-making.
- 🧩 LangGraph Studio Ready: Visualize and edit the graph in-browser.
This fork adds a Claude-inspired think tool with the following logic:
def think(thought: str, config: Annotated[RunnableConfig, InjectedToolArg]) -> str:
"""Think tool for structured intermediate reasoning before actions."""Used as a scratchpad to:
- List applicable rules
- Check required information
- Validate planned actions
- Reflect on tool outputs
📌 Prompt template included in THINK_PROMPT, used dynamically with Configuration.
- Complex workflows (e.g., booking, support, compliance)
- Long tool-call chains needing internal verification
- Reasoning transparency and debuggability
- Agents operating in policy-heavy domains (e.g., airline, finance, legal)
- Clone the repo
- Create a
.envfile from.env.example - Install all requirements with
pip install -r requirements.txt - Add your API keys (OpenAI, Tavily)
- Run in LangGraph Studio
| File | Purpose |
|---|---|
src/agent/tools.py |
Includes think and search tools |
src/agent/prompts.py |
System and think prompt configuration |
src/agent/configuration.py |
Central configuration (e.g. model setup) |
You can modify the tool list in src/agent/tools.py:
TOOLS: List[Callable[..., Any]] = [search, think]And the system prompt logic in src/agent/prompts.py.
- Use hot reload in LangGraph Studio
- Add custom nodes for internal logging or external validation
- Extend
think()to support domain-specific policies or memory