TypeScript client SDK
Build custom apps on top of Lunnoa Automate with @lunnoa/client.
@lunnoa/client is the official TypeScript SDK for the Lunnoa Automate Public API. Use it to build portals, internal tools, chat UIs, and backends that talk to your deployment's agents, workflows, entities, queues, and knowledge.
The SDK is presentation-free at the core: no components or widgets. Optional headless React hooks live in @lunnoa/client/react (see React hooks). You bring your own UI framework and design system; the SDK provides typed data access, SSE agent chat streaming, and deployment-specific codegen.
Coding agents (Cursor, Claude Code): start with For agents and the packaged lunnoa-solution-design + lunnoa-client skills.
Requirements
Before you install, make sure you have:
- Node.js 20 or newer (or any runtime with
fetchand web streams) - A Lunnoa Automate deployment URL
- Lunnoa users who can sign in (invite, SSO, or SCIM)
- For CLI commands only, a workspace API key (
lna_…)
Install
Add the package to your app:
npm install @lunnoa/clientQuickstart
Sign in as a Lunnoa user, then list entities. Expansion fields are optional extras: responses are minimal by default, so request what you plan to render.
import { createBrowserClient } from '@lunnoa/client';
const lunnoa = createBrowserClient({
baseUrl: 'https://lunnoa.your-company.example',
});
await lunnoa.auth.login({ email, password });
const { data: invoices } = await lunnoa.entities.list({
objectTypeSlug: 'invoice',
state: 'pending',
expansion: ['attributes'],
});Authentication
Apps sign people in as Lunnoa users. createBrowserClient plus lunnoa.auth.login sends that person's JWT on every call, so their permissions, agent shares, and task history apply. Allow the app origin with CORS_ALLOWED_ORIGINS on the deployment.
import { createBrowserClient } from '@lunnoa/client';
const lunnoa = createBrowserClient({ baseUrl });
await lunnoa.auth.login({ email, password });Full login, 2FA, refresh, SSO, and token-store details: Authentication.
Resources
Most namespaces map to the Public API surface. approvals uses the authenticated workspace API (see Approvals).
| Namespace | Purpose |
|---|---|
auth | Login, 2FA, refresh, SSO discovery, me, local logout |
agents / tasks / agentChat | Agents, task history, SSE chat streaming |
workflows / executions | Trigger workflows and poll or wait for results |
actions | Run a single catalogue action as an ad-hoc Execution (source: SDK) |
entities / entityTypes | Objects and their schemas / state machines |
tables | Reference and lookup tables |
knowledge | Knowledge bases and documents |
queues / queueItems | Human-in-the-loop work items |
approvals | Request Approval inbox (workspace API) |
variables / connections | Workspace configuration |
workflowApps | Resolve app/action IDs to labels and icons |
discovery | Feature flags for the deployment's edition |
List calls accept shared conventions: expansion (extra fields), filterBy, and pagination (page / pageSize). Many list resources also support async iteration (entities.iterate(...), queueItems.iterate(...)).
Browse every public operation on the API reference.
Guides in this section
| Guide | What you will do |
|---|---|
| Quick start | Scaffold the starter, build with a coding agent, deploy as a container |
| Authentication | Login, refresh, SSO, token stores, auto-refresh |
| Codegen | Generate typed accessors for your deployment |
| For agents | Cursor / Claude skills, paste block, short playbook |
| Discovery | Inspect the catalogue, agents, workflows, and entity schemas |
| Entities | Query, create, and change entity state |
| Tables | Read and upsert reference and lookup tables |
| Workflows | Trigger runs, render executionPath, resume NEEDS_INPUT |
| Agents | Define, deploy, and run agents end to end |
| Run actions | Call one catalogue action as an ad-hoc SDK Execution |
| Define locally | Author typed define* factories (actions, workflows, agents) |
| Start runs | Run linear steps as one multi-step SDK Execution |
| CLI | Discover the catalogue for a key, then upsert define* files by slug |
| Sync with the UI | Pull and push JSON agent and workflow definitions |
| Execution progress | Timeline snapshots and live SSE watchProgress |
| Agent chat | Stream SSE chat in the AI SDK UIMessage format |
| Queues | Work through human-in-the-loop queue items |
| Approvals | List pending approvals and decide |
| Errors | Handle LunnoaApiError status helpers |
Checklist for a new custom UI
Use this as a short go-live list once the SDK is wired in.
Sign users in
Confirm the base URL. Use
createBrowserClientand Authentication. Allow the app origin inCORS_ALLOWED_ORIGINS.Run codegen
Run
npx @lunnoa/client codegenagainst the deployment and commit the output. See Codegen.Adapt to features
Call
discovery.enabledFeatures()and hide unsupported areas. See Discovery.Build from schemas
Drive forms and tables from
attributeSchema/customInputConfig, or from the generated types.Handle workflow UX
Render progress with
executions.getProgress/watchProgress(see Execution progress). ResumeNEEDS_INPUTwithsubmitInput. See Workflows.Wire chat carefully
Stream via SSE, handle resume and stop, load history from the task. See Agent chat.
Handle API errors
Map 401 to re-auth, 403 to hide the capability, and 429 to back off. See Errors.
Related
- API authentication: creating keys, JWT login, security notes
- API reference: full public OpenAPI operation list
- npm: @lunnoa/client: package page and release history