/** * slides/20-observability.js * ---------------------------------------------------------------------------- * Slide 20 -- Observability: Datadog + LangSmith * Tracing + metrics. */ 'use strict'; const { helpers, layouts } = require('../../design-system'); function buildObservability(pres, theme) { const slide = pres.addSlide(); helpers.slideBase(slide, pres, theme); helpers.addHeader(slide, pres, theme, { eyebrow: 'STAGE 4', sectionNumber: 4, title: 'Observability', }); helpers.addCodeBlock(slide, pres, theme, { x: 0.5, y: layouts.CONTENT_TOP, w: 5.6, h: 3.5, language: 'python', code: [ '# observability.py', 'from datadog import statsd', 'from langchain_core.tracers import (', ' LangChainTracer,', ')', '', 'tracer = LangChainTracer(', ' project_name="open-swe-prod",', ')', '', 'def record_step(thread_id, duration_s):', ' statsd.histogram(', ' "open_swe.step.duration_s",', ' duration_s, tags=[f"t:{thread_id}"],', ' )', ].join('\n'), filePath: 'open_swe/observability.py', startLine: 1, highlightLines: [3, 4, 5, 8, 9, 10], }); helpers.addCallout(slide, pres, theme, { x: 6.3, y: layouts.CONTENT_TOP, w: 3.2, h: 1.7, kind: 'info', title: 'LangSmith', text: 'Trace каждого run: model ' + 'calls, tool calls, retries. ' + 'Replay, debug, manual ' + 'evaluation.', }); helpers.addCallout(slide, pres, theme, { x: 6.3, y: 3.05, w: 3.2, h: 1.8, kind: 'success', title: 'Datadog', text: 'P95 latency, tokens per ' + 'run, error rate, sandbox ' + 'spend. Alerts на cost ' + 'spikes и длинные loops.', }); helpers.addPageNumber(slide, pres, theme, 20); helpers.addSourceLine(slide, pres, theme, { source: 'research/per-tech/openswe.md + Datadog / LangSmith docs', }); return slide; } module.exports = { buildObservability };