Build an AI Agent with Postman Flows Using Public APIs

Quick Overview

The tutorial successfully demonstrates how to build an AI Agent using Postman Flows that aggregates the top 10 news stories from both the New York Times API (Tech section) and the Hacker News API (item endpoint), combines the results, and outputs a unified list, successfully deployed as an MCP server, although initial runs required debugging due to API key issues and flow configuration errors.

Key Points: The final AI Agent aggregates the top 10 tech stories from the New York Times API and the top 10 stories from the Hacker News API into a single, combined list. The process involved creating a new Postman Flow module, using an HTTP Request block to call the New York Times API (section=technology) and another to call the Hacker News API (topstories endpoint). An Evaluate block was used to slice the Hacker News results to only include the top 10 items (body.slice(0, 10)). A Loop block iterated over the results from both API calls, and a Collect block gathered all iterated items. An AI Agent block (using GPT-4) was prompted to summarize the combined list of news stories, using context from both initial API calls. The final deployed agent was assigned the URL and was configured to work with the New York Times API key variable, successfully testing the combined output. Initial debugging involved fixing an invalid API key error for the New York Times API and correcting the flow connections after adding context variables to the AI Agent.

Context: The video provides a tutorial on creating a basic AI Agent using Postman Flows, leveraging public APIs to fetch and process data. The presenter, Sterling Chin, demonstrates connecting two external APIs—The New York Times API for tech news and the Hacker News API for top stories—into a single flow. The goal is to combine the results, process them with an LLM (GPT-4) via an AI Agent block, and deploy the entire workflow as a callable MCP (Micro-Control Plane) server.

Detailed Analysis

The tutorial guides the user through building an AI Agent in Postman Flows that intelligently aggregates news from two different sources: the New York Times Tech section API and the Hacker News 'topstories' API. The process begins by creating a new Flow module. The first step is adding an HTTP Request block for the New York Times API (using the API key variable), which returns a JSON object containing an array of stories under the 'results' key. This output is connected to a Collect block, configured to take only the top 10 items from the array using slicing logic ( ). Next, a second HTTP Request block is added for the Hacker News API, which returns a simple array of story IDs. This array is passed through a Map block to iterate over each ID, calling the Hacker News 'item' endpoint for each ID. The results from both API calls are fed into a Collect block to merge the lists. Finally, an AI Agent block using GPT-4 is configured with a prompt instructing it to summarize the combined list of top news stories from both sources, utilizing context variables to pass the data from the New York Times and Hacker News API calls. The flow is then deployed to an MCP server using a custom URL definition, demonstrating the agent's ability to handle complex, multi-source data aggregation and summarization.

Raw markdown version of this recap