Build governed, observable AI systems on Frontal: AI inference, agents, durable workflows, pipelines, ontology, storage and 10 more services — from one typed client.
bun add @frontal-labs/sdkimport { Frontal } from "@frontal-labs/sdk";
const f = new Frontal({ apiKey: process.env.FRONTAL_API_KEY! });
const { text } = await f.ai.generateText({
model: "claude-sonnet-4-6",
prompt: "Summarize this incident report in one line.",
});
const agent = f.agents.use("agt_ticket_triager");
const run = await agent.message("support.ticket.created", { ticketId: "t_987" });
for await (const event of agent.watch(run.id)) {
if (event.type === "event") console.log(event.event, event.data);
if (event.type === "error") console.error(event.error.code, event.error.retryable);
}That is the whole setup. Set FRONTAL_API_KEY (a frt_... key) and go. The
full quickstart, configuration and error-handling guide lives in
packages/sdk/README.md; the end-to-end guide for
every service is examples/SDKS_GUIDE.md.
Building a UI? @frontal-labs/react gives you useChat in
two files. Copy-paste starters live in templates/: chatbot,
agent-approval, pipeline-graph, cron-export — each is tested against
mocks in CI.
Writing code with an AI assistant? Point it at SKILL.md;
docs/mcp.json lists every doc and headline operation.
- One import.
f.ai,f.agents,f.workflows, ... are lazy, typed getters on a single client. - Typed end to end. Zod-validated requests and responses; every API error is a
FrontalErrorsubclass withcode,requestIdandstatusCode, built on the shared@frontal-labs/errorbase class. Branch oncode, nevermessage; log withdescribeSdkError(), which redacts API keys. Seedocs/ERRORS.md. - Testable without a backend.
@frontal-labs/testingmocks at thefetchlayer so retries, transforms and errors behave exactly as in production. - Docs that can't rot. Every code block in these READMEs is extracted and type-checked in CI; the quickstart above runs against mocks on every PR.
- ESM + CJS, Node 18+ compatibility, Bun, and Fetch/Web Crypto compatible edge runtimes. CI loads built package entries on Node 22 and 24 LTS. Use a Node release that is still supported for production deployments.
Install @frontal-labs/sdk for everything, or a single package if you only
need one service. Every package exposes a createXClient() factory that accepts
{ apiKey } or a shared FrontalClient.
| Package | Description | Version |
|---|---|---|
@frontal-labs/sdk |
Unified client — every service behind new Frontal({ apiKey }). Start here. |
|
@frontal-labs/core |
Transport, auth, retries, pagination, polling, typed errors. | |
@frontal-labs/react |
useChat, useAgentRun, useWorkflowApprovals hooks. |
|
@frontal-labs/testing |
Fetch-level mocks, model mocks, scenarios, fixtures. | |
@frontal-labs/ai |
Text generation, streaming, embeddings, structured output, speech, images. | |
@frontal-labs/agents |
Define, run, watch and version agents. | |
@frontal-labs/workflows |
Durable workflows with approval, condition and parallel steps. | |
@frontal-labs/pipelines |
Data pipelines, runs, backfills, health. | |
@frontal-labs/ontology |
Ontology engine, object types, versions and rollouts. | |
@frontal-labs/blob |
Object storage: upload, download, signed URLs. | |
@frontal-labs/data |
Aggregations, enrichment, quality, exports, federated query. | |
@frontal-labs/lineage |
Lineage graph, traces, impact analysis. | |
@frontal-labs/observability |
Logs, metrics, traces, alerts, dashboards. | |
@frontal-labs/audit |
Append-only audit events. | |
@frontal-labs/governance |
Policies, compliance, roles, permissions, access checks. | |
@frontal-labs/auth |
Sign-in, MFA, account and admin user management. | |
@frontal-labs/billing |
Customers, plans, subscriptions, invoices, meters. | |
@frontal-labs/webhooks |
Endpoints, deliveries, secrets, stats. | |
@frontal-labs/schedules |
Cron schedules and triggers. | |
@frontal-labs/connectors |
Source connectors and per-tenant installations. |
- Bun v1.3.8+ (Node 18+ compatibility for consumers; use a currently supported Node LTS release in production)
- Git
git clone https://github.com/frontal-labs/sdk-typescript.git
cd sdk-typescript
bun install
bun run buildbun run build # build all packages (tsup + tsc declarations)
bun run test # vitest, all packages
bun run test:examples # type-check + run every README code block
bun run lint # biome
bun run format # biome --write
bun run type-check # tsc --noEmit per package
bun run runtime:smoke # load built ESM and CommonJS package entries on Node
bun run docs:manifest # regenerate docs/mcp.json
bun run contract:endpoints # SDK ↔ OpenAPI conformance gate
bun run contract:matrix # regenerate migration matrix
bun run changeset # record a version bumpCI runs format, build, lint, type-check, tests, README examples, docs
freshness and the contract gates on every PR. See
CONTRIBUTING.md and docs/ for architecture,
testing, publishing and release notes.
See docs/ENTERPRISE_READINESS.md for the
repository's verified controls and open enterprise qualification items.
| Variable | Purpose |
|---|---|
FRONTAL_API_KEY |
API key (frt_...) |
FRONTAL_API_URL |
Override base URL (default https://api.frontal.dev/v1) |
FRONTAL_ENV |
development | test | production |
FRONTAL_DEBUG |
1 / true for verbose logging |
Opt-in smoke test against a real backend:
FRONTAL_API_KEY=frt_... bun run test:liveOptional: FRONTAL_BLOB_BUCKET (for blob.list).
Install this repository's TypeScript-specific agent skills with the skills CLI:
npx skills add frontal-labs/sdk-typescriptApache-2.0 — see LICENSE.md.
