Skip to content
Qomni

Agents

Create an agent, give it a voice and put it to work: REST for the calls and a WebSocket to talk to it in real time from your app.

Base URL
https://api.qomni.ai/agents/v1
Key
sk_agents_test_…
curl https://api.qomni.ai/agents/v1/calls \
  -H "Authorization: Bearer sk_agents_test_…"

What's new

Use the TypeScript SDK

Call the Agents API from TypeScript or JavaScript with @qomni/sdk: one method per operation, types from the contract and errors with a code.

@qomni/sdk wraps every operation of the reference in a method with the contract’s types: qomni.agents.createCall, qomni.agents.listCalls, qomni.agents.createRealtimeSession and the rest. It is generated from the contract, so a method always asks for what the operation asks for.

Before you begin

  • Bun, or Node.js 22.18 or later (both run TypeScript without compiling).
  • An Agents test key (sk_agents_test_…) in the QOMNI_KEY variable, as in the quickstart.
  • The package is not on npm yet: install it from the sdks/typescript/ folder of the Qomni repository.
  1. Install the package

    pnpm add ../qomni/sdks/typescript
  2. Create the client and make a call

    The key decides the product and the mode: an Agents key works in qomni.agents. Save the code as call.mts.

    call.mtsts
    import { Qomni, QomniError } from "@qomni/sdk";
    
    const qomni = new Qomni({ apiKey: process.env.QOMNI_KEY! });
    
    try {
      const call = await qomni.agents.createCall(
        { to: "+15005550001" },
        { idempotencyKey: "order-1001" },
      );
      console.log(call.id, call.status);
    } catch (error) {
      if (error instanceof QomniError) {
        console.error(error.status, error.code, error.message);
      } else {
        throw error;
      }
    }
  3. Run it

    bun run call.mts
    No Bun?

    Node.js 22.18 or later runs the same file as is:

    node call.mts

You should see

Salidatext
call_01hv4k8s2m9q7w3e5r6t8y0u1i completed

The SDK sent POST https://api.qomni.ai/agents/v1/calls with your key in Authorization, the body as JSON and Idempotency-Key: order-1001. In test mode no phone rang: +15005550001 is a magic number that ends completed. If the key is not valid, the API responds 401 and the SDK throws a QomniError with the error’s code, for example api_key_malformed.

Next steps

  • Each method is named after its operation in the Agents reference: path parameters, then the body, then the query, then the options (idempotencyKey, signal, headers). The TypeScript example of each operation already uses the SDK.
  • Talk to an agent in real time: createRealtimeSession opens the conversation.
  • Errors: the codes a QomniError can carry.
  • Idempotency: when to send idempotencyKey.
Site navigation

New

2 of 7 steps doneNext: the platform in production

Qomni is in private beta

The API and the app are not open yet. See what is done, what is left and how it opens, step by step until the first customer.

Type to search…

↑↓ move↵ openEsc to close