A full-stack chat application combining OpenAI-powered agents (Python backend) with a SvelteKit frontend for real-time streaming conversations.
This project provides a modern chat interface that connects to an AI agent backend, supporting real-time streaming responses. The architecture consists of:
- Backend: Python FastAPI server using OpenAI Agents SDK
- Frontend: SvelteKit application with Vercel AI SDK (planned)
- Features: Real-time streaming, responsive design, error handling
agent_svelte/
├── agents-python/ # Python backend with OpenAI agent
│ ├── agents_app.py # FastAPI server with streaming endpoint
│ ├── requirements.txt # Python dependencies
│ └── tests/ # Backend tests
├── sveltekit/ # SvelteKit frontend (to be created)
└── docs/ # Documentation
├── PRD.md # Product requirements
├── TASK.md # Implementation tasks
└── *.md # Technical documentation
-
Navigate to the Python backend:
cd agents-python
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.env
file with your OpenAI API key:OPENAI_API_KEY=your_api_key_here
-
Run the FastAPI server:
uvicorn agents_app:app --reload
The API will be available at
http://localhost:8000
Test the agent directly from command line:
python agents_app.py "Your prompt here"
- POST
/api/agent/stream
- Stream agent responses- Request body:
{"input": "user message"}
or{"messages": [...]}
- Response: Server-sent events stream
- Request body:
The SvelteKit frontend is planned but not yet implemented. See docs/TASK.md for implementation status.
cd agents-python
python -m pytest tests/
- Product Requirements - Project objectives and requirements
- Task List - Implementation progress
- Agent SDK Guide - OpenAI Agents SDK documentation
- Streaming Integration - Streaming implementation details
- SvelteKit AI SDK - Frontend integration guide
- Backend: Python, FastAPI, OpenAI Agents SDK
- Frontend (planned): SvelteKit v5, Vercel AI SDK, Tailwind CSS + DaisyUI
- Real-time: Server-sent events for streaming responses
- Check the task list for current progress
- Follow existing code patterns and conventions
- Run tests before submitting changes
- Update documentation as needed
MIT