A full-stack autonomous data analyst agent. It ingests datasets, reasons via a ReAct loop, and executes Python code in a secure sandbox.
The idea for STRATEGOS came from observing the repetitive nature of data analysis tasks. Analysts often spend hours writing boilerplate code to clean data, generate basic charts, and extract simple statistics before even getting to the actual insights.
I wanted to build an autonomous agent that could handle this initial heavy lifting. The goal was to create a system where a user could simply upload a dataset and ask questions in plain English, and the system would write, test, and execute the necessary code to provide answers and visualizations dynamically.
graph TD
User((User)) -->|Uploads Data & Query| Frontend[React Frontend]
Frontend -->|API Request| Backend[FastAPI & Express Node.js Backend]
Backend --> Session[MongoDB Session Engine]
Session -->|ReAct Loop Reasoning| LLM{Large Language Model}
LLM -->|Code Generation| Sandbox[Secure Python Sandbox]
Sandbox -->|Execution Output & Charts| Session
Session -->|Final Answer & Assets| Backend
Backend -->|Response| Frontend
Frontend -->|Displays Insights| User
Allowing an LLM to generate and execute arbitrary Python code is a massive security risk. To solve this, I had to implement a strict, containerized sandbox environment. The backend spins up isolated Docker containers that restrict network access and file system privileges so that the generated code cannot compromise the host server.
Getting the LLM to consistently follow the Reasoning and Acting (ReAct) framework without hallucinating unavailable tools was difficult. I optimized the prompt engineering and LangChain tools to enforce strict JSON schemas, ensuring that if the code failed, the agent could read the traceback and autonomously fix its own code before returning the final answer to the user.