Developers¶
Build on the state layer
Telha exposes one engine through three surfaces (REST, gRPC, and MCP) plus two client SDKs. This section is the practical reference for building applications, integrations, and agents against it.
-
Query language
The JSON query DSL:
find,whereoperators,expand,vector, temporal coordinates, cursors, and the living fixture corpus. -
REST API
Every
/v1endpoint: records, query, snapshot, compare, schema, ingest, generate, trace, and the OpenAPI document. -
gRPC API
The app-layer and worker services, tenant/worker token auth, deadlines, and the protobuf contracts.
-
MCP tools
The Model Context Protocol server for agents:
findRecords,getHistory,semanticSearch,generate,getTrace, and shaping. -
TypeScript SDK
@telha/sdk: REST and gRPC transports, the typed error taxonomy, retries, and token helpers. -
Python SDK
telha: an httpx + pydantic REST client with ingest wrappers and the same error taxonomy. -
Ingestion
Formats, the sync-vs-async split, dedup, provenance spans, and streaming multi-submit for large files.
-
Generation & traces
/v1/generate, the SSE contract, claim verification verdicts, and the immutable generation trace. -
Error reference
The uniform error envelope and every
codethe API can return, by HTTP status and gRPC mapping.
Conventions used across every surface¶
| Convention | Rule |
|---|---|
| Auth | x-api-key header (REST) or a signed tenant token (gRPC/MCP). Scope is never taken from request bodies. |
| Scope | Every operation is bound to a (tenant, organization) pair by the key or token, not by user input. |
| Errors | Uniform envelope {"code", "message", "request_id"}; x-request-id on every response. |
| Time | Microseconds since epoch, or RFC3339 strings where a time coordinate is accepted. |
| Predicates | where values are operator objects ({"$eq": …}); bare scalars are rejected. |
| Grammar of record | core-engine/tests/fixtures/query_corpus.json (every valid and invalid shape, pinned by tests). |
The fastest way in
Run the Quickstart end to end with curl, then pick the SDK for your language. The query corpus is the authoritative grammar; the SDKs and MCP tools all speak the same DSL.