Skip to content

SDK Reference

Typed TypeScript and Go clients for apps built on the CompozyOS daemon.

571 operations · 31 resources · 213 available to app tokens36 pages in SDK Reference

On this page4
import { Compozy } from "@compozy/client";

Install

npm install --save-exact @compozy/client

Create a session and prompt it

run.mjs
import { Compozy } from "@compozy/client";

const compozy = await Compozy.connect();
console.log(`Connected to CompozyOS ${compozy.daemon.version}`);
const { workspace } = await compozy.workspaces.resolveWorkspace({
  body: { path: process.cwd() },
});
const { session } = await compozy.sessions.createSession({
  body: { workspace: workspace.id, agent_name: "claude" },
});
const reply = await compozy.prompt({
  workspaceId: workspace.id,
  sessionId: session.id,
  message: "List the three largest files in this repo.",
});
if (reply.kind === "stream") {
  for await (const chunk of reply.chunks) {
    if (chunk.type === "text-delta") process.stdout.write(chunk.delta);
  }
} else {
  console.log(reply.result.status, reply.result.queue_position);
}

Client

Resources