Skip to content

API Reference parrot.integrations.matrix.hook

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.integrations.matrix.hook

View source

Matrix protocol hook for AutonomousOrchestrator.

Concrete implementation of :class:~navigator_eventbus.hooks.base.BaseHook for the Matrix messaging protocol. Listens to Matrix room messages via mautrix-python and routes them to agents/crews.

This module auto-registers MatrixHook with :class:~navigator_eventbus.hooks.base.HookRegistry on import::

import parrot.integrations.matrix.hook   # triggers auto-registration

Features:

  • Listens to room messages via /sync loop
  • Filters by allowed_users (MXIDs)
  • Supports command_prefix (e.g., "!ask")
  • Routes to specific agents based on room_routing config
  • Auto-reply support via Matrix

Class MatrixHook

Matrix message listener via mautrix-python.

Example configuration::

config = MatrixHookConfig(
    name="matrix_hook",
    enabled=True,
    target_type="agent",
    target_id="AssistantAgent",
    homeserver="http://localhost:8008",
    bot_mxid="@parrot-bot:parrot.local",
    access_token="syt_...",
    command_prefix="!ask",
    allowed_users=["@jesus:parrot.local"],
    room_routing={
        "!sales-room:parrot.local": "SalesAgent",
        "!finance-room:parrot.local": "FinanceCrew",
    },
)
Parameter Type Default Description
config MatrixHookConfig Matrix hook configuration.
**kwargs Any {} Extra keyword arguments forwarded to :class:BaseHook.

Method MatrixHook.start

Connect to Matrix homeserver and start listening.

start() -> None

Method MatrixHook.stop

Stop listening and disconnect.

stop() -> None

Method MatrixHook.send_reply

Send a reply to a Matrix room.

Called by the orchestrator after processing.

send_reply(room_id: str, message: str) -> bool

Parameter Type Default Description
room_id str Target room ID.
message str Message content.

Returns: bool — True if sent successfully, False otherwise.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally