Terra Banner

Stop flying blind with local AI.

Terra is a privacy-first observability layer for on-device GenAI. Built on OpenTelemetry, giving you production-grade tracing for inference, embeddings, and agents.

Get Started
$swift package add terra

Zero-Code Auto-Instrumentation

Enable tracing for CoreML and HTTP AI APIs with one line. No logic changes needed.

Privacy by Design

Redacted privacy is the default. No raw prompt/response capture unless explicitly enabled per call.

Multi-Runtime Ready

Native support for MLX, Llama.cpp, CoreML, and Apple's newest Foundation Models.

Instrumentation in seconds.

Start with one-line setup, then compose typed infer/stream/embed/agent/tool/safety calls as your app grows.

  • Step 1: One call with try await Terra.start(.init(preset: .quickstart)).
  • Step 2: Canonical composable API: infer/stream/embed/agent/tool/safety + run.
  • Step 3: Add macros and advanced seams only when you need them.
AppDelegate.swift
1import Terra
2
3 @main
4 class AppDelegate: UIResponder, UIApplicationDelegate {
5 func application(...) {
6 // One line for global auto-instrumentation
7 Task { try? await Terra.start() }
8
9 return true
10 }
11 }
Recipe.swift
1import Terra
2
3let answer = try await Terra
4 .infer(
5 Terra.ModelID("gpt-4o-mini"),
6 prompt: "Summarize yesterday's changes",
7 provider: Terra.ProviderID("openai"),
8 runtime: Terra.RuntimeID("http_api")
9 )
10 .run { trace in
11 trace.tokens(input: 42, output: 18)
12 return "stubbed-response"
13 }
Persistence.swift
1var config = Terra.Configuration(preset: .production)
2 config.persistence = .defaults()
3 Task { try? await Terra.start(config) }

Export anywhere. Persist everywhere.

Terra bridges the gap between on-device inference and your centralized telemetry stack. Ship to any OTLP-compatible backend with on-device buffering for intermittent connectivity.

OTLP/HTTP
Signposts
SQLite Buffer