A modern browser-based chat interface for an AI reasoning agent with extended thinking capabilities, inspired by Claude Desktop.
π Want to use this agent in your own project? See the Integration Guide for drop-in instructions!
- π§ Extended Thinking: Real-time visibility into AI reasoning process
- π§ Tool Integration: Calculator, weather, and extensible tool system
- β‘ Real-time Streaming: Server-Sent Events (SSE) streaming for instant responses
- π¨ Modern UI: Clean, responsive design inspired by Claude Desktop
- βοΈ Configurable: Adjustable model settings, token limits, and thinking budget
- π¬ Chat History: Persistent conversation history with timestamps
- π± Responsive: Works on desktop and mobile devices
βββββββββββββββββββ Server-Sent βββββββββββββββββββ
β React Client β Events (SSE) β Express Server β
β Port 3000 β βββββββββββββββββββΊ β Port 3001 β
β β β β
β β’ Chat UI β β β’ Agent Logic β
β β’ SSE Consumer β β β’ Tools β
β β’ State Mgmt β β β’ API Bridge β
βββββββββββββββββββ βββββββββββββββββββ
-
Install dependencies:
npm install
-
Set up environment:
# Create server/.env with your Anthropic API key echo "ANTHROPIC_API_KEY=your-api-key-here" > server/.env
-
Start development servers:
npm run dev
-
Open your browser:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
npm run dev- Start both client and server in development modenpm run server- Start only the servernpm run client- Start only the clientnpm run cli- Use the original CLI interfacenpm run build- Build the client for production
- Send Messages: Type in the input area and press Enter
- View Thinking: Click the "Thinking" section to expand/collapse reasoning
- Tool Usage: See real-time tool calls and results
- Settings: Click the gear icon to configure model and parameters
- Model: Choose between Claude Opus 4 and Sonnet 4
- Max Tokens: Set the maximum response length (1,000 - 200,000)
- Thinking Budget: Control reasoning depth (1,000 - 50,000 tokens)
- Show Thinking: Toggle visibility of reasoning process
- Calculator: Perform mathematical calculations
- Weather: Get weather information (simulated)
- Extensible: Easy to add more tools via the server API
Add tools to the server in server/sse-server.js:
agent.addTool(
'tool_name',
'Description of what the tool does',
{
param1: { type: 'string', description: 'Parameter description' }
},
async ({ param1 }) => {
// Tool implementation
return 'Tool result';
}
);The interface uses Tailwind CSS with custom Claude Desktop-inspired styling:
- Colors: Defined in
client/tailwind.config.js - Components: Modular React components in
client/src/components/ - Animations: Custom typing indicators and loading states
The real-time communication uses these SSE event types:
start- Processing beginschunk- Contains streaming data with type and contentcontent_block_start- New content block beginsthinking_delta- Incremental thinking contenttext_delta- Incremental response texttool_result- Tool execution resultcontent_block_stop- Content block ends
end- Message processing completeerror- Error occurred during processing
The system fully implements Anthropic's extended thinking specification:
- Streaming: Real-time thinking and response streaming
- Token Management: Configurable thinking budget
- Event Handling: Proper content block lifecycle
- Error Handling: Graceful degradation and reconnection
- API keys are stored server-side only
- Client-server communication over Server-Sent Events
- No sensitive data stored in browser
- CORS configured for development
- Chrome 90+
- Firefox 90+
- Safari 14+
- Edge 90+
- Check if server is running on port 3001
- Verify API key is set in
server/.env - Check browser console for SSE connection errors
- Ensure ports 3000 and 3001 are available
- Reduce thinking budget for faster responses
- Lower max tokens for shorter responses
- Use Claude Sonnet 4 for faster processing
The original terminal interface is still available:
npm run cliThis provides the same functionality in a command-line format for development and testing.
This reasoning agent is now modular and ready for integration into any project:
drop-agent- Core agent functionalitydrop-agent-ui- React chat componentsexamples/- Integration examples
npm install drop-agent drop-agent-ui// 3-line server setup
import { ReasoningAgent, addCommonTools, setupSSERoutes } from 'drop-agent';
const agent = new ReasoningAgent({ apiKey: process.env.ANTHROPIC_API_KEY });
addCommonTools(agent);
setupSSERoutes(app, agent);// 2-line React integration
import { ChatInterface } from 'drop-agent-ui';
<ChatInterface serverUrl="http://localhost:3001" />β Full instructions: Integration Guide
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details