> ## 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.

# Quickstart

> A working agent in one file: receive a message, process it in the background, and schedule a follow-up.

The simplest agent receives a message, queues a background task to process it, then
schedules a follow-up.

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

export class SupportAgent extends Agent<Env, { from: string; lastReply: string; at: number }> {
  // Called when a new message arrives (from your function's fetch handler)
  async receive(text: string, from: string): Promise<void> {
    await this.setState({ from });
    await this.messages.add("user", text);  // persisted to history
    await this.queue("process");             // durable background task
  }

  // Runs asynchronously — webhook acks immediately, LLM runs in the background
  async process(): Promise<void> {
    const history = await this.messages.toLangChain();  // or toOpenAI(), toAnthropic()
    // ... call your LLM here ...
    const reply = "Hello! How can I help?";
    await this.messages.add("assistant", reply);
    await this.setState({ lastReply: reply, at: Date.now() });
    await this.schedule(86_400, "nudge", null, { id: "nudge" }); // follow up in 24h
  }

  async nudge(): Promise<void> {
    const last = await this.messages.last();
    if (last?.role !== "assistant") return; // customer replied — skip
    // customer hasn't replied — send a follow-up
  }
}

// The function that routes inbound webhooks to the right actor
export default {
  async fetch(req: Request, env: Env): Promise<Response> {
    const { text, from } = await req.json() as { text: string; from: string };
    await env.SUPPORT.idFromName(from).receive(text, from);
    return new Response("ok");
  },
};
```

`Env` is a global type generated by `telnyx-edge types` from your `telnyx.toml` — it
includes `SUPPORT: ActorNamespace<SupportAgent>` and any other bindings you declare.
Run `telnyx-edge types` before `tsc` or `ship` to keep it in sync.

**`telnyx.toml`:**

```toml theme={null}
name = "support-agent"
main = "src/index.ts"
compatibility_date = "2026-05-01"

[[actors]]
binding = "SUPPORT"
type    = "SupportAgent"
```

## Deploy

Generate binding types, then ship:

```bash theme={null}
telnyx-edge types   # generates telnyx-env.d.ts from your telnyx.toml
telnyx-edge ship     # bundles, uploads, and deploys to the edge
```

Your function is live at `https://<name>-<id>.telnyxcompute.com` — see
[edge compute configuration](/docs/edge-compute/configuration) for the full reference.

## Next steps

* [Calling LLMs](/docs/agent-sdk/concepts/calling-llms) — wire in a real model, with or without a framework
* [Message History](/docs/agent-sdk/message-history) — the `this.messages` API and framework adapters
* [Scheduled Tasks](/docs/agent-sdk/scheduled-tasks) — `queue`, `schedule`, `every`, and retries
* [Durable State](/docs/agent-sdk/state) — `setState`, `getState`, and typed state
* [Roll Your Own Agent](/docs/agent-sdk/examples/roll-your-own) / [LangGraph Agent](/docs/agent-sdk/examples/langgraph) — two complete examples
