Commit History
-
[KM-631][AI] Langfuse tracing: tokens + latency across the chat pipeline
Rifqi Hafizuddin +1: Claude Opus 4.8Wire Langfuse (was scaffolded-only) so each chat request emits one trace with per-call token counts + latency, plus tool spans. Gated and PII-aware. - New src/observability/langfuse/tracing.py: RequestTracer (one trace/request), NullTracer (no-op), TracingToolInvoker (metadata-only span per tool call), _redact MaskFunction. Best-effort: never raises; pipeline unchanged if Langfuse is down or disabled. - Each LLM call (Orchestrator, Planner incl. retries, Assembler, Chatbot) gained an optional `callbacks` param, passed to the LangChain call only when present (so existing fakes/tests are untouched). Coordinator threads planner/assembler callbacks through. - ChatHandler: enable_tracing flag (default OFF so tests never hit Langfuse), creates one trace per request, wraps the tool invoker for spans, ends the trace. - PII policy for Cloud: UNMASKED = Orchestrator + Planner (PII-safe inputs); MASKED (tokens+latency only) = Assembler + Chatbot (see real rows / doc chunks); to…8cb3714
-
[KM-626][AI] Slow-path agent: Assembler + Coordinator
Rifqi Hafizuddin +1: Claude Opus 4.8The write-up half of the slow path (AGENT_ARCHITECTURE_CONTEXT_new.md §7.5, §8.3). - assembler.py + prompt.py + config/prompts/assembler.md: single LLM call -> AssemblerNarrative; code merges it with the RunState to build the AnalysisRecord (results_snapshot / tasks_run / metadata copied from RunState, never re-authored by the model, so the record stays a faithful source of truth). chat_answer is the first output field so it streams via SSE. Chain construction mirrors the planner service. - coordinator.py: SlowPathCoordinator wires Planner -> TaskRunner -> Assembler. Built and tested, but NOT yet wired into the live ChatHandler. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>e4337a8