monocle  by monocle2ai

Observability and testing SDK for GenAI applications

Created 2 years ago
268 stars

Top 95.5% on SourcePulse

GitHubView on GitHub
Project Summary

Monocle provides open-source tracing and testing capabilities specifically for Generative AI (GenAI) applications and agents. It addresses the challenge of understanding the internal workings of complex AI systems by offering deep visibility into LLM calls, agent logic, tool usage, and vector store interactions. Targeted at app developers, platform engineers, and enterprises, Monocle enhances debuggability, reliability, and compliance by transforming "black-box" AI agents into traceable, testable workflows.

How It Works

Monocle functions as a GenAI-specific observability layer built upon the OpenTelemetry standard. It employs a core metamodel to define and standardize attributes for key GenAI entities like agents, prompts, responses, and tools. Instrumentation adapters for popular GenAI frameworks automatically generate OpenTelemetry Protocol (OTLP)-compatible spans for critical operations, eliminating the need for manual instrumentation. This ensures that traces are structured, consistent, and compatible with existing observability backends, facilitating human and automated analysis.

Quick Start & Requirements

Highlighted Details

  • Trace Assertions: The monocle-test-tools package enables writing pytest-compatible tests that assert directly on traces, validating agent behavior, tool calls, inference quality, and cost constraints.
  • Broad Framework Support: Offers first-class instrumentation for numerous GenAI frameworks including LangChain, LlamaIndex, Haystack, Langgraph, CrewAI, Google ADK, and OpenAI Agent SDK.
  • Zero/Low-Code Tracing: Supports both in-code initialization via setup_monocle_telemetry and wrapper/operator modes for tracing applications without modifying source code.
  • AI Coding Assistant Tracing: Provides interactive setup scripts (monocle-apptrace claude-setup, codex-setup, copilot-setup) to trace popular AI coding assistants like Claude CLI, OpenAI Codex CLI, and GitHub Copilot.

Maintenance & Community

Monocle is developed under the Linux Foundation AI & Data umbrella, signifying a commitment to open governance and community collaboration. It is a community-based open-source project with active channels on Discord and Slack for discussions. Detailed contribution guidelines are available in CONTRIBUTING, CODE_OF_CONDUCT, and SECURITY files.

Licensing & Compatibility

The project is licensed under the Apache 2.0 license, which is permissive and generally suitable for commercial use and integration into closed-source applications.

Limitations & Caveats

The project roadmap indicates ongoing development for broader language support (beyond Python and TypeScript), deeper integrations with additional LLM hosting services and vector databases, and enhanced testing/evaluation capabilities. Some integrations, such as for OpenSearch and Milvus vector stores, are marked as "coming soon."

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
60
Issues (30d)
19
Star History
48 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.