Skip to content

Conversation

@ashen-dusk
Copy link
Owner

Implements visible reasoning text similar to ChatGPT and Cursor, with support for both Claude extended thinking and custom reasoning for OpenAI/DeepSeek models.

New Features

Core Functionality

  • Claude Extended Thinking: Native support for Claude models with automatic reasoning extraction from thinking blocks
  • Custom Reasoning: Two-step reasoning approach for OpenAI, DeepSeek, and other LLMs that generates explicit step-by-step thinking
  • Plan-and-Execute Reasoning: Enhanced plan-and-execute graph with reasoning at planning, execution, and replanning stages

Files Added

  • app/agent/reasoning.py - Custom reasoning nodes (reasoning_node, reasoning_chat_node)
  • app/agent/openai_reasoning_graph.py - Ready-to-use graphs for OpenAI models with reasoning (3 variants: default, explicit, conditional)
  • app/agent/plan_and_execute_with_reasoning.py - Plan-execute with reasoning
  • test_reasoning.py - Test suite for verifying reasoning functionality

Files Modified

  • app/agent/model.py - Added ChatAnthropic support with extended_thinking enabled
  • app/agent/chat.py - Added ThinkingCallbackHandler and thinking block extraction
  • pyproject.toml - Added langchain-anthropic>=0.3.19 dependency

Documentation

  • docs/OPENAI_REASONING_GUIDE.md - Complete guide for OpenAI users
  • docs/REASONING_GUIDE.md - Comprehensive guide covering all approaches
  • docs/REASONING_IMPLEMENTATION_SUMMARY.md - Technical implementation details

How to Use

For OpenAI Models

from app.agent.openai_reasoning_graph import openai_reasoning_graph

agent = LangGraphAGUIAgent(
    name="mcpAssistant",
    graph=openai_reasoning_graph
)

For Claude Models

Just set model to "claude-sonnet-4-5" - extended thinking is automatic

Benefits

  • Transparent AI decision-making process
  • Better user trust and understanding
  • ChatGPT/Cursor-like reasoning display
  • Works with any LLM provider
  • Fully integrated with AG-UI protocol

Testing

Run: python test_reasoning.py

Implements visible reasoning text similar to ChatGPT and Cursor, with support
for both Claude extended thinking and custom reasoning for OpenAI/DeepSeek models.

## New Features

### Core Functionality
- **Claude Extended Thinking**: Native support for Claude models with automatic
  reasoning extraction from thinking blocks
- **Custom Reasoning**: Two-step reasoning approach for OpenAI, DeepSeek, and
  other LLMs that generates explicit step-by-step thinking
- **Plan-and-Execute Reasoning**: Enhanced plan-and-execute graph with reasoning
  at planning, execution, and replanning stages

### Files Added
- app/agent/reasoning.py - Custom reasoning nodes (reasoning_node, reasoning_chat_node)
- app/agent/openai_reasoning_graph.py - Ready-to-use graphs for OpenAI models
  with reasoning (3 variants: default, explicit, conditional)
- app/agent/plan_and_execute_with_reasoning.py - Plan-execute with reasoning
- test_reasoning.py - Test suite for verifying reasoning functionality

### Files Modified
- app/agent/model.py - Added ChatAnthropic support with extended_thinking enabled
- app/agent/chat.py - Added ThinkingCallbackHandler and thinking block extraction
- pyproject.toml - Added langchain-anthropic>=0.3.19 dependency

### Documentation
- docs/OPENAI_REASONING_GUIDE.md - Complete guide for OpenAI users
- docs/REASONING_GUIDE.md - Comprehensive guide covering all approaches
- docs/REASONING_IMPLEMENTATION_SUMMARY.md - Technical implementation details

## How to Use

### For OpenAI Models
```python
from app.agent.openai_reasoning_graph import openai_reasoning_graph

agent = LangGraphAGUIAgent(
    name="mcpAssistant",
    graph=openai_reasoning_graph
)
```

### For Claude Models
Just set model to "claude-sonnet-4-5" - extended thinking is automatic

## Benefits
- Transparent AI decision-making process
- Better user trust and understanding
- ChatGPT/Cursor-like reasoning display
- Works with any LLM provider
- Fully integrated with AG-UI protocol

## Testing
Run: python test_reasoning.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants