Skip to content

Repository files navigation

Observatory

The Context Company does agent observability. We care deeply about DX; it's our single biggest priority.

Observatory is a monorepo containing core packages for AI agent observability across TypeScript and Python:

TypeScript:

Python:

  • contextcompany - Python SDK with built-in integrations for LangChain, CrewAI, Agno, and LiteLLM

MCP server

The Context Company ships a remote MCP server so coding agents and developer tools can query your production agent data directly — no dashboard round-trips. It is listed in the official MCP registry as io.github.The-Context-Company/context-company.

https://api.thecontext.company/mcp

Ask questions like "what failed in production this week?", "which tool calls are creating bad outcomes?", or "which traces should become evals?" and get answers backed by the actual runs.

Tools include:

  • insight_search - natural-language questions over your production traces, sessions, and patterns
  • get_agent_runs / get_agent_run - list and inspect runs with full step and tool-call detail
  • get_agent_sessions / get_agent_session - conversation-level views
  • list_agent_patterns / list_agent_topics - recurring behavior patterns and auto-detected topics
  • Config tools for managing tracked patterns, scheduled recaps, memories, and skills (OAuth)

Connect from Cursor, Claude Code, or any MCP client (transport is streamable HTTP; authenticate with OAuth or an API key as a bearer token):

{
  "mcpServers": {
    "context-company": {
      "url": "https://api.thecontext.company/mcp"
    }
  }
}

See the MCP documentation for authentication details and the full tool reference.

Local mode (AI SDK + Next.js)

Local mode allows you to run The Context Company in a local-first way. This is 100% open-source and requires no account or API key. To set up local mode, refer to the guide below or our documentation.

Local mode currently only supports Vercel AI SDK on Next.js.

Setup

Step 1: Install dependencies

pnpm add @contextcompany/otel @vercel/otel @opentelemetry/api

Step 2: Add instrumentation to Next.js

If you haven't already, add an instrumentation.[js|ts] file in the root directory of your project (or inside the src folder if you're using one). Call the registerOTelTCC function to instrument your AI SDK calls.

See the Next.js Instrumentation guide for more information on instrumenting your Next.js application.

// instrumentation.ts
export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    const { registerOTelTCC } = await import("@contextcompany/otel/nextjs");
    registerOTelTCC({ local: true });
  }
}

Step 3: Add widget to layout

Add the Local Mode widget to the root layout of your Next.js application.

// app/layout.tsx
import Script from "next/script";

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <head>
        {/* add The Context Company widget */}
        <Script
          crossOrigin="anonymous"
          integrity="sha384-ryHylpN8vggwpf+rjl5Z7CGgpVWrEAXn6WTY/Kv2RhlixzrdTMCP3/DPS3RMtNCg"
          src="https://unpkg.com/@contextcompany/widget@1.0.8/dist/auto.global.js"
        />
        {/* other scripts */}
      </head>
      <body>{children}</body>
    </html>
  );
}

Step 4: Enable telemetry for AI SDK calls

As of AI SDK v5, telemetry is experimental and requires the experimental_telemetry flag to be set to true. Ensure you set this flag to true for all AI SDK calls you want to instrument.

// route.ts
import { generateText } from "ai";

const result = generateText({
  // ...
  experimental_telemetry: { isEnabled: true }, // required
});

Note

By default, The Context Company collects limited anonymous usage data when running local mode. No sensitive or personally identifiable information is ever collected. You can view exactly which events and values are tracked here. To disable anonymous telemetry, set the TCC_DISABLE_ANONYMOUS_TELEMETRY environment variable to true in your Next.js project. Learn more about this in our documentation.

Examples

Check out the examples/ directory for working demos across all supported frameworks:

Example Framework Language
nextjs-widget AI SDK + Local Widget TypeScript
nextjs-aisdk AI SDK + Cloud Mode TypeScript
claude-agent-sdk Claude Agent SDK TypeScript
langchain-ts LangChain / LangGraph TypeScript
mastra Mastra TypeScript
custom-ts Custom Instrumentation TypeScript
openclaw OpenClaw (OTLP Collector) TypeScript
pi Pi Agent SDK TypeScript
langchain LangChain Python
crewai CrewAI Python
agno Agno Python
custom-python Custom Instrumentation Python

Contributing

Acknowledgments

  • Big thanks to Anthony Hoang and Eric Zhang for being active contributors!
  • Special thanks to @RobPruzan for helping with the design of the tool and being an early adopter.
  • React Scan has a phenomenal DX and Preact widget that we took inspiration from.
  • The implementation behind the Next.js Devtools overlay widget was insightful.

Releases

Packages

Contributors

Languages