shekkari21/agent-from-scratch
0
1# Agent Chat Web Application2 3A modern chat interface for interacting with the AI agent framework.4 5## Features6 7- Real-time chat with AI agent8- Session memory toggle (on/off)9- File upload support10- Display of available tools11- Tool usage indicators in responses12 13## Running the Application14 15### Option 1: Direct run16 17```bash18cd web_app19python app.py20```21 22### Option 2: With uvicorn (recommended)23 24```bash25uvicorn web_app.app:app --reload --host 0.0.0.0 --port 800026```27 28Then open http://localhost:8000 in your browser.29 30## API Endpoints31 32| Endpoint | Method | Description |33|----------|--------|-------------|34| `/` | GET | Chat interface |35| `/api/tools` | GET | List available tools |36| `/api/chat` | POST | Send message to agent |37| `/api/upload` | POST | Upload a file |38| `/api/uploads` | GET | List uploaded files |39| `/api/uploads/{filename}` | DELETE | Delete uploaded file |40| `/api/sessions` | GET | List active sessions |41| `/api/sessions/{session_id}` | DELETE | Clear a session |42 43## Chat Request Format44 45```json46{47 "message": "Your message here",48 "session_id": "optional-session-id",49 "use_session": true50}51```52 53## Chat Response Format54 55```json56{57 "response": "Agent's response",58 "session_id": "session-uuid",59 "events_count": 4,60 "tools_used": ["calculator", "search_web"]61}62```63 64 