agent-brain

Section: section4.5-agent Subsystem: telegram-services_v2 Port: 3501 Deploy type: bind-mount Health: http://agent-brain:3501/health Compose: telegram-services_v2/phase2-section4.5-agent/docker-compose.yml
Fragile: BIND-MOUNTED — restart is sufficient (no rebuild needed). Primary LLM caller.
Description

Core AI agent reasoning and response generation service

Role

Executes persona, loads context, calls LLM via llm-gateway, applies tool results, returns final response

Dependencies

hard rabbitmq (prysm-store)
hard llm-gateway (section6-llm-infrastructure)
soft neo4j (prysm-store)

Runbooks

Diagnose manifest builder failure in agent-brain ai-quality
Investigate manifest builder always-skipped for a channel configuration

Behavioral Assertions

agent.chat.request queue has exactly 1 consumer
Input: Normal operating state with agent-brain running
Expected: RabbitMQ management API: queue agent.chat.request consumer_count = 1
llm_queue jobs complete within 30 seconds of submission
Input: LLM job submitted by agent-brain for a DM request
Expected: llm_queue row transitions from queued → processing → completed within 30 seconds
No llm_queue jobs stuck in processing state for more than 5 minutes
Input: llm-gateway is healthy and processing jobs normally
Expected: No rows in llm_queue with status=processing and created_at older than 5 minutes

Diagnostic Tools

Check manifest builder failure rate (last 100 requests) bash
Find manifest builder skips with skip_reason breakdown bash
Inspect most recent manifest builder output for a user bash
Verify manifest builder template key in prompt_templates sql

Recent Issues

#TitleSeverityStatusCreated
#292[agent-brain] BRAIN_CHAT_FAILEDhighopen5/8/2026
#233[agent-brain] BRAIN_CHAT_FAILEDhighresolved5/6/2026
#230[agent-brain] BRAIN_CHAT_FAILEDhighresolved5/6/2026
#76[agent-brain] BRAIN_CHAT_FAILEDhighresolved4/26/2026