Skip to content

[18.0][ADD] ai_oca_bridge_hermes#75

Draft
rvalyi wants to merge 3 commits into
OCA:18.0from
akretion:18.0-add-ai_oca_bridge_hermes
Draft

[18.0][ADD] ai_oca_bridge_hermes#75
rvalyi wants to merge 3 commits into
OCA:18.0from
akretion:18.0-add-ai_oca_bridge_hermes

Conversation

@rvalyi
Copy link
Copy Markdown
Member

@rvalyi rvalyi commented Jun 1, 2026

AI OCA Bridge Hermes

This module integrates Odoo Discuss with the Hermes AI Agent, allowing users to chat with AI assistants directly within Odoo's messaging interface. It was largely vibe-coded using Kimi k2.6. We have no OCA guidelines for this, but if you feel we should change the copyrights or module author, I can change that.

Key Features

  • Queue-based message processing with state tracking (pending/processing/done/error)
  • Secure webhook authentication via auto-generated tokens
  • Auto-detection of DM chats with AI users — no manual channel configuration needed
  • Typing indicators while the AI processes responses
  • Rate limiting on the poll endpoint to prevent abuse
  • Extensible architecture with hooks for escalation, custom handlers, and tool integration

Architecture

The module uses a polling-based design for maximum compatibility: Hermes polls Odoo for pending messages via /hermes/poll, processes them with the AI, and posts responses back via /hermes/webhook/<token>. A standalone gateway script (scripts/hermes_odoo_gateway.py) runs outside Odoo and connects to any number of Odoo instances.

Security & Multi-Tenancy

  • Each gateway is scoped to a company (company_id) with multi-company rules
  • AI users are regular Odoo users — their permissions apply to all AI actions
  • Session keys include a database hash for isolation across instances

Compatibility

  • Soft dependency on ai_tool ([18.0] [MIG] ai_tool #69): if installed, Hermes tools are exposed via MCP; if not, a native /hermes/tools/* API is available
  • Escalation hook (_action_escalate) for child modules to implement ticket creation, team notification, or inter-Hermes routing
Screenshot_20260601_123521_Firefox

Testing it:

Create the Hermes Gateway

Go to AI Bridge → Hermes → Gateways → Create:

| Field              | Value                                                |
|--------------------|------------------------------------------------------|
| Name               | Main Hermes                                          |
| AI User            | Select or create a user with an AI Bridge configured |
| Mode               | Polling (pull)                                       |
| Monitored Channels | Leave empty to monitor all channels                  |

Save. The Webhook Token is auto-generated — copy it for step 4.

Create the AI User

Go to Settings → Users → Create:

- Name: Hermes
- Login: hermes
- In the AI Bridge tab: select or create an AI Bridge configuration

This user will post AI responses in Discuss.

Run the gateway

    python ~/DEV/odoo18/odoo/external-src/ai/ai_oca_bridge_hermes/scripts/hermes_odoo_gateway.py \
        --odoo-url http://localhost:8069 \
        --webhook-token YOUR_TOKEN_HERE \
        --use-agent \
        --model <YOUR_MODEL> \
        --provider <YOUR_PROVIDER>

@rvalyi rvalyi marked this pull request as draft June 1, 2026 15:59
@OCA-git-bot OCA-git-bot added mod:ai_oca_bridge Module ai_oca_bridge series:18.0 mod:ai_oca_bridge_hermes Module ai_oca_bridge_hermes labels Jun 1, 2026
@rvalyi rvalyi force-pushed the 18.0-add-ai_oca_bridge_hermes branch 3 times, most recently from 073d0b7 to ef4808e Compare June 2, 2026 11:45
@OCA-git-bot OCA-git-bot removed the mod:ai_oca_bridge Module ai_oca_bridge label Jun 2, 2026
@rvalyi rvalyi force-pushed the 18.0-add-ai_oca_bridge_hermes branch from ef4808e to 1fc73ef Compare June 2, 2026 12:35
rvalyi added 2 commits June 2, 2026 19:42
…sponses

Add _is_ai_mentioned and _should_queue_for_hermes methods to control
when Hermes responds in Discuss channels:

- DM (chat): always respond (1-to-1 conversation)
- Group/channel with @mention: always respond
- Group/channel without mention: only if auto-respond enabled AND
  channel explicitly monitored by the gateway

This prevents Hermes from spamming group channels while still
allowing users to invoke it explicitly with @Hermes.
…fy soft dependency

Add hermes_notify endpoint to send proactive web notifications to users.
Uses web_notify module (OCA/web) as soft dependency:
- If installed: displays toast notifications with action buttons
- If not installed: falls back to DM message

Supports notification types: success, warning, danger, info, default.
Allows sticky notifications and optional action to open records.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:ai_oca_bridge_hermes Module ai_oca_bridge_hermes series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants