Install the SDK and authenticate with a workspace key. Keys are scoped per environment; use the development key locally.
npm i @apkar/sdk
export APKAR_KEY=dev_...Define your first agent
An agent is a graph of steps. Each step names a tool and receives the run context. Steps that do not depend on each other execute in parallel.
import { agent } from "@apkar/sdk"
export const triage = agent("triage")
.step("kb.search", (ctx) => ({ query: ctx.ticket.subject }))
.step("draft", (ctx) => ({ context: ctx.results }))
.retry({ max: 3, backoff: "exponential" })Run it
const run = await triage.start({ ticket })
console.log(run.url) // open the run graph