https://github.com/eomaxl/dockerized-ai-agent
Dockerized AI Agent (Email Assistant)
https://github.com/eomaxl/dockerized-ai-agent
aiagent containerization docker fastapi langchain postgresql python3
Last synced: 5 months ago
JSON representation
Dockerized AI Agent (Email Assistant)
- Host: GitHub
- URL: https://github.com/eomaxl/dockerized-ai-agent
- Owner: Eomaxl
- Created: 2025-06-17T10:57:50.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-21T18:14:08.000Z (about 1 year ago)
- Last Synced: 2025-08-13T20:40:37.805Z (11 months ago)
- Topics: aiagent, containerization, docker, fastapi, langchain, postgresql, python3
- Language: Python
- Homepage: https://docker--ai-fast-api-japt9.ondigitalocean.app/
- Size: 50.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dockerized-AI-Agent
## Project Purpose
This folder contains the core of your AI email‐generating "agent":
- Receives user messages via FastAPI (routing.py)
- Stores them in PostgreSQL via SQLModel (models.py, db.py)
- Sends user messages to OpenAI (via LangChain + ChatOpenAI)
- Returns a generated email reply
- Includes Docker support for easy deployment
## Requirements
- Python 3.10+
- PostgreSQL (connection via DATABASE_URL)
- OpenAI credentials (OPENAI_API_KEY, optionally OPENAI_BASE_URL)
- Docker & Docker Compose
## How It Works — Code Flow
- FastAPI endpoint at /api/chats/ accepts a JSON payload with message.
- SQLModel validates the payload and creates a ChatMessage record with timestamp.
- Before generating the email, it commits the record to DB.
- LangChain + ChatOpenAI sends the user message to the LLM.
- The generated response is returned in the HTTP response.
## Dockerization
- The root Dockerfile installs dependencies and starts FastAPI with Uvicorn.
- docker-compose.yml brings up both the API and a Postgres container.
- Environment variables are provided via a .env (added to .gitignore) to protect secrets.
## Performance Handling
- DB caching: Completed messages are stored with timestamps.
- Concurrency: FastAPI + Uvicorn handles multiple simultaneous requests.
- LLM generation is performed asynchronously through LangChain, non-blocking.