DEV Community

Cover image for Building an Airport Info AI Agent with Mastra and Telex
Victor Oluwayemi
Victor Oluwayemi

Posted on

Building an Airport Info AI Agent with Mastra and Telex

Building the Airport Info Agent: A Deep Dive into Mastra, A2A, and Telex

Imagine asking, "Tell me about Heathrow Airport," and instantly receiving a concise, traveler-friendly summary — complete with the airport's name, country, coordinates, time zone, and a brief note about its significance.

That's precisely what the Airport Info Agent does. It's an intelligent AI coworker built using the Mastra A2A protocol, deployed easily on Mastra Cloud, and integrated directly into the Telex workspace, functioning as an indispensable aviation assistant.

In this post, I’ll share the step-by-step process of how I built this agent, from the initial local setup with Mastra to its final, collaborative integration within Telex.


Part 1: Architecture and Local Development with Mastra

Mastra is a powerful framework for building and orchestrating AI agents. At its core, it enables developers to rapidly define an agent's logic and capabilities, abstracting away much of the complexity.

Our goal was to create an agent that speaks the Mastra A2A Protocol, the framework's implementation of the open Agent-to-Agent (A2A) standard, allowing it to seamlessly interoperate with other services like Telex.

The implementation can be divided into four distinct processes:

1. Mastra Agent Core

Setting up the core agent logic and boilerplate. My project repository is available here for reference:
👉 GitHub Repository

2. The Airport Tool

This is the critical component that performs the actual data fetching. It handles API calls to the Gemini API for reasoning and uses airportdb.io to retrieve structured data like location, codes, and coordinates.

3. The A2A Route Handler

Configuring the specific route that allows external systems to communicate with our agent using the A2A standard.

4. Registration (index.ts)

Finally, registering the agent, its tools, and the A2A route handler in the main index.ts file within the Mastra folder to ensure all components are wired up correctly.


Part 2: Deployment to Mastra Cloud

Deployment is one of the most streamlined aspects of using Mastra.

Once your project is committed to GitHub, the deployment process is straightforward:

  1. Go to the Mastra Cloud dashboard and create your project.
  2. Set up the deployment configuration, linking it to your GitHub repository.
  3. Upon successful deployment, your agent automatically receives a unique A2A Endpoint URL, making it accessible to any other A2A-compliant system:
Agent A2A Endpoint URL:
https://most-faint-yacht.mastra.cloud/a2a/airportAgent
Enter fullscreen mode Exit fullscreen mode

Part 3: Integrating with Telex.im

The final and most exciting step is integrating the deployed agent into our collaborative workspace, Telex.

On your Telex dashboard, navigate to the AI Co-Workers section and create a new co-worker. We define the agent's behavior and communication method using a structured JSON workflow in the editor.

The key to this integration is defining an A2A node type that points to our Mastra endpoint. This tells Telex exactly how to communicate with the Airport Agent.

Telex Workflow Definition

Notice the long description defines the agent's persona and rules for generating a traveler-friendly response. The nodes section contains the critical link:

{
  "active": false,
  "category": "utilities",
  "description": "A workflow that gives airport information",
  "id": "sGC3u7y4vBaZww0G",
  "name": "progrmr_agent",
  "long_description": "\n You are an aviation assistant that provides accurate and concise information about airports worldwide.\n\n    Your main responsibilities are:\n    - Provide details about airports when given a name, city, or IATA/ICAO code.\n    - Use the airportTool to fetch structured data such as location, country, codes, timezone, and coordinates.\n    - If the user asks for nearby airports, distance between two airports, or other related data, clarify and respond accordingly.\n    - Always give results in a traveler-friendly format:\n        Airport Name (IATA / ICAO)\n        City, Country\n        Timezone\n        Coordinates\n        Short summary about the airport's importance (international hub, regional airport, etc.)\n    - If the query is unclear, politely ask for more details (e.g., \"Can you specify the airport name or city?\").\n    - Keep responses concise but well-structured.\n",
  "short_description": "Get weather information for any location",
  "nodes": [
    {
      "id": "airport_agent",
      "name": "airport agent",
      "parameters": {},
      "position": [816, -112],
      "type": "a2a/mastra-a2a-node",
      "typeVersion": 1,
      "url": "https://most-faint-yacht.mastra.cloud//a2a/agent/airportAgent"
    }
  ],
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  }
}
Enter fullscreen mode Exit fullscreen mode

Part 4: Testing the A2A Connection

To ensure the agent is correctly receiving and processing tasks over the A2A protocol, we can test the connection directly using curl. This command sends a JSON-RPC message, a core component of the A2A standard, to our agent's public endpoint:

curl -X POST https://most-faint-yacht.mastra.cloud//a2a/agent/airportAgent \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "test-001",
    "method": "message/send",
    "params": {
      "message": {
        "kind": "message",
        "role": "user",
        "parts": [
          {
            "kind": "text",
            "text": "Hi, can you tell me about Heathrow Airport?"
          }
        ],
        "messageId": "msg-001",
        "taskId": "task-001"
      },
      "configuration": {
        "blocking": true
      }
    }
  }'
Enter fullscreen mode Exit fullscreen mode

Conclusion

This project demonstrates the power of open protocols like A2A in creating truly interoperable AI ecosystems. By leveraging Mastra for development and deployment, we created a specialized agent that can be immediately utilized within a completely different platform — Telex — to provide structured, domain-specific assistance.

Top comments (0)