SDK

Run Nyte's agent from your own code, in the same process or on another machine.

@nyte-ai/sdk is the same API the desktop app, the terminal and the web app use. A host owns sessions, workspaces, models and credentials. Your code holds a Connection to it. sdk.open starts a host inside your Node process, and sdk.connect reaches one running somewhere else. Both return the same handles, so code written against one works against the other.

summarize.ts
import { isPart, text } from "@nyte-ai/plugin/core";
import { sdk } from "@nyte-ai/sdk";

const host = await sdk.open({});
const { session, receipt } = await host.sessions.start({ content: "Summarize this folder" });

await receipt.settled();

for (const message of (await session.view()).messages) {
  if (isPart(message, text)) console.log(message.state.markdown);
}

await host.close();

With no options, sdk.open works in the current folder and keeps sessions in ~/.nyte/nyte.db. The model needs a signed-in provider first; Build an agent app shows the login.

The handle tree

Everything hangs off one Connection. Getting a handle by id, such as connection.session(id), does no I/O; its methods check that the thing exists when you call them.

Connection
├── sessions          start, list, watch
├── session(id)       a Session, which is also its main Head
│   ├── send, view, subscribe, current, watch, history, tree, move, configure
│   ├── heads         create, merge, remove; head(name) for one
│   ├── run(id), receipt(id), part(id), parts.create
│   └── info, update, remove, stop, command
├── workspaces        list, inspect, add, forget
├── workspace(id)     files, git, github, browser, jobs, mcp
├── models            list, login, logout, setDefault, verify, refresh, usage
├── settings, plugins, principals, github
└── watch, blob, close

A Host, which sdk.open returns, is a Connection plus listen, inspect and execution.

Packages

ImportWhat it has
@nyte-ai/sdksdk.open, sdk.connect, SdkError, watchStore, pagedViews, createSendJournal
@nyte-ai/sdk/clientsdk.connect alone, so importing it never loads the host
@nyte-ai/hostsqliteStore, localProvider and the deploy targets
@nyte-ai/host/providerschatOnlyProvider, for a host with no folder
@nyte-ai/plugin/coreisPart, definePart, the built-in parts and the core Plugin type
@nyte-ai/plugin/clientThe same part helpers, defineRenderer and the client Plugin type
@nyte-ai/schemaasId for typed ids, and standard to pass TypeBox schemas where one is expected

In a browser or React Native bundle, @nyte-ai/sdk resolves to a build without the host. Its sdk.open rejects with SdkError("unavailable").

Where to go next