- tracing.py: init/shutdown, trace_span, get_langfuse_callback, prompt mgmt - main.py: init_langfuse at startup, shutdown on teardown - redis_consumer.py: trace_span around journey_start/message/agent_trigger - agent_runner.py: thread langfuse_handler through classify + processing LLM - journey.py: thread langfuse_handler through _call_llm_with_tools - llm.py: accept callbacks param, forward to LLM constructors - requirements.txt: add langfuse>=3.0.0
Batch Agent Service
Owns: agent_runner, journey builder, filesystem_agent, integrations (Gmail, MS Graph).
Tables owned
local_agent_configscloud_agent_configsagent_run_logs
Endpoints
GET /agents/catalogPOST /agents/can-createPOST /agents/triggerGET /agents/{id}/history
Redis channels
- Subscribe:
batch:request:{user_id} - Publish:
ws:out:{user_id}(journey replies + tool calls) - BRPOP:
tool:result:{call_id}(30s timeout) - SET+EX:
journey:{user_id}(session state, TTL 1800s)
TODO
- Integrate Langfuse tracing (reuse
services/chat/app/tracing.pypattern —trace_span(),get_langfuse_callback(), prompt management). Each batch agent run should create a trace with input/output, link prompts, and pass the LangChainCallbackHandlerto LLM calls.