Skip to content

Klaris Agent

Ask the Klaris Agent questions, and have it get things done for your people, from your own app.

It works much like OpenAI's Responses API. You send what a person asked, and you get back the agent's answer. The answer includes what the agent looked up on the way and what it cost.

The agent can reach your company's systems once you connect them, such as a Cloud SQL database or a shared Google Drive. It can also reach a person's own accounts once they connect them, such as their Gmail. Anything that changes something, like sending an email, waits for that person to say yes.

Before you start

You need two things, both on Settings → API Keys in Klaris:

  • A key with the responses scope. See API keys.
  • The API address: https://app.klarislabs.com/api/agent/v1.

The examples here read both from your environment:

export KLARIS_API="https://app.klarislabs.com/api/agent/v1"
export KLARIS_KEY="klk_live_..."

On-premises deployments

These pages use https://app.klarislabs.com. If your company runs Klaris on its own servers, ask the Klaris team for your address and use it instead.

Ask your first question

user is your own id for the person you're asking for. Klaris keeps conversations, memory and connections per person, so always send the same id for the same person.

curl "$KLARIS_API/responses" \
  -H "Authorization: Bearer $KLARIS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "user": "nick@example.com",
    "input": "Which tables do we have about policies?"
  }'
import os
import requests

API, KEY = os.environ["KLARIS_API"], os.environ["KLARIS_KEY"]

reply = requests.post(f"{API}/responses", headers={"Authorization": f"Bearer {KEY}"}, json={
    "user": "nick@example.com",
    "input": "Which tables do we have about policies?",
}, timeout=300).json()
print(reply["output_text"])
const API = process.env.KLARIS_API!, KEY = process.env.KLARIS_KEY!;

const res = await fetch(`${API}/responses`, {
  method: "POST",
  headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    user: "nick@example.com",
    input: "Which tables do we have about policies?",
  }),
});
const reply = await res.json();
console.log(reply.output_text);

You get back a response. Its output_text is the answer, and conversation.id lets you continue the conversation:

{
  "id": "resp_6f1c…",
  "object": "response",
  "status": "completed",
  "conversation": {
    "id": "conv_93ab…"
  },
  "output_text": "There are three: policies, policy_changes and renewals…",
  "usage": {
    "input_tokens": 4120,
    "input_tokens_details": {
      "cached_tokens": 3800,
      "cache_write_tokens": 0
    },
    "output_tokens": 186,
    "total_tokens": 4306,
    "cost_usd": "0.012870"
  }
}

Where to go next

To… Read
Show the answer word by word as it's written Streaming
Let people say yes or no before the agent sends or changes anything Approvals
Continue, list or delete conversations Conversations
See and edit what the agent remembers about a person Memory
Connect a database, a shared drive, or a person's Gmail Connections
See what it costs, per use case or per person Usage and cost
Look up every route and field Reference