How kevinrivm/nea-agent works
Nea is a self-hosted conversational scheduling agent for CRM-dispatched social messages. Its main path is durable dispatch intake, then a conversational turn that obtains CRM context, consults the business profile, uses an LLM and tools, and replies through the CRM. Scheduling, media understanding, follow-up, escalation, and durable retries are distinct capabilities. The excerpts establish the dispatch and turn flow; some auxiliary links rely on README descriptions or source-index references, so unsampled implementation details are not inferred.
Main entry points: turn.py Turn orchestrator · crm.py CRM API client · main.py FastAPI runtime · dispatch.py Dispatch intake
Components 24
Dispatch and runtime
- Dispatch intake
app/dispatch.py - FastAPI runtime
app/main.py
Conversation behavior
- Turn orchestrator
app/turn.py - LLM client
app/llm.py - Prompt builder
app/prompt.py - Agent tools
app/tools.py - Media processing
app/media.py - Message formatting
app/formato.py - Hostility rules
app/hostility.py - Stall handling
app/stall.py
CRM and business context
- Agenda probing
app/agenda.py - CRM API client
app/crm.py - Cloud CRM client
app/crm_brains.py - Business profile
app/profile.py - Organization routing
app/multiorg.py - Agent rehearsal
app/ensayo.py
State and reliability
- Conversation state
app/state.py - Postgres store
app/db.py - Dispatch inbox
app/dispatch_store.py - Dispatch worker
app/dispatch_worker.py - Follow-up worker
app/followup.py - Pending sender
app/sender.py
Other components
- Business lead
- Vocero CRM
Connections 33
- Vocero CRM → Dispatch intake: dispatches messages
README.md - Dispatch intake → Dispatch inbox: persists dispatch
app/dispatch.py - Dispatch intake → Turn orchestrator: queues turn
app/dispatch.py - FastAPI runtime → Dispatch intake: registers intake
app/main.py - FastAPI runtime → Dispatch worker: starts worker
app/main.py - Dispatch worker → Dispatch intake: processes inbox
app/dispatch_worker.py - Turn orchestrator → CRM API client: gets context
app/turn.py - Turn orchestrator → LLM client: runs completion
app/turn.py - Turn orchestrator → Agent tools: executes tool calls
app/turn.py - Turn orchestrator → Prompt builder: builds prompt
app/turn.py - Turn orchestrator → Media processing: processes inbound media
app/turn.py - Turn orchestrator → Message formatting: formats reply
app/turn.py - Turn orchestrator → Hostility rules: checks hostility
app/turn.py - Turn orchestrator → Stall handling: checks stalled state
app/turn.py - Turn orchestrator → Conversation state: reads and updates state
app/turn.py - Agent tools → CRM API client: calls CRM actions
app/tools.py - Agent tools → Agenda probing: checks agenda
app/tools.py - Business profile → CRM API client: loads profile
app/profile.py - Prompt builder → Business profile: uses business profile
app/prompt.py - CRM API client → Vocero CRM: requests bot API
app/crm.py - Cloud CRM client → Vocero CRM: requests brains API
app/crm_brains.py - Organization routing → Cloud CRM client: creates org clients
app/multiorg.py - Organization routing → Business profile: provides org profile
app/multiorg.py - Agent rehearsal → Turn orchestrator: reuses turn flow
app/ensayo.py - Agent rehearsal → Cloud CRM client: reads CRM data
app/ensayo.py - Conversation state → Postgres store: implemented by
app/state.py - Postgres store → Dispatch inbox: uses inbox storage
app/db.py - FastAPI runtime → Postgres store: connects and migrates
app/main.py - FastAPI runtime → Follow-up worker: starts follow-up
app/main.py - FastAPI runtime → Pending sender: starts pending sender
app/main.py - Follow-up worker → CRM API client: gets context
app/followup.py - Pending sender → CRM API client: sends pending replies
app/sender.py - Vocero CRM → Business lead: delivers replies
README.md