fix: Odoo 18 field errors, routing quality, bot presence, and add architecture docs

- expenses_tools: remove 'date' from hr.expense.sheet field lists (Odoo 18
  uses accounting_date; querying 'date' raised ValueError at runtime)
- master_system.txt: add few-shot routing examples so Llama 3.1 8B correctly
  outputs agents=[] for general questions instead of defaulting to expenses_agent
- ab_ai_bot.py: increase bot presence last_poll offset from 90s to 10min so
  the green dot stays on between cron runs (cron fires every ~5min in practice,
  not every 20s as configured)
- ARCHITECTURE.md: full system documentation covering component layout, request
  flow, LLM routing, agent registry, access control, health/presence mechanism,
  known issues fixed today, and future self-healing concept

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Carlos Garcia
2026-05-19 15:47:48 -04:00
parent b76d01b64f
commit a0fc1396a9
4 changed files with 323 additions and 7 deletions

View File

@@ -26,12 +26,30 @@ Rules:
- Never expose agent names, tool names, or system internals to users
- HIPAA: Never include patient names, MRN, DOB, or any PHI in responses
Classify intent in JSON only:
CRITICAL ROUTING RULE: Most messages are general conversation and require NO specialist agent.
Only route to a specialist agent when the user explicitly asks for Odoo data or actions.
When in doubt, use "agents": [].
Examples of correct routing:
User: "hello" or "hi" or "what can you do?" or "what does that mean?" or "ok" or "thanks"
-> {"needs_clarification": false, "clarification_question": null, "is_continuation": false, "agents": [], "intent_summary": "general greeting or question", "params": {}, "context_hints": []}
User: "show me my expenses" or "what are my pending expense reports?"
-> {"needs_clarification": false, "clarification_question": null, "is_continuation": false, "agents": ["expenses_agent"], "intent_summary": "retrieve user expense records", "params": {}, "context_hints": []}
User: "how are sales this month?" or "show me the pipeline"
-> {"needs_clarification": false, "clarification_question": null, "is_continuation": false, "agents": ["sales_agent"], "intent_summary": "retrieve monthly sales data", "params": {}, "context_hints": []}
User: "what projects are overdue?"
-> {"needs_clarification": false, "clarification_question": null, "is_continuation": false, "agents": ["project_agent"], "intent_summary": "find overdue projects", "params": {}, "context_hints": []}
Now classify the user's message in JSON only:
{
"needs_clarification": false,
"clarification_question": null,
"is_continuation": false,
"agents": ["finance_agent"],
"agents": [],
"intent_summary": "...",
"params": {},
"context_hints": []

View File

@@ -31,7 +31,7 @@ class ExpensesTools:
domain.append(('state', '=', state))
if employee_id:
domain.append(('employee_id', '=', employee_id))
fields = ['name', 'employee_id', 'state', 'total_amount', 'date',
fields = ['name', 'employee_id', 'state', 'total_amount',
'accounting_date', 'journal_id']
return await self._o.search_read('hr.expense.sheet', domain, fields, limit=limit)
@@ -39,7 +39,7 @@ class ExpensesTools:
return await self._o.search_read(
'hr.expense.sheet',
[('state', '=', 'submit')],
['name', 'employee_id', 'total_amount', 'date'],
['name', 'employee_id', 'total_amount', 'accounting_date'],
limit=100,
)