--- title: DCI-Agent Demo emoji: 🔮 colorFrom: purple colorTo: indigo sdk: docker app_port: 7860 pinned: false --- # DCI-Agent Search A Prestige Purple-themed Hugging Face Spaces app for autonomous document search over Wikipedia and other datasets. ## Features - **Autonomous search**: Pi reads files and runs shell commands (rg, grep, find, etc.) to answer your questions over a corpus. - **Real-time terminal**: Watch Pi's reasoning and tool execution in a live terminal-like log. - **Default corpus**: Wikipedia corpus with multi-hop QA examples from 2WikiMultiHopQA, HotpotQA, and other datasets. - **Upload your own corpus**: ZIP upload with per-file (1 KB) and total (15 MB) limits. - **Native PI runner**: Uses the original DCI-Agent Pi CLI via RPC. The Docker build now requires `pi-mono` to build successfully so remote deployments stay aligned with local behavior. ## Deployment ### Hugging Face Spaces (Docker) 1. Create a new Space on Hugging Face, choose **Docker** as the SDK. 2. Upload the contents of this `web-app/` directory. 3. Set your `OPENAI_API_KEY` as a Space secret (optional — users can also provide it in the UI). 4. The Space will build and launch automatically. ### Local testing ```bash cd web-app pip install -r requirements.txt python app.py ``` Open http://localhost:7860 in your browser. ## Usage 1. Enter your OpenAI API key. 2. Choose a model (gpt-4o recommended). 3. Set max turns (default: 6). 4. Either check "Use Default Corpus" or upload your own ZIP file. 5. Type a question and click **Run Search**. 6. Watch the terminal log for real-time progress. 7. The final answer appears in the **Final Answer** box. ## File structure ``` web-app/ ├── app.py # Gradio UI and orchestration ├── pi_wrapper.py # PI RPC client and native runner integration ├── Dockerfile # HF Spaces Docker image ├── requirements.txt # Python dependencies ├── default_corpus/ # Wikipedia corpus (wiki_dump.jsonl) │ ├── biology/ │ ├── earth_science/ │ ├── economics/ │ └── robotics/ └── README.md ``` ## Design Prestige Purple theme: - Deep purples (`#B4AFF2`, `#5822B4`) and rich blacks (`#0A0A12`, `#141420`). - Plus Jakarta Sans for headings and body. - JetBrains Mono for the terminal log. - Cinematic gradients and generous whitespace.