Kanjironomish/MEMORY_AUGUMENTED_AI_ENVIRNMENT
Hackathon AI Environment
This project turns the shared design into a runnable prototype:
User Query
-> Vector Encoding
-> Multi-Agent Layer
-> Shared Knowledge Space
-> Decision Fusion Engine
-> Q-Learning Controller
-> Deterministic Reward Node
-> Memory Update with Decay
-> Next StateIt includes four agents:
foodbusinessresearchmemory
The environment is designed for hackathon demos where you want:
- multi-agent routing
- deterministic, judge-friendly rewards
- a real Q-table update loop
- memory recall across sequential queries
- a clean CLI for training and evaluation
Project Layout
hackathon_ai_env/agents.py: specialist agents and query-domain encodinghackathon_ai_env/fusion.py: decision fusion and action generationhackathon_ai_env/q_learning.py: epsilon-greedy action selection and Q updateshackathon_ai_env/reward.py: deterministic reward scoringhackathon_ai_env/memory.py: shared memory with decay and reinforcementhackathon_ai_env/environment.py: end-to-end environment loophackathon_ai_env/scenarios.py: sample benchmark tasksmain.py: CLI entrypoint
Run It
Train on the built-in scenarios:
python3 main.py train --episodes 40Train and evaluate the learned policy:
python3 main.py eval --episodes 40Train, warm shared memory, and ask a custom question:
python3 main.py ask "What pricing model should we use for a student startup?" --episodes 40Launch the browser dashboard:
python3 main.py web --port 8000 --episodes 40Then open http://127.0.0.1:8000.
Deploy On Hugging Face
This repo is now set up for a Hugging Face Docker Space.
- Create a new Space and choose the
DockerSDK. - Push this entire repository to that Space.
- Hugging Face will build the included
Dockerfileand start the dashboard on port7860.
The container starts the app with:
python3 main.py web --host 0.0.0.0 --port ${PORT:-7860} --episodes ${EPISODES:-40}Optional runtime variables you can set in the Space settings:
EPISODES: default training episodes for the dashboard, defaults to40PORT: app port, defaults to7860HOST: bind address, defaults to0.0.0.0APP_STATE_PATH: persisted dashboard state file, defaults to/data/hackathon_ai_env_state.jsonin the Docker image
Notes for deployment:
- Hugging Face Docker Spaces expect a single exposed app port; this repo uses
7860. - The dashboard now autosaves the Q-table, memory bank, training summaries, and latest feedback to
APP_STATE_PATH, and reloads them on startup. - To keep that state across Hugging Face restarts, enable persistent storage for the Space so
/datasurvives restarts. - Local browser URLs such as
127.0.0.1are only for local development; Hugging Face will provide the public Space URL after deployment.
What The Q-Learning Action Means
Each action is a compact policy choice:
- which agent to trust
- whether to use shared memory
- what confidence threshold must be met before accepting that agent
If the selected agent does not clear the threshold, the environment falls back to the fusion winner.
Reward Design
The reward node is deterministic and reproducible. It scores:
- domain accuracy
- keyword coverage
- memory usage quality
- confidence alignment
This keeps the system hackathon-friendly because the grader does not depend on a stochastic LLM reward.
Tests
Run the lightweight test suite with:
python3 -m unittest discover -s tests