Procurement Cashflow Guardrail Agent
Visão Geral
O Cashflow Guardrail Agent valida se planos de compra estão dentro do orçamento de caixa. Atua como guardrail financeiro antes da execução.
Endpoint
- Base URL:
https://csuite-dev.vallery.com.br/proc/cashflow - Porta interna:
8038
Endpoints Disponíveis
Health Check
GET /health
Validar Plano
POST /v1/cashflow/validate
Valida se um plano de compra cabe no orçamento.
Request Body:
{
"org_id": 1,
"plan_id": 123,
"total_value": 50000.00,
"payment_date": "2026-02-15"
}
Response:
{
"outcome": "ALLOW",
"validation": {
"approved": true,
"available_budget": 100000.00,
"plan_value": 50000.00,
"remaining_after": 50000.00,
"utilization_pct": 50.0
}
}
Response DENY
{
"outcome": "DENY",
"validation": {
"approved": false,
"available_budget": 30000.00,
"plan_value": 50000.00,
"shortfall": 20000.00,
"reason": "Insufficient budget"
}
}
Regras de Validação
| Regra | Condição | Ação |
|---|---|---|
| Budget Check | plan_value <= available_budget |
ALLOW/DENY |
| Utilization Limit | utilization_pct <= 90% |
ALLOW/WARN |
| Emergency Reserve | remaining >= min_reserve |
ALLOW/WARN |
Integração
Chamado pelo Execution Agent antes de confirmar ordem de compra.
Dependências
- CSuite Cashflow API: Para consulta de orçamento
- Tabela:
csuite_procurement.procurement_plan
Configuração
| Variável | Descrição | Default |
|---|---|---|
MYSQL_HOST |
Host do banco | localhost |
MYSQL_DB |
Database | csuite_procurement |
CASHFLOW_API_URL |
URL do Cashflow API | http://csuite-cashflow-api:8000 |
PORT |
Porta do serviço | 8038 |
Arquitetura
┌──────────────────┐ ┌──────────────────┐
│ Execution Agent │────▶│ Cashflow Agent │
└──────────────────┘ │ │
│ - validate() │
│ - check_budget()│
└────────┬─────────┘
│
▼
┌──────────────────┐
│ CSuite Cashflow │
│ API │
└──────────────────┘
Métricas
procurement_cashflow_validations_total- Total de validaçõesprocurement_cashflow_denied_total- Planos negados por orçamentoprocurement_cashflow_utilization_pct- Utilização média do orçamento