process() method — with tool calling, multi-step reasoning, the works — while
the Agent SDK supplies what the framework doesn’t have: durable per-customer history,
retries, and the follow-up timer.
this.messages.toLangChain() returns plain { role, content } messages, which LangGraph
accepts as-is. The LLM is ChatOpenAI pointed at Telnyx Inference — swap baseURL,
key, and model to bring any OpenAI-compatible provider. The same pattern fits any agent
framework that runs on Node.
Install the framework alongside the runtime:
src/conversation.ts — the actor:
this.messages — intermediate tool calls and
tool results stay inside the LangGraph run. If you want them in the durable history too,
append() them from out.messages.
src/index.ts — the function that routes inbound webhooks to the right actor:
Verify Telnyx webhook signatures before processing — see
receiving webhooks.
The examples above omit verification for brevity; production code must check the
telnyx-signature-ed25519 header.telnyx.toml:
process.env.TELNYX_API_KEY:
Task delivery is at-least-once: a crash
after
messages.add() or messages.send() succeeds retries the whole process()
method. For production, guard outbound side effects — e.g. check state before sending,
or use a stable message ID to deduplicate.