How rtjshreyd/excelus_agents works
Project Type and Purpose
• This project serves as a production micro-service architecture for hosting AI agents (with a current demonstration being the “medical_reception” agent) designed for the ExcelusAI team.
• The project uses a REST API built with FastAPI, integrates a langchain-based agent that leverages the GPT-4 OpenAI model, and employs components like a Redis cache for agent memory, a text embedding tool, and custom tools using OpenAI functions.
• The intention is that each agent is a self-contained micro-service.
Analyzing the File Structure
• Top-Level Overview:
• The root includes project metadata files (.gitignore, LICENSE, main README.md) and a main “medical_reception” directory.
• Inside the “medical_reception” Directory:
• Configuration: Contains environment files (.env and Docker configs), a Dockerfile, and the docker-compose.yml for container orchestration.
• The “configs” folder includes JSON and text-based configuration files (agent_config.json, base_prompt.txt) and configuration python files which set various parameters.
• The “core” folder provides foundational functionalities such as dependency management and validation routines.
• The “lib” directory houses key modules that implement the agent logic: agent functionality, custom tools, information handling, and domain-specific object definitions.
• External resources are stored in the “external_media” folder (doctors.txt, packages.txt) which likely provide lookup data for the medical context.
• The medical_reception client script and main application file (main.py) tie these components together.
• Additional supporting files such as test.py and requirements.txt indicate testing and dependency management.
a. MAIN COMPONENTS:
• REST API Service: Represent the FastAPI-based REST interface.
• AI Agent Microservice: Highlight the langchain-based integration using GPT-4.
• Caching & Memory: Identify the Redis cache component for storing the agent’s conversational/memory state.
• Configuration & Environment Management: Represent configuration files, environment variables (.env) that tailor the agent’s behavior.
• External Data & Media: Show the external media (doctors, packages) feeding into the agent’s domain data.
• Custom Tools & Libraries: Represent the custom tool implementations and additional libraries that extend core functionality.
b. RELATIONSHIPS AND INTERACTIONS:
• The REST API (FastAPI) receives incoming user requests and forwards them to the AI agent service.
• The agent service, using its core and lib modules, processes inquiries. It leverages configurations (from the configs folder) and accesses external data (from the external_media folder) as needed.
• The AI component interacts with the GPT-4 model for generating responses.
• How Docker (Dockerfile and docker-compose.yml) containerizes and orchestrates these services.
c. ARCHITECTURAL PATTERNS / DESIGN PRINCIPLES:
• Micro-service architecture: Each agent (like medical_reception) is designed to be independent.
• Separation of concerns: There is a clear separation between configuration, core business logic, and helper tools.
• Containerization: Emphasize containerization (Docker/Docker Compose) supporting scalable deployment.
d. TECHNOLOGIES, FRAMEWORKS, LIBRARIES:
• FastAPI for the REST API.
• Python-based modules (langchain, custom python modules under lib) using GPT-4 from OpenAI.
• Redis for caching agent memory.
• Docker for containerization.
• Ancillary tools for text embedding and additional custom OpenAI functions.
• Clearly labeled components (e.g., “FastAPI REST API”, “GPT-4 AI Agent”, “Redis Cache”, “External Data Sources”).
• Annotations for key technologies (e.g., “FastAPI”, “langchain”, “Redis”) next to the respective component blocks.
• Distinct sections or grouping (for example, a container representing a Docker environment which includes the agent service and its dependencies).