> ## Documentation Index
> Fetch the complete documentation index at: https://docs.threetone.in/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK

> Type-safe REST integration patterns for the live ThreeTone API

Use TypeScript today with a thin typed wrapper around the REST API. This gives
you strong IDE support immediately while preserving compatibility with the
future public SDK.

## Typed create-agent example

```typescript theme={null}
type CreateAgentResponse = {
  agent_id: string;
};

const response = await fetch("https://api.threetone.in/v1/convai/agents/create", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY",
  },
  body: JSON.stringify({
    name: "Customer Support Agent",
    system_prompt: "You are a helpful customer support representative.",
  }),
});

if (!response.ok) {
  throw new Error(`Create agent failed: ${response.status}`);
}

const agent = (await response.json()) as CreateAgentResponse;
console.log(agent.agent_id);
```

Canonical source file: `/examples/typescript/create-agent.ts`

## Recommended patterns

* Define response types at the boundary of your ThreeTone client
* Keep request builders small and composable
* Use a central auth helper for the `x-api-key` header
