Download config/agent.env.example from seanpedrickcase/document_redaction: direct link, hf CLI and curl.
- Browser
- Download file 8.35 kB
-
https://huggingface.co/spaces/seanpedrickcase/document_redaction/resolve/main/config/agent.env.example
- Command line
-
hf download hf://spaces/seanpedrickcase/document_redaction/config/agent.env.example
-
curl -L -o agent.env.example https://huggingface.co/spaces/seanpedrickcase/document_redaction/resolve/main/config/agent.env.example
8.35 kB
| Optional Pi agent backend credentials (copy to config/agent.env β do not commit secrets). | |
| # Loaded by tools/config.py when APP_TYPE=agent (or legacy "pi"); set automatically by | |
| agent-redact/shared/gradio_app.py, shared/start.sh, and docker-compose pi-agent services. Override with | |
| APP_CONFIG_PATH if needed. | |
| APP_TYPE=agent also skips eager spaCy/Presidio load at startup (the agent orchestrates redaction remotely). | |
| # Local Windows/macOS dev: leave unset to use {repo}/workspace (created automatically). | |
| Docker: compose sets AGENT_WORKSPACE_DIR=/home/user/app/workspace | |
| AGENT_WORKSPACE_DIR= | |
| # Per-user session subfolders: {AGENT_WORKSPACE_DIR}/{gradio_session_hash}/ (default on). | |
| Set false only if you want one shared workspace tree for all browser sessions. | |
| AGENT_SESSION_WORKSPACE=true # per-browser subfolder under workspace/ (default when unset) | |
| AGENT_SESSION_WORKSPACE=false # single shared workspace root (legacy) | |
| # Skills: on startup, repo skills/ are copied to {AGENT_WORKSPACE_DIR}/.pi/skills/ (read-only). | |
| Pi RPC uses --no-skills and loads only that folder; cwd is the session subfolder. | |
| AGENT_SKILLS_RESYNC=true # force refresh from repo on next start | |
| AGENT_SKILLS_WRITABLE=true # skip read-only chmod (local debugging) | |
| # Gradio upload temp (must match GRADIO_TEMP_DIR; local default: workspace/.gradio_uploads) | |
| AGENT_UPLOAD_ROOT= | |
| GRADIO_TEMP_DIR= | |
| # GuardDuty Malware Protection for S3 β stage Gradio uploads before Start redaction. | |
| Requires RUN_AWS_FUNCTIONS=True and a non-empty MALWARE_SCAN_S3_BUCKET (same as main app). | |
| SCAN_UPLOADS_FOR_MALWARE=False | |
| MALWARE_SCAN_S3_BUCKET= | |
| MALWARE_SCAN_S3_PREFIX=upload-staging/ | |
| MALWARE_SCAN_POLL_INTERVAL_SEC=2.0 | |
| MALWARE_SCAN_TIMEOUT_SEC=120.0 | |
| MALWARE_SCAN_SHOW_CHECKING_INFO=True # also shows success toast when scan is clean | |
| # Pi Gradio listen port (default 7862 local-docker, 7860 hf-space). Not GRADIO_SERVER_PORT (main app). | |
| AGENT_UI_PORT=7862 | |
| # Monorepo root (skills/, config/). Usually auto-detected on Windows/macOS; Docker sets /workspace/doc_redaction. | |
| AGENT_WORKDIR= | |
| # Host-only: path to pi RPC CLI if not on PATH (Windows: ...\AppData\Roaming\npm\pi.cmd) | |
| AGENT_EXECUTABLE= | |
| # doc_redaction Gradio app for Pass 1 /doc_redact and review APIs (not the Pi UI above). | |
| Local dev: main app on 7860 β DOC_REDACTION_GRADIO_URL=http://127.0.0.1:7860 | |
| Docker compose: http://redaction-app-llama:7860 (see docker-compose_llama_agentic.yml) | |
| DOC_REDACTION_GRADIO_URL=http://127.0.0.1:7860 | |
| # When the main app keeps COGNITO_AUTH=True, set a dedicated Cognito user for gradio_client | |
| (not the Pi UI user's session). Optional on Express+Pi: main backend auth is off by default. | |
| DOC_REDACTION_GRADIO_AUTH_USER= | |
| DOC_REDACTION_GRADIO_AUTH_PASSWORD= | |
| # --- Intro / branding (Pi Gradio UI) --- | |
| AGENT_GRADIO_TITLE=Agentic Document Redaction | |
| AGENT_INTRO_TEXT=intros/pi_intro.txt | |
| AGENT_INTRO_TEXT supports {USER_GUIDE_URL} and {AGENT_GRADIO_TITLE} when loading from a .txt file. | |
| # Used by the pi-agent service in docker-compose_llama_agentic.yml. | |
| UI overrides in the Gradio app apply for the current container session only. | |
| Deployment profile: local-docker (default) | hf-space | aws-ecs (split container from doc_redaction) | |
| AGENT_DEPLOYMENT_PROFILE=local-docker | |
| On AWS ECS, Pi and doc_redaction are separate services β outputs are downloaded via | |
| gradio_client HTTP, not by grepping /workspace on the Pi container (see doc-redaction-app Β§2f). | |
| ECS/CDK typically sets AGENT_DEPLOYMENT_PROFILE=aws-ecs, AGENT_DEFAULT_PROVIDER=amazon-bedrock, | |
| and AGENT_DEFAULT_MODEL=anthropic.claude-sonnet-4-6 via task env (overrides this file). | |
| --- Agent orchestration backends (pi default | langgraph | agentcore) --- | |
| AGENT_ORCHESTRATOR=pi | |
| AGENT_ORCHESTRATOR=langgraph | |
| AGENT_ORCHESTRATOR=agentcore | |
| AGENTCORE_RUNTIME_URL=https://your-agentcore-runtime.example | |
| See agent-redact/agentcore/README.md for deploy steps and how to obtain the URL. | |
| AGENTCORE_API_KEY= | |
| LANGGRAPH_REQUIRE_REVIEW_APPROVAL=true | |
| LangGraph ReAct step budget (default 150). Raise if you see | |
| "Sorry, need more steps to process this request." | |
| LANGGRAPH_RECURSION_LIMIT=150 | |
| LangGraph context compaction (trim older tool history before each LLM call) | |
| LANGGRAPH_COMPACTION_ENABLED=true | |
| LANGGRAPH_COMPACTION_RESERVE_TOKENS=28672 # falls back to AGENT_COMPACTION_RESERVE_TOKENS | |
| LANGGRAPH_MAX_OUTPUT_TOKENS=8192 | |
| Also passed as ChatOpenAI max_tokens for llama-cpp. Large write_workspace_text | |
| bodies can still break tool-call JSON on local models; the runtime retries once | |
| with a compact-script nudge when the server returns a tool-arg parse error. | |
| Arize AX / Phoenix tracing (LangGraph + Pi). | |
| - LangGraph: auto LLM/tool spans via openinference-instrumentation-langchain. | |
| - Pi: custom AGENT/TOOL spans from the RPC event stream (LLM HTTP stays in Node | |
| pi β no per-message LLM spans unless you instrument the model server). | |
| Requires arize-otel (AX) or arize-phoenix-otel (Phoenix); LangGraph also needs | |
| openinference-instrumentation-langchain β see requirements_agent.txt. | |
| Smoke: set vars below, send one Gradio chat turn, confirm spans in AX or local | |
| Phoenix; send a follow-up in the same browser session and check Sessions for a | |
| shared session.id (= Gradio session_hash). | |
| With ARIZE_TRACING_ENABLED unset, no collector traffic. | |
| # Process KPIs to watch in Phoenix/AX (see agent-redact/eval/README.md): | |
| - tool error rate / identical-error streaks | |
| - turn latency p50/p95 (and per-tool: doc_redact vs review_apply) | |
| - trajectory completeness (doc_redact β¦ review_apply; workflow_incomplete) | |
| - optional AgentCore Evaluations when AGENT_ORCHESTRATOR=agentcore | |
| ARIZE_TRACING_ENABLED=true | |
| ARIZE_BACKEND=ax | |
| ARIZE_BACKEND=phoenix | |
| PHOENIX_COLLECTOR_ENDPOINT=http://localhost:6006 | |
| # Docker agent β Phoenix on host: http://host.docker.internal:6006 | |
| PHOENIX_API_KEY= | |
| ARIZE_SPACE_ID= | |
| ARIZE_API_KEY= | |
| ARIZE_PROJECT_NAME=doc-redaction-langgraph | |
| ARIZE_ENDPOINT=europe | |
| ARIZE_ENDPOINT=us | |
| Default Pi orchestration backend: llama-cpp | google-gemini | amazon-bedrock | |
| AGENT_DEFAULT_PROVIDER=llama-cpp | |
| AGENT_DEFAULT_PROVIDER=amazon-bedrock | |
| AGENT_DEFAULT_MODEL=anthropic.claude-sonnet-4-6 | |
| AGENT_DEFAULT_MODEL=unsloth/Qwen3.6-27B-MTP-GGUF | |
| Default redaction task settings (Gradio UI + agent prompt; see agent-redact/shared/redaction_prompt.py) | |
| AGENT_DEFAULT_OCR_METHOD=hybrid-paddle-inference-server | |
| AGENT_DEFAULT_PII_METHOD=Local | |
| pi-bedrock compose profile overrides: AWS Textract service - all PDF types / AWS Comprehend | |
| pi-gemini compose profile overrides: tesseract / Local | |
| --- HF Space profile (AGENT_DEPLOYMENT_PROFILE=hf-space) --- | |
| AGENT_DEFAULT_PROVIDER=google-gemini | |
| AGENT_DEFAULT_MODEL=gemini-flash-latest | |
| HF Space: point DOC_REDACTION_GRADIO_URL at your doc_redaction Space (see top of file). | |
| HF_TOKEN= # auth to private redaction Space (Space secret on Pi Space) | |
| DOC_REDACTION_HF_TOKEN= # alias mirrored to HF_TOKEN | |
| Local llama-cpp (match AGENT_LLAMA_MODEL_ID to the active compose profile / llama.cpp -hf repo) | |
| AGENT_LLAMA_BASE_URL=http://llama-inference:8080/v1 | |
| AGENT_LLAMA_MODEL_ID=unsloth/Qwen3.6-27B-MTP-GGUF # --profile 27b_36 (pi-agent) | |
| AGENT_LLAMA_MODEL_ID=unsloth/Qwen3.6-35B-A3B-GGUF # --profile 35b_36 (pi-agent-35b) | |
| AGENT_LLAMA_MODEL_ID=unsloth/gemma-4-31B-it-GGUF # --profile gemma4-31b (pi-agent-gemma-31b) | |
| AGENT_LLAMA_MODEL_ID=unsloth/gemma-4-26B-A4B-it-GGUF # --profile gemma4-26b (pi-agent-gemma-26b) | |
| Google Gemini (Pi resolves GEMINI_API_KEY; GOOGLE_API_KEY is mirrored at startup) | |
| GEMINI_API_KEY= | |
| GOOGLE_API_KEY= | |
| # Quota / rate-limit retries (Gradio UI loop and Pi auto-retry in settings.json; default 5) | |
| AGENT_MAX_RETRIES=5 | |
| AGENT_QUOTA_RETRY_DELAY_S=60 | |
| AGENT_GEMINI_RETRY_BASE_DELAY_MS=60000 | |
| AGENT_GEMINI_RETRY_MAX_DELAY_MS=90000 | |
| Pi session auto-compaction (written to ~/.pi/agent/settings.json on startup) | |
| AGENT_COMPACTION_ENABLED=true | |
| AGENT_COMPACTION_RESERVE_TOKENS=32768 | |
| AGENT_COMPACTION_KEEP_RECENT_TOKENS=20000 | |
| AWS Bedrock (uses AWS SDK credential chain β not a single API key) | |
| AWS_REGION=eu-west-2 | |
| AWS_ACCESS_KEY_ID= | |
| AWS_SECRET_ACCESS_KEY= | |
| AWS_SESSION_TOKEN= | |
| AWS_PROFILE= | |