this.messages converts that history into the
format your LLM stack expects. There are two broad ways to wire a harness in.
Roll your own loop
Yourprocess() method is the agent loop: build the message list, make one call,
handle the reply. The Telnyx API binding is a
pre-authenticated client — declare [telnyx] in telnyx.toml and inference is a
method call, no API key to manage. this.messages.toOpenAI() produces exactly the
payload it takes:
fetch —
swap the URL, model, and a key held in a
secret. The official openai and
@anthropic-ai/sdk clients work too, fed by toOpenAI() and toAnthropic().
→ Full example: Roll Your Own Agent
Bring a framework
Any agent framework that runs on Node — LangGraph, LangChain, and friends — runs insideprocess(), with the SDK as its durable memory. toLangChain() returns plain
{ role, content } messages, which LangGraph accepts as-is: