Skip to main content

Telnyx AI: Agent SDK (Beta) — Documentation Index

Agent SDK (Beta) documentation within the AI section of the Telnyx developer docs (https://developers.telnyx.com). This file: https://developers.telnyx.com/development/llms/ai-agent-sdk-beta-llms-txt.md · Root index: https://developers.telnyx.com/llms.txt

Get Started

  • Overview: Build AI agents with durable state, message history, and scheduled tasks — all backed by StatefulActors.
  • Quickstart: A working agent in one file: receive a message, process it in the background, and schedule a follow-up.

Concepts

  • How Agents Run: One durable actor per conversation: serialized turns, background thinking, and state that survives restarts.

Build

  • Message History: A persistent, ordered conversation log per actor — with adapters for LangChain, OpenAI, and Anthropic.
  • Scheduled Tasks: Durable named timers — queue, schedule, and every survive restarts and retry on failure.
  • Durable State: Merge-patch state with setState and getState, persisted per actor.
  • SQL Storage: Every agent carries a private, embedded SQLite database at this.ctx.storage.sql — relational, queryable storage next to state and history, for data that outgrows both.
  • WebSockets: Agents terminate live WebSockets today through the actor surface: authenticate at the handshake, handle frames on the agent, broadcast replies from tasks.

Examples

  • Roll Your Own Agent: An SMS support agent with a hand-written loop: toOpenAI() history in, one call on the Telnyx binding, reply out.
  • LangGraph Agent: The same SMS support agent, with LangGraph running the reasoning loop and tool calls — the Agent SDK as its durable memory.

Reference

  • Overview: The Agent runtime surface: the Agent base class, the message log, the task scheduler, and durable state.
  • Agent Class: The Agent base class — type parameters, construction, override hooks, and what’s reserved.
  • Message Log: this.messages — append-only conversation history with seq ordering and adapters for LangChain, OpenAI, and Anthropic.
  • Scheduling: queue, schedule, every — durable named timers over the actor’s alarm slot, with retries, backoff, and at-least-once delivery.
  • State: getState, setState, replaceState — merge-patch durable state on a single key, plus the initialState and onStateChanged hooks.
  • Limits: Budgets, retry behavior, and what’s coming next.