Almost Timely News: ๐️ How to Connect an AI Agent to a Data Source (2026-07-19)
Almost Timely News: ๐️ How to Connect an AI Agent to a Data Source (2026-07-19) :: View in Browser The Big Plug๐ New book! 21 Use Cases of Generative AI For Marketers ๐ Please take my 6-question Reader Survey to tell me what you want! The drawing winner for the summer survey is Tiina! I’ve emailed you. Content Authenticity Statement99% of this week’s newsletter was made by me, the human. You’ll hear AI music generated by Suno in the AI montage. The video shows ChatGPT Codex working on the app construction. Learn why this kind of disclosure is a good idea and might be required for anyone doing business in any capacity with the EU in the near future. Watch This Newsletter On YouTube ๐บClick here for the video ๐บ version of this newsletter on YouTube » Click here for an MP3 audio ๐ง only version » What’s On My Mind: How to Connect an AI Agent to a Data SourceThis week, a direct request from my reader survey, how to connect a data source to an AI agent. Reader requests are how I know what you want to read, so if you haven’t filled out the survey, although the prize drawing has ended, you can still potentially win something - an answer to your question. So let’s dig in with a bit of table setting first. Part 1: What is an AI Agent?I’ve written about this a bunch of times but it bears repeating: an agent is a piece of software that does something without you and returns its results to you. A real estate agent helps you buy or sell your home but does a lot of work without you, once they know your requirements. A travel agent helps you plan a vacation. An insurance agent sets you up with a policy. A Wifi negotiation agent on your phone connects you to a wifi network. Agents do stuff without you. Here’s how you know if you’re using an agent or not - after an agent has started a task, if you are still providing input, feedback, and steering throughout the process, it’s not an agent. Imagine a personal chef who was asking you at every step of the way how you wanted a step of the recipe cooked. That’s not an agent; an assistant, yes, an agent, no. If you give a personal chef a solid recipe, ingredients, a good kitchen to work in, and your preferences, the next thing that should happen is a plate of your food appearing in front of you. That’s an agent. In the AI Maturity Framework by Trust Insights, I detail 5 levels of AI:
When we talk about connecting agents to data sources, we are talking Level 3 and up. Part 2: What is a Data Source?Okay, this may seem silly, but it matters. When we say connect an agent to a data source, what do we mean by a data source? Remember that fundamentally there are two classes of data source, structured and unstructured. Structured data fits in tables and spreadsheets neatly, and is usable in those tools. Unstructured data doesn’t. For example, let’s say you have some customer satisfaction data. Some of it will be structured, like what rating someone gave you on a scale of 1 to 10. A spreadsheet filled with numbers is very clearly structured data because you can work with it in that environment. Some of it will be unstructured, like the free form responses people give. “I used your Turbo Ultra Vacuum to try vacuuming up the leaves in my 200 acre forested yard and it didn’t work, your product sucks, I want a refund” would be unstructured data. Knowing what kind of data you want to connect to an agent matters a lot because it will dictate how we get the data to the agent, and what the agent will need to do with it. The second thing that’s important to know is the difference between deterministic and probabilistic, fancy terms for “things that have no random chance” and “things that have random chance”. In general (and yes, there is nuance and variation), structured data tends to be deterministic which means you need non-AI tools to work with it. It often requires math, and AI isn’t great at math. In general, unstructured data tends to be probabilistic and ideal for AI to work with. AI can think through what a comment means, what topics or subjects it’s about, and even determine things like sentiment or emotional intensity. Beyond the kind of data you have, the even bigger question is how the data is available. I assume if the goal is to have an agent working with your data, then you’d probably not want to babysit the agent by hand feeding it data. Hand feeding animals is fun. Hand feeding agents is not. That means the data has to be available in some automated fashion, which can mean:
In general, an API is your best bet for data because AI is very good at writing code, and when you use code to extract data, you incur no AI usage. One of our overall goals is to only use AI for things it’s good at, so having regular code (deterministic) to extract data is the way to go. Part 3: Building the RequirementsNow that we’re clear on what an AI agent is and what data sources we’ll be using, we can get to planning out our agent. You should never, ever just wing it when it comes to building an agent or working with agents because every use of the agent costs usage or money. The more you plan, the less likely it is you build something that will be a flaming disaster and send you ridiculous AI bills. To plan this out, we’ll use my favorite fictional company, the Savory Oatmeal Company. Imagine that they care very much about the price of oats and want to know what the prices look like on any given day so that they can plan ahead. For planning purposes, we’ll use Katie Robbert’s 5P Framework by Trust Insights™:
So here we go. This is what the plan would look like: PurposeThe purpose of our agentic app is to obtain and forecast the price of oats based on available market data so we can forecast and understand how our costs, as the Savory Oatmeal Company, will look in the next 90 days. PeopleOur primary audience is the CEO of the Savory Oatmeal Company, James Avena. James is hyperfocused on cost containment because he believes that non-sugary breakfast foods are a critical offering. Not everyone wants sweet-flavored breakfast, and some people who are sugar-intolerant also don’t want to be consuming scads of artificial sweeteners, so his goal is to make savory oatmeal affordable to everyone. Our secondary audience is the CMO of the Savory Oatmeal Company, Marsha May. Marsha runs the marketing and needs to know how much value messaging to put into the marketing for the next quarter. ProcessThe process for forecasting this data is fairly straightforward, and needs only a few old-school AI capabilities, capabilities that pre-date generative AI:
If this sounds vaguely familiar, it should - this is fundamentally ETL (extract, transform, load), a data science methodology. PlatformTo build our agent, we’ll need a bunch of different moving parts, all with a common base platform. Because so many data science tools use Python, Python 3.12 will be our programming language of choice. We’d want to include some coding standards for Python 3.12 to ensure that we create high quality software. For the actual agent, none of what we’re doing requires the latest or greatest AI models - and that’s a key consideration. The lighter an LLM we can use, the less costly and lower impact they are on natural resources. For this particular project, a local LLM would be ideal - no cost, and sustainably powered. We’ll need a free API key from the St. Louis Federal Reserve Bank, or FRED, and the specific data series we want to extract. The Federal Reserve has monthly data for free; if we need more frequent data, we’d need to scrape it, which is outside the scope of this demo. https://fred.stlouisfed.org/series/WPU012203 Because this is monthly data, we’d need to use 36 months of back data for forecast ahead 3 months, because any seasonality in the data is likely to be yearly (as is usually the case for anything agricultural). However, we’ll need to instruct our AI coding agent to be wary of data from 2020-2022 because the pandemic caused such massive distortions in every known market; using data from 2023, 2024, and 2025 is probably more reliable. We’d also need to account for geopolitics as well; the shipping issues in the last 6 months due to the Iran war have caused distortions in shipping prices as well. We’ve already specified we want the output to be HTML with CSS; even regular HTML can have some nice interactive charts and graphs with libraries like d3.js and chart.js, both of which are available from CDNJS (Cloudflare’s cloud-based javascript service, also free). To ensure consistency in the report, we’ll likely want a YAML or Jinja template as part of the build that the tool can reuse over and over again when the LLM is doing the writeup of what happened. Rather than reinvent the wheel repeatedly, if we give it solid templates up front, it’ll have to work less hard. Finally, we need to know what kind of agentic platform we’ll be using. For this project, I chose ChatGPT Codex to assemble it, and then probably an LLM like Google’s Gemma 4 or Qwen 3.6 to do the report writing. PerformanceWhat does success look like? For this project, success looks like two things. First, whatever code we write has to be free of bugs. It has to have 100% test coverage for both unit tests and end to end (E2E) integration tests, meaning that each piece of code works independently AND works together, and there’s no code that doesn’t have a corresponding test. It also has to pass safety tests; there are free testing tools in Python like Bandit that can make those assessments. Finally, it has to run and do what it’s designed to do. Downstream success is a report that lands on James and Marsha’s inbox on the last Friday of each month with the 3-month forecast in it, following the SAINT Reporting Framework by Trust Insights:
For this report, because it’s a rolling 90 day window report, every month, James and Marsha would get a report telling them what oat prices are likely to be in the next 3 months in a clear, prescriptive way. James would need to alert his buying team, and Marsha would need to inform her marketing team. Part 4: Creating the SoftwareWith this detailed plan, we’d then work with our coding agent to ask clarifying questions and once done, build a formal product requirements document, technical specification, a multi-part workplan, and then actually implement it. Here’s a key thing that we’ve talked about in past issues and in my book Almost Timeless - if you use a very smart foundation model to do the planning, you can use a much smaller, faster, and cheaper model for the implementation - perhaps even a model that runs locally, like Gemma 4 31B or Qwen3.6 27B, both very smart local models. Even if you’re using cloud-based models, you can switch to a faster, cheaper model for the implementation. After the software is created, tested, and debugged, you’re ready to launch your agent. By this point, you’ve made sure every piece works, from grabbing the data to doing the forecast to producing the report. You’ve worked out all the issues, perhaps even gotten stakeholder feedback, so all that’s left is putting the proven, working agent into production. Part 5: Wrapping UpI know I make this sound easy, because I’ve done it dozens of times. Your first time through will be a very bumpy road. Think of it like a podcast - your first ten tries will not be great, but after you’ve done a dozen or so agents, you’ll be well-practiced and will know where things are likely to go off the rails. But when we talk about agentic AI, this is an example of what we’re talking about, what a real agent looks like that goes off, does stuff on your behalf, and sends you its work. It’s not ChatGPT. It’s not something that nags you every three minutes for your input. It’s a self-contained application that happens to use AI as part of it, but uses a bunch of other proven technologies along the way. You can see what a big difference there is between this and a chat-based app, night and day. You’re doing very little of the work once you’ve built the agent - it just does its job and sends you its work for review, freeing you up to do something else. If you spend the time to get the agent right, if you spend the time to plan it well, you can deploy dozens or hundreds of agents like this to take on individual tasks and make your life so much easier. How Was This Issue?Rate this week’s newsletter issue with a single click/tap. Your feedback over time helps me figure out what content to create for you. Here’s The UnsubscribeIt took me a while to find a convenient way to link it up, but here’s how to get to the unsubscribe. If you don’t see anything, here’s the text link to copy and paste: https://almosttimely.substack.com/action/disable_email Share With a Friend or ColleaguePlease share this newsletter with two other people. Send this URL to your friends/colleagues: https://www.christopherspenn.com/newsletter For enrolled subscribers on Substack, there are referral rewards if you refer 100, 200, or 300 other readers. Visit the Leaderboard here. ICYMI: In Case You Missed ItHere’s content from the last week in case things fell through the cracks:
On The TubesHere’s what debuted on my YouTube channel this week:
My Merch ShopI’ve been adding so much stuff that I’ve decided to bundle it all in what I call a Merch Shop, because otherwise there’s literally too much to keep track of and I run out of space in my own newsletter. So welcome to the Merch Shop! Books: Skills for Claude and Agentic AI:
Courses: Subscriptions: Recent TalksThese are just a few of the classes I have available over at the Trust Insights website that you can take.
Advertisement: New GEO 201 CourseIn GEO 101, the first course I built on the basics of GEO, I taught you about presence, appearance, and relevance, the three phases of GEO, and what you need to do in each phase to align with how AI search operates. The top piece of feedback we got at Trust Insights about it was, “okay, great, but how do I tell my boss that we’re ‘winning’ at GEO?“ After I quelled my murderous rage at your boss on your behalf, Katie and I sat down and worked out a straightforward, aligned methodology for doing this. GEO 201 is based on the three phases, what you can control and what you can genuinely see - and critically, what you can’t. Because there is absolutely no way to say your brand “ranks higher” in AI search, period, end of story. But you can say and show with confidence what you’ve done and how you show up for presence, appearance, and relevance with tools you’re probably already paying for, and based on how AI search systems really work. ๐ GEO 201 is available now for USD 149. Get Back To Work!Folks who post jobs in the free Analytics for Marketers Slack community may have those jobs shared here, too. If you’re looking for work, check out these recent open positions, and check out the Slack group for the comprehensive list.
Disclosure: I source these links from LinkedIn every week on the following criteria: New in the past seven days, Easy Apply on, remote roles, USA geography. How to Stay in TouchLet’s make sure we’re connected in the places it suits you best. Here’s where you can find different content:
Listen to my theme song as a new single: Social Good: Ukraine ๐บ๐ฆ Humanitarian FundThe war to free Ukraine continues. If you’d like to support humanitarian efforts in Ukraine, the Ukrainian government has set up a special portal, United24, to help make contributing easy. The effort to free Ukraine from Russia’s illegal invasion needs your ongoing support. ๐ Donate today to the Ukraine Humanitarian Relief Fund » Events I’ll Be AtHere are the public events where I’m speaking and attending. Say hi if you’re at an event also:
There are also private events that aren’t open to the public. If you’re an event organizer, let me help your event shine. Visit my speaking page for more details. Can’t be at an event? Stop by my private Slack group instead, Analytics for Marketers. Required DisclosuresEvents with links have purchased sponsorships in this newsletter and as a result, I receive direct financial compensation for promoting them. Advertisements in this newsletter have paid to be promoted, and as a result, I receive direct financial compensation for promoting them. My company, Trust Insights, maintains business partnerships with companies including, but not limited to, Amazon, Talkwalker, MarketingProfs, Agorapulse, The Marketing AI Institute, Spin Sucks, and others. While links shared from partners are not explicit endorsements, nor do they directly financially benefit Trust Insights, a commercial relationship exists for which Trust Insights may receive indirect financial benefit, and thus I may receive indirect financial benefit from them as well. Thank YouThanks for subscribing and reading this far. I appreciate it. As always, thank you for your support, your attention, and your kindness. Please share this newsletter with two other people. See you next week, Christopher S. Penn Invite your friends and earn rewards
If you enjoy Almost Timely Newsletter, share it with your friends and earn rewards when they subscribe.
|


Comments