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

# Agent SDK

> Build AI agents with durable state, message history, and scheduled tasks — all backed by StatefulActors.

The **Agent SDK** is a TypeScript base class, `Agent`, that extends
[`StatefulActor`](/docs/edge-compute/stateful-actors) with the primitives AI agents need
most: a persistent conversation history, durable scheduled tasks, and merge-patch
state — with no extra infrastructure to manage.

`Agent` ships as an export of `@telnyx/edge-runtime`, alongside `StatefulActor`. There
is no separate package to install.

```ts theme={null}
import { Agent } from "@telnyx/edge-runtime";
```

<Note>
  The `Agent` base class is in **Beta**. The API surface may change.
</Note>

## What Agent adds to StatefulActor

| Primitive                                              | API                                               | What it does                                |
| ------------------------------------------------------ | ------------------------------------------------- | ------------------------------------------- |
| [**Message History**](/docs/agent-sdk/message-history) | `this.messages`                                   | Ordered, durable conversation log per actor |
| [**Scheduled Tasks**](/docs/agent-sdk/scheduled-tasks) | `this.schedule()`, `this.queue()`, `this.every()` | Named timers that survive restarts          |
| [**Durable State**](/docs/agent-sdk/state)             | `this.setState()`, `this.getState()`              | Merge-patch state on a single KV key        |

State is durable and survives restarts — the same persistence guarantee that
StatefulActors provide. Everything `StatefulActor` provides is inherited too,
including the embedded [SQL database](/docs/agent-sdk/sql) and
[WebSocket termination](/docs/agent-sdk/websockets).

## Bring your own harness

The loop that makes an agent more than a single model call — build the prompt from
history, call the model, run the tools it asks for, decide whether to continue or
stop — is called a **harness**. The Agent SDK deliberately doesn't ship one. It is the
substrate a harness runs on: history, state, and timers stay durable underneath
whatever loop you run, and `this.messages` converts history to the format your stack
expects.

Two ways to wire one in:

* **Roll your own.** `process()` **is** the harness: it calls inference through the
  pre-authenticated [Telnyx API binding](/docs/edge-compute/telnyx-api) — no API key to
  manage — and `toOpenAI()` produces exactly the payload it takes.
  → [Roll Your Own Agent](/docs/agent-sdk/examples/roll-your-own)
* **Bring a framework as the harness.** LangGraph, LangChain — anything that runs on
  Node — executes inside the actor, with the SDK as its durable memory and scheduler.
  → [LangGraph Agent](/docs/agent-sdk/examples/langgraph)

Either way you bring your own LLM: [Telnyx Inference](/docs/inference/getting-started)
is wired in through the binding, and any OpenAI-compatible provider is one `baseURL`
away. See [Calling LLMs](/docs/agent-sdk/concepts/calling-llms). And because the
substrate is harness-neutral, an opinionated first-party harness can slot in later
without changing anything you build now.

## Where to go next

* [Quickstart](/docs/agent-sdk/quickstart) — a working agent in one file
* [How Agents Run](/docs/agent-sdk/concepts/how-agents-run) — the actor execution model in four properties
* [Calling LLMs](/docs/agent-sdk/concepts/calling-llms) — both wiring patterns, side by side
* [API reference](/docs/agent-sdk/api-reference) — every method and override hook
