{"slug": "build-an-ai-shipment-agent-with-sms-voice-and-telnyx-inference", "title": "Build an AI Shipment Agent with SMS, Voice, and Telnyx Inference", "summary": "Telnyx has released a new open-source example, 'shipment-agent,' that turns a package shipment into a durable AI agent capable of proactive SMS updates, understanding customer replies via Telnyx AI Inference, and answering inbound calls with shipment context. Built with Python and Flask, the app demonstrates how to unify SMS and voice communications around a single shipment entity, with webhook verification to ensure authentic carrier updates.", "body_md": "Most package tracking flows make the customer do the work.\n\nYou get a tracking number. You open a page. You refresh it. Maybe you get a generic text that says the package is out for delivery. If you need to ask a real question, you usually end up somewhere else entirely.\n\nI wanted to build the opposite shape: what if the package itself had an agent?\n\nThe `shipment-agent`\n\nexample is a Python and Flask app that treats a shipment as a durable AI entity. It can send proactive SMS updates, understand customer replies with Telnyx AI Inference, and answer inbound calls with shipment context.\n\nCode: [https://github.com/team-telnyx/telnyx-code-examples/tree/main/shipment-agent](https://github.com/team-telnyx/telnyx-code-examples/tree/main/shipment-agent)\n\nThe app centers around a `ShipmentAgent`\n\n.\n\nThe agent owns:\n\nInstead of a stateless chatbot waiting in a web page, the agent lives alongside the shipment lifecycle.\n\n``` php\nCarrier update\n  -> Flask webhook\n  -> ShipmentAgent updates state\n  -> SMS customer\n\nCustomer SMS reply\n  -> Telnyx Messaging webhook\n  -> AI Inference response\n  -> SMS reply\n\nCustomer phone call\n  -> Telnyx Call Control\n  -> ShipmentAgent answers with context\n```\n\nShipment status is not just data. It is a customer communication problem.\n\nPeople want to know:\n\nTraditional tracking pages are good at showing status, but not at handling conversation. This example shows how to turn the shipment into a small communications agent that can respond across SMS and voice.\n\nWhen a carrier status changes, the app receives a webhook.\n\nFor example:\n\n```\nout_for_delivery\ndelayed\ndelivered\n```\n\nThe `ShipmentAgent`\n\nupdates its internal state and sends a message to the customer through Telnyx Messaging.\n\nIf the customer replies, the app passes the message and shipment context to Telnyx AI Inference. That lets the response include the current shipment state instead of acting like a generic support bot.\n\nIf the customer calls the Telnyx number, the Call Control flow can answer with the same context.\n\nThat is the key idea: SMS and voice are not separate experiences. They are two ways to talk to the same shipment agent.\n\nThe example uses:\n\nWebhook verification matters here because the agent updates customer-facing shipment state based on incoming events. You want to know those events are authentic before they change what the agent does.\n\nClone the examples repo:\n\n```\ngit clone https://github.com/team-telnyx/telnyx-code-examples.git\ncd telnyx-code-examples/shipment-agent\n```\n\nCreate a virtual environment:\n\n```\npython3 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\nCopy the environment file:\n\n```\ncp .env.example .env\n```\n\nFill in the required Telnyx values:\n\n`TELNYX_API_KEY`\n\n`TELNYX_FROM_NUMBER`\n\n`TELNYX_MESSAGING_PROFILE_ID`\n\n`TELNYX_PUBLIC_KEY`\n\n`TELNYX_TO_NUMBER`\n\nThen run:\n\n```\npython app.py\n```\n\nThe app starts a Flask server locally, and you can connect the webhook URLs to your Telnyx messaging and voice configuration.\n\nThe sample is intentionally small. For a real logistics workflow, I would add:\n\nBut the architecture is the useful part. A shipment can become a durable communications object, not just a tracking number on a page.", "url": "https://wpnews.pro/news/build-an-ai-shipment-agent-with-sms-voice-and-telnyx-inference", "canonical_source": "https://dev.to/sonam_50a41a4ced7e6b4f3fa/build-an-ai-shipment-agent-with-sms-voice-and-telnyx-inference-4o4g", "published_at": "2026-08-27 18:02:12+00:00", "updated_at": "2026-08-27 18:18:52.670390+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "developer-tools", "natural-language-processing"], "entities": ["Telnyx", "Flask", "Python", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/build-an-ai-shipment-agent-with-sms-voice-and-telnyx-inference", "markdown": "https://wpnews.pro/news/build-an-ai-shipment-agent-with-sms-voice-and-telnyx-inference.md", "text": "https://wpnews.pro/news/build-an-ai-shipment-agent-with-sms-voice-and-telnyx-inference.txt", "jsonld": "https://wpnews.pro/news/build-an-ai-shipment-agent-with-sms-voice-and-telnyx-inference.jsonld"}}