| name | ai-observability |
| description | Comprehensive guide to monitoring AI/ML systems in production, including Use when this capability is needed. |
| metadata | {"author":"amnadtaowsoam"} |
Ai Observability
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Comprehensive guide to monitoring AI/ML systems in production, including LLMs, RAG applications, and traditional ML models. This skill covers monitoring stack setup (Prometheus, Grafana, Jaeger, Phoenix), metrics tracking (latency, throughput, token usage, cost, errors), model performance monitoring, data drift detection, LLM interaction logging, tracing with LangSmith/Phoenix, alerting strategies, dashboards, A/B test monitoring, cost optimization, debugging patterns, and production deployment checklists.
Why This Matters
AI/ML observability is critical because:
- Cost Control: LLM APIs can be expensive; monitoring prevents budget overruns
- Performance: AI systems have unique latency and throughput characteristics
- Quality: Model performance degrades over time due to drift
- Debugging: AI systems are non-deterministic; tracing is essential
- Reliability: AI systems have unique failure modes requiring specialized monitoring
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
Skill Composition
- Depends on: None
- Compatible with: None
- Conflicts with: None
- Related Skills: None
Quick Start / Implementation Example
- Review requirements and constraints
- Set up development environment
- Implement core functionality following patterns
- Write tests for critical paths
- Run tests and fix issues
- Document any deviations or decisions
def example_function():
pass
Assumptions
- Monitoring stack is accessible via Docker or Kubernetes
- LLM APIs provide token usage information
- Sufficient storage for logs and metrics
- Network connectivity for external observability services
Compatibility
- Python 3.8+
- Prometheus 2.30+
- Grafana 9.0+
- OpenTelemetry 1.0+
- LangChain 0.1+ (for LangSmith tracing)
- Phoenix 2.0+ (for AI-specific observability)
Test Scenario Matrix (QA Strategy)
| Type | Focus Area | Required Scenarios / Mocks |
|---|
| Unit | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration | DB / API | All external API calls or database connections must be mocked during unit tests |
| E2E | User Journey | Critical user flows to test |
| Performance | Latency / Load | Benchmark requirements |
| Security | Vuln / Auth | SAST/DAST or dependency audit |
| Frontend | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns
- High Cardinality Metrics: Too many label combinations causing performance issues
- Silent Monitoring: Monitoring without alerting
- Over-Monitoring: Tracking everything without focus
- Ignoring Context: Metrics without dimensional context
- Alert Fatigue: Too many low-priority alerts
- No Retention Policy: Unlimited log/metric storage
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
Converted and distributed by TomeVault — claim your Tome and manage your conversions.