Grepedia
FO

Foglamp

An observability layer for Vercel AI SDK agents, providing real-time monitoring of costs, latency, tokens, and traces with a simple two-line integration.

Score1
About

Foglamp provides a comprehensive observability layer specifically designed for AI agents built on the Vercel AI SDK. It enables developers to monitor critical metrics including cost, latency, token usage, and distributed traces, while also providing full access to prompt and response logs. Built for TypeScript environments, Foglamp supports multiple versions of the Vercel AI SDK, including v4, v5, v6, and the v7 beta. The integration is designed to be lightweight, requiring only two lines of code to implement. Foglamp operates by wrapping the AI SDK module or utilizing native telemetry-integrations APIs, ensuring that it remains a silent no-op if no API key is provided, thereby avoiding any negative impact on model call performance or latency. The system is flexible in its deployment, allowing users to either utilize the hosted service provided by Foglamp or self-host the entire stack using Docker Compose, which includes a ClickHouse-based backend.

Some of the key features are:

  • Cost at ingest: Provides automatic pricing for every span, broken down by input, output, reasoning, and cached tokens to prevent misleading cost reporting.
  • Distributed traces: Allows grouping of top-level generateText and streamText calls into coherent agents, workflows, and runs.
  • Latency & TTFT: Captures performance metrics like p50/p95/p99 latency and time-to-first-token directly from the SDK.
  • Self-host or hosted: Supports both managed service deployments and local self-hosting using Docker Compose for complete data control.
  • Visual dashboard: Offers an integrated HUD and dashboard to visualize traces, workflows, sessions, evals, and alerts.
  • No-op implementation: Ensures the SDK does not throw errors or increase latency if the Foglamp API key is not configured.

To use Foglamp, developers integrate the library into their Vercel AI SDK implementation. The SDK captures spans during execution, batches them, and performs a fire-and-forget flush to the ingestion API. This API handles authentication, calculates span pricing, and stores the data in a ClickHouse database for visualization within the Foglamp dashboard. Users can also utilize the Foglamp Scan tool to map out their repository and visualize their agent-based architecture through interactive maps.

Some common use cases include:

  • Cost management: Identifying and optimizing high-cost AI agent workflows by analyzing token usage and model execution costs.
  • Performance tuning: Tracking latency and time-to-first-token to improve user experience in real-time generative applications.
  • Debugging agent behavior: Investigating unexpected agent outputs or failed tool executions using detailed prompt and response logs.
  • Production monitoring: Setting up alerts for agent failures or quality drops before they impact end-users.
  • Architecture visualization: Mapping complex AI codebase structures using the Foglamp Scan tool to better understand and share project flow.