SDK Reference
Overview

SDK Overview

The Grounded SDK is the programmatic interface to the existing Grounded /api.

It is split into three packages because the product has three distinct runtimes:

PackageRuntimeUse it when you want to...
@grounded/clientserverautomate Grounded resources and workflows
@grounded/tracingserversend direct llm and backend traces into Grounded
@grounded/analyticsbrowsersend product telemetry and keep stable session context

The Primitive Model

Grounded is easiest to understand through its primitives:

  • traces and telemetry are the write primitives
  • sessions are the derived read primitive
  • snapshots are the versioned agent-config primitive
  • jobs are the async execution primitive

That means:

  • you do not manually author sessions through the public SDK
  • you write raw runtime data and read sessions back later
  • you iterate on snapshots and let jobs do the async work

Ingestion Modes

Grounded supports three ingestion modes:

  1. import
    • historical or recurring sync through connectors
    • LangSmith for llm traces
    • FullStory for product/session telemetry
  2. direct
    • first-party writes through @grounded/tracing and @grounded/analytics
  3. mirror
    • keep another provider but send a normalized copy into Grounded at the same time

Underlying Routes

The SDK sits on top of the current Grounded routes:

  • /api/agents
  • /api/connectors
  • /api/traces
  • /api/telemetry
  • /api/sessions
  • /api/insights
  • /api/snapshots
  • /api/jobs
  • /api/job-loops
  • /api/evals

The client package normalizes route-shape differences so callers do not need to care whether a backend list route returns:

  • a raw array
  • { data: [...] }
  • a paginated object

Typical Architecture

  1. The browser uses @grounded/analytics and forwards analytics.getContext() to your backend.
  2. The backend uses @grounded/tracing and emits traces that share the same correlation keys.
  3. Grounded merges telemetry and traces into derived sessions.
  4. @grounded/client reads sessions, traces, snapshots, and jobs, and triggers sync, analysis, optimization, and eval workflows.

Current Distribution

The packages live in the Grounded monorepo today:

  • sdk/client
  • sdk/tracing
  • sdk/analytics

The npm publish path is prepared, but public package availability depends on the current release state of the @grounded scope.

Reference Sections