channel_agent
channel_agent
¶
ChannelAgent — bridge between messaging channels and AI agents.
Routes incoming :class:~openjarvis.channels._stubs.ChannelMessage objects
to an agent, classifies queries as "quick" or "deep", and delivers responses
either inline or as a preview with an escalation link to a full report.
Classes¶
ChannelAgent
¶
ChannelAgent(channel: BaseChannel, agent: Any, *, max_workers: int = 2)
Bridge between a :class:BaseChannel and an agent.
On each incoming message the agent is invoked in a background thread so
that :meth:_handle_message never blocks the channel's event loop.
Quick queries with short responses are delivered inline; deep queries or
long responses trigger a preview + escalation link.
| PARAMETER | DESCRIPTION |
|---|---|
channel
|
A connected :class:
TYPE:
|
agent
|
Any object that exposes a
TYPE:
|
max_workers
|
Size of the background :class:
TYPE:
|
Source code in src/openjarvis/agents/channel_agent.py
Functions¶
classify_query
¶
Return 'quick' or 'deep' based on heuristics.
Deep signals take priority over quick signals. A query is classified as deep if it contains deep keywords, a time-range phrase, or is longer than 20 words. Otherwise it is quick.