How oatmeal-farm-network/ag-agent works
Project Type and Purpose
• Full-stack conversational AI chatbot for agricultural advice.
• Python backend orchestrating a multi-agent pipeline (Microsoft AutoGen + Azure OpenAI).
• React-based frontend served via Nginx.
• Persistent storage in Azure Cosmos DB.
• Integrations with external weather API.
File Structure
Top-level directories and roles:
• frontend/ – React SPA + Nginx.
• autogen_module/ – Definitions of AI agents and coordination logic.
• database_module/ – Cosmos DB access (retrievers, storage helpers).
• external_apis/ – Wrappers (e.g., weather_api.py).
• utilities_module/ – Shared utilities (audio, embeddings, blob).
• Backend entrypoint: backend.py + config.py (loads env, wiring).
• Dockerfile, docker-compose.yml – container definitions.
Key Insights from README
• Multi-agent pipeline: Expert Advisor, User Proxy, others.
• Azure OpenAI for LLM calls.
• Cosmos DB for data persistence.
• Streamlit mention in README is outdated; actual UI is React + Nginx.
• Containerized deployment.
Main Components & Their Interactions
A. Frontend
• React SPA (frontend/src)
• Served by Nginx (frontend/Dockerfile, nginx.conf)
• Communicates via HTTP(S) to Backend API.
B. Backend Service
• backend.py: HTTP API endpoints (e.g., /chat)
• config.py: environment variable loader
• Autogen Orchestrator (autogen_module/): spawns and coordinates AI agents
– agents.py, routeagents.py, people_tool.py, userdata_agent.py
• External API Client (external_apis/weather_api.py)
• Database Layer (database_module/): cosmos_retriever, database_tools
• Utility Layer (utilities_module/): embeddings, audio, blob storage, session storage
C. External Services
• Azure OpenAI (chat + embeddings)
• Azure Cosmos DB
• Open-Meteo (via external_apis/weather_api.py)
D. Infrastructure
• Docker containers: frontend, backend
• docker-compose.yml defines multi-container local setup
• .env for secrets injection
Architectural Patterns
• Monolithic backend with layered modules (Orchestration, Data Access, Utilities).
• Multi-agent workflow (chain-of-thought style).
• Clear separation of concerns: UI / API / Business logic / Persistence / External Integrations.