Agents SDK
The TypeScript client your app server uses to call the Runtime API.
npm install @nylorun/agentsimport { createClient } from "@nylorun/agents";
const client = await createClient();
const session = await client.createSession({
agentId: "assistant",
ownerUserId: user.id,
});
await session.input("Where is order demo-123?", {
idempotencyKey: crypto.randomUUID(),
});@nylorun/agents calls the Runtime API with an application key. Run it on
your server, never in a browser: the Runtime refuses a key sent with an
Origin header. It requires Node 24 or later.
Each endpoint page in this section shows the SDK call first, then cURL.
The client
| Call | Endpoints |
|---|---|
client.saveAgent(), client.listAgents() | Agents |
client.files | Definition files |
client.createSession(), client.session(id), client.sessions.page() | Sessions API |
client.sandboxes | Sandboxes |
client.artifacts | Artifacts |
client.hostFeatures(), client.access.jwks() | Runtime |
client.as(subject) | Any of the above, for one signed-in person |
The AG-UI and A2A endpoints are for those protocols' clients.
createAgUiHandler() from @nylorun/agents/ag-ui and createA2aHandler()
from @nylorun/agents/a2a serve them from your own server.
Entry points
| Import | Contents |
|---|---|
@nylorun/agents | The client, the agent builder, tools, MCP, skills, plugins, and errors |
@nylorun/agents/client | createClient and the client classes only |
@nylorun/agents/define | The agent builder and tools, without the file-reading .skills() and .plugin() |
@nylorun/agents/ag-ui | createAgUiHandler() |
@nylorun/agents/a2a | createA2aHandler() |
Defining agents, tools, and flows is covered in Build.