On this page
Sommatic Docs
Open portal

Runtime SDK

The sdk prop App Engine passes to every app. Session, input, context and identity; data, files, people and notifications; navigation; and the calls that end a session with or without output.

View as Markdown
Open in

Your app never imports the runtime. App Engine builds an sdk object for each session and passes it as a prop to the entry component. Pass it down through props; do not keep it in a React context or a global.

JSX
// src/main.jsx
export default function AppEntry({ sdk }) {
  return <App sdk={sdk} />;
}

What the app receives

sdk.session

PropertyWhat it is
idThe session id.
appId, appSlugThe app definition id and slug.
launchModeHow the app was opened. See launch modes.
routePathThe current route inside the app (/ by default).

sdk.input

The payload the app was opened with, shaped by contracts/input.schema.json. It is {} when there is no input.

JavaScript
const input = sdk.input || {};
const hasInput = Object.keys(input).length > 0;

sdk.context

PropertyWhat it is
appDefinitionThe app definition: name, slug, manifest, routes, contracts.
appVersionThe active version.
userThe signed-in identity (the same object as sdk.identity).
taskThe task metadata (priority, assignee, due date) when the app was opened from a task.
dataExtra context from whoever opened the app.

sdk.identity

The signed-in Veripass identity, or null while it loads: veripassIdentity, userId, organizationId, displayName, username, avatarUrl, email and memberships.

Read and write

sdk.api

get(url, params?, options?), post(url, body?, options?), patch(url, body?, options?) and delete(url, params?, options?). Requests are scoped to the endpoints the app is allowed to call. With options.withIdentity: true, the request carries the identity headers (Authorization: Bearer <token>, the organization and the app session).

JavaScript
const items = await sdk.api.get('/items', { status: 'active' });
await sdk.api.patch('/items/123', { status: 'active' });

sdk.data

The app’s own record store. Records are always scoped to the app, so an app never reads another app’s records. Writes are optimistic and survive going offline: they are cached and replayed when the connection returns.

ScopeShared with
appEveryone in the organization who uses the app.
user-appdataOne person, in one app and one organization.
userOne person, across organizations.
JavaScript
const note = await sdk.data.create('notes', {
  scope: 'user-appdata',
  title: 'Weekly sync',
  data: { html: '' },
});

await sdk.data.update(note.id, { data: { html: '<p>Agenda</p>' } }, { expectedRevision: note.revision });

const { items } = await sdk.data.list('notes', { scope: 'user-appdata' });

It also offers get, search, remove, restore, getKey and setKey, patch for atomic field operations, batch for all-or-nothing writes, subscribe for changes and status for the sync state.

sdk.files

Binary content. upload(file, { space }) returns the file id; store the id, not the URL. getUrl(id) returns a short-lived URL to display or download it.

sdk.directory

People of the active organization: searchPeople(text), listMembers(), listTeams(), listTeamMembers(teamId) and getUser(identityOrEmail).

sdk.notify(notification)

Shows a host notification (title, body, severity, optional actions, deepLink, tag, duration), filtered by the person’s notification preferences.

Move around

  • sdk.navigate(path) switches to another route of the app (/, /list, /settings).
  • sdk.apps.open({ slug, route, input, mode }) opens another app of the organization. The app must list the slug in manifest.opens_apps. It resolves to { opened: true } or { opened: false, reason } with reason not_allowed, not_found, not_entitled or invalid_route. sdk.apps.canOpen(slug) and sdk.apps.list() tell you beforehand.

End the session

CallWhat it does
sdk.submitOutput(payload)Stores the final output on the session, marks it completed and closes the app.
sdk.saveDraft(payload)Saves work in progress; the session stays open. Can be called many times.
sdk.close()Closes the app without output.
sdk.cancel(reason)Cancels the session without output.
JavaScript
sdk.submitOutput({
  decision: 'approved',
  notes: 'All requirements met.',
  reviewed_at: new Date().toISOString(),
});

Good practice

  1. Use optional chaining (sdk?.session?.launchMode): properties may be undefined while the app initializes.
  2. Check the input before you render a view that depends on it.
  3. Call saveDraft during long reviews so people can leave and come back.
  4. Keep the payload of submitOutput to what consumers need.

Next steps

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs