Agent from the Agent Runtime SDK and drives the Agent Harness SDK. This chapter opens it in the order the CLI builds it. This page is the code deploy generates. Configuration follows each field of agent.json into that code. The Harness is where those fields are plugged in, once per activation. Request Handling follows each inbound request to its handler. Turn Taking is the loop itself, from the admitted message to the delivered reply. Every piece named here can be overridden by the user, and Extending the Managed Agent describes how.
create writes no code; Project Layout shows the files. The class comes into being at deploy, which generates .telnyx/index.ts from agent.json, with instructions.md inlined so that the deployed function reads no files. For support-agent the file is this, with the spec abbreviated:
export class SupportAgent extends defineManagedAgent(spec) {}is the agent.defineManagedAgent(spec)is the managed harness bound to this spec, andSupportAgentis the actor type the platform runs, one instance per conversation.mountAgentsis the function’sfetch. It serves every conversation at/agents/support-agent/<conversation>.channelRoutesis the fallback for everything else the function receives, which is the webhooks. Withwebset, the options also carryweb, and the fallback serves the chat page at/weband the embed script at/web/embed.jsbefore the webhook routes.
mountAgents(map, { fallback }) is mountAgents().
mapis the whole routing table. Its one entry serves the actor namespaceenv.SUPPORT_AGENTunder the mount namesupport-agent.fallbackreceives every request whose path is outside/agents.
deploy writes telnyx.toml, the manifest that names the actor type and its binding, telnyx-env.d.ts with the types, and a package.json. It then links @telnyx/acp and @telnyx/edge-runtime into .telnyx/node_modules, in synth/vendor.ts, so that the bundle built on this machine resolves them. With a phone number, or a Call Control application among the channels, the base is defineManagedVoiceAgent(spec) instead; export writes the same class into src/agent.ts for the user to own, and counts a TeXML application as answering calls too. The module names on the pages that follow, managed/agent.ts and the rest, are files of the @telnyx/acp package.