An open-source, persistent autonomous AI agent that can run for hours or days, with:
- Continuous execution loop
- Goal planning and adaptation (Groq)
- E2B sandbox execution for actions
- Long-term memory in SQLite
- Resume across sessions
- API control plane for start/stop/status/output
- Results-only output mode (computation output only)
This repository is designed to be self-hosted and extended locally. It includes a Python backend, a Vite/React frontend, and .env.example files to make setup reproducible.
FastAPIAPI server for orchestration.AutonomousAgentbackground loop for planning, execution, reflection, and memory updates.GroqPlannerfor planning and episode summarization.E2BExecutorfor Python code execution in a secure sandbox.AgentStoragefor persistent sessions, episodes, and long-term memory.
src/autonomous_agent/app.py- FastAPI app and routessrc/autonomous_agent/agent.py- long-running control loopsrc/autonomous_agent/llm.py- Groq integrationsrc/autonomous_agent/e2b_runner.py- E2B code execution adaptersrc/autonomous_agent/storage.py- SQLite persistent statesrc/autonomous_agent/main.py- API/CLI entrypoint
Use .env (already present in your workspace):
GROQ_API_KEYGROQ_MODELE2B_API_KEYE2B_TIMEOUT_SECONDSE2B_STEP_TIMEOUT_SECONDSAGENT_DB_PATHAGENT_MAX_FULL_EPISODESAGENT_MAX_ITERATIONSAGENT_CYCLE_SLEEP_SECONDSFRONTEND_ORIGINSFRONTEND_ORIGIN_REGEX
Frontend-specific variables live in frontend/.env.example.
pip install -r requirements.txt
pip install -e .python -m autonomous_agent.main --mode apiAPI endpoints:
GET /healthPOST /agent/startbody:{ "goal": "...", "session_id": "optional" }POST /agent/stopGET /agent/status?session_id=...GET /agent/output?session_id=...&limit=20GET /agent/logs?session_id=...&limit=200GET /system/logs?limit=300
python -m autonomous_agent.main --mode cli --goal "Solve X step by step"CLI prints only computation output generated by the agent. Internal logs are stored in logs/agent.log.
The project now includes a production-ready frontend in frontend/ with:
- Goal input and start/resume controls
- Stop control
- Live session status and iteration tracking
- Computation output stream view (results-only)
- Live runtime logs and system/API logs panel
Frontend setup:
cd frontend
copy .env.example .env
npm install
npm run devFrontend environment variable:
VITE_API_BASE_URL(defaulthttp://localhost:8000)
Build frontend for production:
cd frontend
npm run build- State persists in SQLite (
data/agent_state.db) across process restarts. - Memory updates happen each iteration using concise episode summaries.
- The loop is resumable by reusing
session_id. - Logging is file-only for clean stdout behavior.
- Use process supervision in production (systemd, Docker restart policy, PM2, or Kubernetes).
This project is open source. If you publish or redistribute it, add the appropriate LICENSE file for the terms you want to use and keep the existing setup instructions current.
curl -X POST http://localhost:8000/agent/start \
-H "Content-Type: application/json" \
-d '{"goal":"Collect top 5 AI headlines and summarize trends"}'To satisfy your requirement that the program should only show computation output:
- CLI stdout prints only episode outputs.
- API output endpoint returns only outputs list and session status.
- Internal diagnostics are written to
logs/agent.log.