The Ashewa AI Bridge and ORM Tool Calling
Technical architecture of the ashewa_ai_bridge, tool calling specifications, ORM model sandboxing, and security scopes.
1. Overview & Business Value#
This comprehensive operational guide details the architecture, business workflows, configuration parameters, and execution steps for The Ashewa AI Bridge and ORM Tool Calling within SmartERP.
Technical architecture of the ashewa_ai_bridge, tool calling specifications, ORM model sandboxing, and security scopes.
{screenshot:ashewa-ai-bridge-and-orm-tools-overview-dashboard}
2. Prerequisites & Security Access Groups#
- Required Modules:
ashewa_ai_workforce, ashewa_ai_bridge, smarterp_ai_agents - Security Groups:
AI Workforce Operator(Technical ID:ashewa_ai.group_ai_operator)AI Systems Administrator(Technical ID:ashewa_ai.group_ai_admin)Governance Officer(Technical ID:ashewa_ai.group_ai_governance)
- Master Data Dependencies: Autonomous AI agent profiles, n8n orchestrator webhooks, LLM model parameters, prompt governance rules, and human-in-the-loop approval queues.
3. Step-by-Step Configuration & Execution#
Step 1: Navigating to the Module Interface#
- Log into your SmartERP instance at
https://smarterp.et/odoo. - Open the main App Switcher (grid icon in the top-left corner).
- Select the AI Workforce app icon.
- From the top navigation bar, open AI Workforce → Copilots → Active Agents / Interaction History / Governance Queue.
{screenshot:ashewa-ai-bridge-and-orm-tools-app-switcher-navigation}
Step 2: Creating and Parameterizing Records#
- Click the New button in the top-left control panel.
- Complete the mandatory fields in the record form:
- Agent Name & Persona (Mandatory): Specialized AI role (Financial Auditor Copilot, SCM Copilot, etc.)
- Target Operational Addon (Mandatory): Integrated SmartERP module (Accounting, HR, Inventory, Sales)
- Autonomy Level (Mandatory): Level 1 Assistive, Level 2 Supervised, Level 3 Autonomous
- Governance Gate (Mandatory): Action risk classification triggering mandatory human confirmation
- Configure optional operational parameters and localized tags as required:
- Context Truncation Limit (Optional): Maximum LLM token window before historical pruning
- Fallback Model Route (Optional): Secondary LLM provider if primary endpoint is unresponsive
- Webhook Authentication Token (Optional): Secure shared secret for n8n workflow callback
- Click the Save icon in the control bar to commit the record.
{screenshot:ashewa-ai-bridge-and-orm-tools-record-creation-form}
Step 3: Validating and Processing Transactions#
- State Transitions: Execute operational state progression (Prompt Ingestion → Reasoning Chain → Action Proposal → Human Gate Approved → Executed).
- Ledger & System Impact: Financial and inventory transactions executed by autonomous agents generate strict audit log entries tagging the AI Agent ID and human approver credentials.
- Audit Verification: Automated recording of author ID, timestamp, and immutable revision history.
{screenshot:ashewa-ai-bridge-and-orm-tools-transaction-processing-state}
Architecture of the Ashewa AI Bridge#
The ashewa_ai_bridge is the core Python integration layer connecting large language model reasoning APIs with the SmartERP object-relational mapping (ORM) runtime.
Tool Calling Protocol#
SmartERP uses strict JSON Schema tool specifications compatible with standard LLM function calling conventions:
{
"name": "reconcile_bank_statement_line",
"description": "Matches a bank statement line to an open customer invoice or vendor bill.",
"parameters": {
"type": "object",
"properties": {
"statement_line_id": {"type": "integer", "description": "The ID of the account.bank.statement.line"},
"invoice_id": {"type": "integer", "description": "The ID of the matching account.move"},
"confidence": {"type": "number", "description": "Match confidence between 0.0 and 1.0"}
},
"required": ["statement_line_id", "invoice_id"]
}
}
Security Sandboxing and Privilege Escalation Prevention#
- User Context Execution: AI tools execute strictly within the security context (
self.env) of the initiating user, respecting all record-level rules (ir.rule) and access rights (ir.model.access). - Read-Only vs Mutating Tools: Tools are partitioned into safe read-only queries (executed immediately) and mutating operations (staged into
ashewa.ai.staging).
4. Advanced Configuration Points#
- Automated Actions & Scheduled Tasks (Crons):
AI Bridge: Heartbeat check for n8n orchestrator nodes(ashewa_ai.ir_cron_heartbeat): Runs every 10 minutes to verify gateway connectivityAI Governance: Auto-archive cleared approval queue tickets(ashewa_ai.ir_cron_archive_audit): Runs daily at midnight to maintain governance ledger performance
- Custom Print Templates & Reports:
- AI Agent Operational Execution Audit Trail
- LLM Token Consumption & Cost Allocation Schedule
- Human-in-the-Loop Decision & Override Ledger
- Agent Workflow Error & Latency Analysis
- Multi-Company Rules: Record-level security isolation under Company 1 (
Ashewa Technology Solutions S.C.), preventing cross-company ledger leakage across parent and subsidiary legal entities.
5. Comprehensive Troubleshooting Matrix#
| Error Symptom / Exception | Probable Root Cause | Corrective Action / Resolution |
|---|---|---|
Connection Refused: n8n webhook unreachable | Endpoint URL invalid, orchestrator service offline, or network firewall block. | Check n8n service health and update bridge URL in AI Workforce Settings. |
Token Limit Exceeded: Context window exhausted | Prompt context exceeds configured model maximum token threshold. | Enable automatic context pruning and reduce historical message buffer in agent settings. |
Governance Block: High-risk action requires human approval | Agent attempted financial posting or document deletion above autonomy threshold. | Review and approve the pending transaction in the Human-in-the-Loop Governance Queue. |