Spaces:
Sleeping
Sleeping
| title: Trace Your Digital Footprint | |
| emoji: π΅οΈ | |
| colorFrom: purple | |
| colorTo: indigo | |
| sdk: docker | |
| app_port: 8000 | |
| pinned: false | |
| # π΅οΈ Trace β "Your Digital Footprint" | |
| > Meta OpenEnv Hackathon 2026 | Team Submission | |
| **Trace** is a privacy-centric, multi-agent RL environment that builds a dynamic *Semantic World Model* of a user's fragmented digital life β without centralizing data. | |
| --- | |
| ## Themes Addressed | |
| | Theme | Coverage | | |
| |-------|----------| | |
| | **Theme #2** β Long-Horizon Planning & Instruction Following | Primary β federated multi-step retrieval across years of data | | |
| | **Theme #1** β Multi-Agent Interactions | Secondary β planner, retriever, verifier, memory agents | | |
| | **Theme #4** β Self-Improvement | Tertiary β agents learn from past executions, refine strategies | | |
| | **Sub-theme: Scale AI** | Non-code long-horizon business/personal workflows | | |
| | **Sub-theme: Patronus AI** | Consumer workflows with schema drift (Gmail/Drive APIs change) | | |
| --- | |
| ## Architecture Overview | |
| ``` | |
| User Query (e.g., "Audit all receipts from 2022-2024 and flag anomalies") | |
| β | |
| βΌ | |
| βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β PLANNER AGENT β | |
| β plan-act-verify framework | goal decomposition β | |
| ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ | |
| β sub-tasks | |
| ββββββββββββββββΌβββββββββββββββ | |
| βΌ βΌ βΌ | |
| RETRIEVER AGENT MEMORY AGENT VERIFIER AGENT | |
| (federated fetch) (episodic KV) (reward scorer) | |
| β β β | |
| ββββββββββββββββ΄βββββββββββββββ | |
| β observations | |
| βΌ | |
| OpenEnv Environment Loop | |
| (reset / step / reward) | |
| β | |
| βΌ | |
| TRL + Unsloth RL Training | |
| ``` | |
| --- | |
| ## Quick Start | |
| ```bash | |
| # 1. Install dependencies | |
| pip install -r requirements.txt | |
| # 2. Bootstrap OpenEnv environment | |
| cd environments/trace_env | |
| openenv init # or run: uvicorn app:app --reload | |
| # 3. Run training script (Google Colab friendly) | |
| cd training | |
| python train_grpo.py --config ../configs/grpo_config.yaml | |
| # 4. Evaluate | |
| python scripts/evaluate.py --env-url http://localhost:8000 | |
| ``` | |
| --- | |
| ## Project Structure | |
| ``` | |
| trace/ | |
| βββ environments/ | |
| β βββ trace_env/ # OpenEnv-compatible RL environment | |
| β βββ app.py # FastAPI server (OpenEnv interface) | |
| β βββ core/ | |
| β β βββ env.py # TraceEnv: reset(), step(), state() | |
| β β βββ world_model.py # Semantic World Model (SWM) | |
| β β βββ schemas.py # Action / Observation dataclasses | |
| β βββ agents/ | |
| β β βββ planner.py # Long-horizon goal decomposer | |
| β β βββ retriever.py # Federated data fetcher (Gmail, Drive) | |
| β β βββ memory.py # Episodic + semantic memory store | |
| β β βββ verifier.py # Plan verification agent | |
| β βββ tools/ | |
| β β βββ gmail_tool.py | |
| β β βββ drive_tool.py | |
| β β βββ timeline_tool.py | |
| β βββ rewards/ | |
| β βββ reward_fn.py # Multi-component reward functions | |
| β βββ anti_hack.py # Anti-reward-hacking guards | |
| βββ training/ | |
| β βββ train_grpo.py # Main RL training script (TRL + Unsloth) | |
| β βββ dataset.py # Task curriculum generator | |
| β βββ callbacks.py # Training monitors | |
| βββ configs/ | |
| β βββ grpo_config.yaml # GRPO hyperparameters | |
| β βββ env_config.yaml # Environment settings | |
| βββ scripts/ | |
| β βββ evaluate.py # Reward curve evaluation | |
| β βββ sample_outputs.py # Anti-hacking output inspector | |
| βββ notebooks/ | |
| β βββ trace_colab.ipynb # Colab-ready training notebook | |
| βββ docs/ | |
| β βββ blog_post.md # HuggingFace mini-blog | |
| βββ requirements.txt | |
| βββ README.md | |
| ``` | |
| --- | |
| ## HuggingFace Deployment | |
| ### Required Secrets | |
| Set these in your HF Space settings β **Repository secrets**: | |
| | Secret Name | Source File | Description | | |
| |-------------|------------|-------------| | |
| | `GCP_CREDENTIALS_B64` | `credentials.json` | Google Cloud OAuth client credentials | | |
| | `GMAIL_TOKEN_B64` | `token_gmail.pkl` | Gmail API OAuth token (base64-encoded pickle) | | |
| | `SHEETS_TOKEN_B64` | `token_sheets.pkl` | Sheets API OAuth token (base64-encoded pickle) | | |
| | `SHEETS_LEDGER_ID` | `.ledger_id` | (Optional) Google Sheet ID for the financial ledger | | |
| Generate all base64 secrets at once: | |
| ```bash | |
| python3 generate_secrets.py # β creates hf_secrets.txt with all values | |
| ``` | |
| ### Live Dashboard | |
| Visit `/dashboard` on your deployed Space to see a **live financial transaction dashboard** populated from Gmail. The endpoint: | |
| 1. Searches Gmail for financial emails (last 180 days) | |
| 2. Parses transactions (vendor, category, amounts) | |
| 3. Renders an interactive HTML dashboard | |
| Results are cached for 10 minutes. Force refresh with `/dashboard?refresh=true`. | |
| --- | |
| ## Judging Criteria Alignment | |
| | Criterion | Implementation | | |
| |-----------|---------------| | |
| | **Environment Innovation (40%)** | Federated multi-source retrieval + zero-knowledge SWM; novel schema-drift curriculum | | |
| | **Storytelling (30%)** | Privacy narrative + before/after timeline demo | | |
| | **Showing Reward Improvement (20%)** | Reward curves across 3 difficulty tiers; plan-quality scoring | | |
| | **Training Script Setup (10%)** | OpenEnv + TRL GRPO + Unsloth Colab notebook | | |