A local, multi-agent system powered by xAI Grok 4.1 Fast Reasoning that automates invoice processing: Ingestion (OCR/LLM) → Validation (Mock Inventory) → Approval (VP Persona) → Payment.
- Multi-Agent Architecture: Built with
langgraph. - Intelligent Extraction: Uses Grok 4.1 Fast Reasoning for robust data parsing.
- Stateful Validation: Checks line items against a local SQLite inventory.
- Reflective Approval: "VP Agent" scrutinizes high-value invoices (> $10k).
- Web UI: Includes a Streamlit dashboard for easy demoing.
-
Install Dependencies:
pip install -r requirements.txt pip install streamlit # For the Web UI -
Environment Variables: Create a
.envfile in the root:XAI_API_KEY=your_grok_api_key
Run the interactive dashboard:
streamlit run streamlit_app.pyOpen your browser to http://localhost:8501. You can upload invoices and see the agents in action.
Run the agent manually on specific files:
python3 main.py --invoice_path data/invoice_valid_low.txtTo update the live version on Google Cloud Run:
-
Set Project:
export PROJECT_ID=profitscout-lx6bb export SERVICE_NAME=galatiq-invoice-agent
-
Build & Deploy:
# Prepare Dockerfile mv Dockerfile.monolith Dockerfile # Build Image gcloud builds submit --tag gcr.io/$PROJECT_ID/$SERVICE_NAME . # Restore Dockerfile name mv Dockerfile Dockerfile.monolith # Deploy Service gcloud run deploy $SERVICE_NAME \ --image gcr.io/$PROJECT_ID/$SERVICE_NAME \ --platform managed \ --region us-central1 \ --allow-unauthenticated \ --set-env-vars XAI_API_KEY=your_key_here \ --max-instances 1
For detailed demo instructions and architecture, refer to docs/demo_script.md.
Test files are provided in data/:
invoice_valid_low.txt: Standard invoice, should be APPROVED.invoice_high_suspicious.txt: >$10k, odd patterns, should be REJECTED by VP.invoice_invalid_stock.txt: Requests items not in stock, should fail VALIDATION.
Execution logs are saved to run_logs.json.