DEV Community

Cover image for Put query budgets and a source list in front of your data agents
Conor Bronsdon
Conor Bronsdon

Posted on Originally published at chainofthought.show

Put query budgets and a source list in front of your data agents

Give every data agent task a query budget, reject queries that could scan without bound, and tell the agent which sources are connected so it can report that the data isn't available instead of querying until something comes back. Then give it the business definitions it needs, because table metadata alone won't tell it how your company counts churn.

Jitender Aswani is SVP of Engineering and Security at Starburst. In a July 2026 episode he described what agents did to query volume on federated data platforms, and why they need more context than a catalog provides.

Why do agents blow up query volume?

They don't pause between questions the way an analyst does. Aswani:

they operate in this react mode, they reason, they act, they reason, they act, they are generating queries at insane speed. Some people call it at machine speed. I think they're generating it faster than the machine itself.

Jitender Aswani, SVP of Engineering and Security at Starburst, on Chain of Thought ep 66

Data Federation, Not Centraliz… - Chain of Thought | AI Agents, Infrastructure & Engineering - Apple Podcasts

Podcast Episode · Chain of Thought | AI Agents, Infrastructure & Engineering · July 16 · 53m

favicon podcasts.apple.com

He said that when Starburst launched its own MCP server, query volume jumped, and customers had to scale the compute behind it. Some of those queries are unbounded, because the agent isn't judging whether a query is worth running.

Plan for agent traffic as its own workload, and put policy where agent-generated SQL enters your engine rather than in the prompt.

How do you stop an agent from chasing data you never connected?

Tell it what exists, and make a not-connected result a normal answer. Aswani calls some of the models behind agents "overzealous": they want to prove themselves right and won't come back and say they couldn't solve the problem. His example is a FinOps agent Starburst built internally when only its AWS cost data was queryable. Asked to break cloud spend down by provider, it kept firing queries without stepping back to ask whether it even had Azure or Google Cloud data.

Enterprises make this worse by sheer spread. He puts a traditional enterprise at anywhere between 52 and 200 data sources, which is why he argues for querying data where it lives instead of centralizing it first. Wherever the data sits, the agent needs a list of what it can reach.

A minimal sketch to adapt. connected_sources and estimate_scan are hypothetical; estimate_scan returns None when the engine can't bound the scan.

class QueryGate:
    def __init__(self, connected_sources, max_queries=20, max_rows=5_000_000):
        self.sources = set(connected_sources)
        self.max_queries, self.max_rows = max_queries, max_rows
        self.used = 0
        self.attempts = 0   # rejected queries count here, so retries are capped too

    def check(self, source, sql):
        self.attempts += 1
        if self.attempts > 3 * self.max_queries:
            return {"ok": False, "reason": "too_many_attempts"}
        if source not in self.sources:
            return {"ok": False, "reason": f"source_not_connected: {source}",
                    "connected": sorted(self.sources)}
        if self.used >= self.max_queries:
            return {"ok": False, "reason": "query_budget_exhausted"}
        rows = estimate_scan(source, sql)
        if rows is None or rows > self.max_rows:
            return {"ok": False, "reason": "unbounded_or_too_large"}
        self.used += 1
        return {"ok": True}
Enter fullscreen mode Exit fullscreen mode

Return the refusal to the agent as a tool result it can relay to the user, including the list of connected sources. Log every refusal. The log tells you which sources and definitions to add next.

What context does the agent need beyond metadata?

The business meaning of the data. Aswani draws the line plainly:

context is just not metadata, context is more than metadata.

Jitender Aswani, SVP of Engineering and Security at Starburst, on Chain of Thought ep 66

He lists three kinds:

  • Ontology: that "customer" means "account" in your systems.
  • Business rules: one company's fiscal year starts in February, another's in July, another's is the calendar year.
  • Metric definitions: how you calculate churn, ARR and monthly recurring revenue.

Humans fail without these too. His story from another organization: a CFO asked why churn was up, and seven days later three teams gave three different answers, because finance, product and sales each counted churn differently. An agent will pick one of those methods silently unless you give it the canonical one.

Keep these definitions small, versioned and readable by the agent at the start of each task, for example as a tool that returns the definition for a metric name. Reject questions that reference a metric with no definition, rather than letting the agent invent one.

FAQ

Do I need to centralize data before rolling out agents?
Aswani argues no: enterprises have too many sources for centralization to keep up, so query data in place. Either way, the agent needs budgets and a source list.

How many queries should one agent task get?
Start conservatively on shared production clusters, then tune from the log of budget and scan refusals.

Can a better prompt fix inconsistent churn or ARR numbers?
Not reliably. The disagreement predates agents. Give the agent one canonical definition per metric and refuse undefined ones.

Takeaway

  • Cap queries per task and reject unbounded scans in the query path, not the prompt.
  • Give the agent its list of connected sources and a clear not-connected result.
  • Supply ontology, business rules and metric definitions as part of context.
  • Log refusals and use them to decide what to connect or define next.

The full conversation, with the transcript, is on Chain of Thought.

Subscribe to the Chain of Thought newsletter for new episodes and write-ups like this one.

Drafted with AI assistance from the episode transcripts.

Top comments (0)