Appearance
Quickstart
In ten minutes you will create an agent in the console, publish it, create an API key and call the agent from your backend.
You need an account in the Hevkar console and the base URL of the API (for example https://api.example.com; locally http://localhost:4000).
1. Create a project
In the console, open your organization and create a project, for example staging. Projects keep agents, keys, data and usage apart; you can add a production project later.
2. Create an agent
Open Agents → New agent in the project:
- Name:
Ticket triage - Slug:
ticket-triage(this is how the API addresses the agent) - Type:
extraction
Configure it:
Model: pick one of the enabled chat models.
Instructions:
textYou triage customer support tickets. Classify the ticket and extract the key facts.Output schema (JSON Schema), so the output is JSON you can rely on:
json{ "type": "object", "properties": { "category": { "type": "string", "enum": ["billing", "bug", "account", "other"] }, "urgency": { "type": "string", "enum": ["low", "normal", "high"] }, "summary": { "type": "string" } }, "required": ["category", "urgency", "summary"], "additionalProperties": false }
Try it in the Playground tab with an input such as { "text": "I was charged twice" }. Playground runs use the draft and are metered like API runs.
3. Publish
Click Publish (optionally with a note). The draft becomes version 1, the agent's current version. The API only runs published versions; edit and publish again whenever you change it.
4. Create an API key
Open API keys → New key (needs the admin role). Give it a name, select the scopes agents:run and runs:read, and copy the key. It starts with hk_live_ and is shown only once.
Store it in your backend's environment:
bash
export HEVKAR_API_KEY=hk_live_...
export HEVKAR_BASE_URL=https://api.example.com5. Run the agent
bash
curl "$HEVKAR_BASE_URL/v1/agents/ticket-triage/runs" \
-H "Authorization: Bearer $HEVKAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": { "text": "I was charged twice for my October invoice, please fix it today!" },
"externalUserId": "user_42"
}'ts
import { Hevkar } from '@hevkar/sdk';
// Reads HEVKAR_API_KEY and HEVKAR_BASE_URL from the environment.
const hevkar = new Hevkar();
const result = await hevkar.agents.run('ticket-triage', {
input: { text: 'I was charged twice for my October invoice, please fix it today!' },
externalUserId: 'user_42',
});
if (result.status === 'succeeded') console.log(result.output);
else console.error(result.error);ts
const res = await fetch(`${process.env.HEVKAR_BASE_URL}/v1/agents/ticket-triage/runs`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.HEVKAR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
input: { text: 'I was charged twice for my October invoice, please fix it today!' },
externalUserId: 'user_42',
}),
});
if (!res.ok) throw new Error(`${res.status}: ${JSON.stringify(await res.json())}`);
const result = await res.json();
console.log(result.output);The response is a RunResult:
json
{
"runId": "4f0f7c1e-2b5a-4d0e-9a51-7a3c1f2d9e10",
"status": "succeeded",
"output": {
"category": "billing",
"urgency": "high",
"summary": "Customer was charged twice for the October invoice."
},
"usage": { "inputTokens": 212, "outputTokens": 31, "priceMicros": 96 },
"latencyMs": 1430
}outputis parsed JSON because the agent has an output schema; without one it is{ "text": "..." }.usage.priceMicrosis the price in USD micros (96 micros = 0.000096 USD).- A run that fails while executing (for example the provider is down) still answers HTTP 200 with
status: "failed"and anerror. Problems found before the run starts (bad input, unknown agent, missing scope, spend cap) are HTTP errors; see Errors.
Install the SDK with npm install @hevkar/sdk (Node.js 20+, Bun, Deno, edge runtimes).
6. Look at the run
Every run appears in the console under Runs with its input, output, tokens, price and latency. With a runs:read key you can also fetch it:
bash
curl "$HEVKAR_BASE_URL/v1/runs/4f0f7c1e-2b5a-4d0e-9a51-7a3c1f2d9e10" \
-H "Authorization: Bearer $HEVKAR_API_KEY"ts
const run = await hevkar.runs.get(result.runId);
console.log(run.status, run.output, run.usage);Next steps
- Stream output token by token: Streaming
- Send PDFs and images: Files
- Give the agent knowledge: Knowledge
- Build a chatbot: Conversational agents
- Run long jobs in the background: Async runs and webhooks