File size: 7,166 Bytes
0248e50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# 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=
#
# 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 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 only; no-op for AGENT_ORCHESTRATOR=pi).
# Requires openinference-instrumentation-langchain plus either arize-otel (AX)
# or arize-phoenix-otel (Phoenix) — see requirements_agent.txt.
# Smoke: set AGENT_ORCHESTRATOR=langgraph + 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/pi, no collector traffic.
# ARIZE_TRACING_ENABLED=true
# ARIZE_BACKEND=ax
# ARIZE_BACKEND=phoenix
# PHOENIX_COLLECTOR_ENDPOINT=http://localhost: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=