Skip to main content

Install the SDK

Get an API key

  1. Sign up at app.kairn.sh
  2. Go to Settings → API Keys
  3. Create a new key — it starts with kn_live_
Keep your API key server-side only. Never expose it in client-side code or commit it to version control.

Initialise the client

Create a soul

A soul is the agent’s identity — its instructions, personality, and tool access. Create it once; it serves all your users.
You only need to create a soul once. After that, you can update it with kairn.souls.update().

Seed user context

Write context from your database into the agent’s memory before invoking. The agent reads it automatically.

Invoke the agent

Stream the response

For chat interfaces, use stream() to yield tokens as the agent generates them.

Next steps

Core concepts

Understand souls, memory, sessions, and mandates.

Customer support

Build a support agent that knows your users and takes real actions.

Mandates

Schedule agents to run autonomously — check-ins, reports, nudges.

SDK reference

Full API reference for every method and type.