Stop Writing README.md. Start Writing AGENTS.md

When an AI agent starts producing inconsistent results, most teams run through the a checklist that is more or less as below:
- Tweak the prompt
- Swap the model
- Add more examples
Then they try again, in hope… but, end up getting a different wrong answer.
Here’s the uncomfortable truth: the model is not the problem. You’re debugging symptoms while the root cause sits quietly in a different area of your architecture.
There is no contract for your Agents to go by.
So, What is a Contract for Agents?
Mature data platforms don’t run on hope. They run on contracts. They appear in different forms:
- dbt models enforce transformation logic
- Airflow DAGs enforce orchestration
- APIs enforce interface boundaries
- Schema registries enforce data structure
These exist because we learned, rather painfully, that distributed systems fail in creative ways without them. So we laid them down as the rules to go by.
Then, with the advent of AI and all that came along with it, including AI agents that we gracefully added to our data platforms… but, in doing so, we threw the rulebook out.
We gave agents access to Snowflake, S3, dbt, and Airflow, expected deterministic behaviour, and got chaos. Then, we blamed it upon models.
This is where we should stop and contemplate our choices. It’s not the choice of the model we’ve used that resulted in failures, but an architectural one.
Basically, the contract is missing for Agents. AGENTS.md is the contract layer need there.
What AGENTS.md Actually Is
Think of it less as documentation and more as a runtime contract for Agentic AI execution.
It defines three things explicitly:
- What the agent is allowed to do
- Where it is allowed to operate
- How it should make decisions when multiple options exist
Without this clarity, the agent treats your entire data platform as an unstructured search space and then optimises for convenience rather than correctness.
Why This Gets Dangerous in Real Stacks
Consider a typical modern data platform:
- Snowflake or Databricks as the warehouse
- dbt for transformations
- Airflow or Dagster for orchestration
- S3 or Blob Storage for the data lake
In this stack, a simple metric like monthly active users (MAU) might exist in four or five places simultaneously:
- Raw event tables
- Staging models
- Multiple data marts
- Experimental feature pipelines
A senior data engineer knows which one is trustworthy. An agent never does. So it picks the path of least resistance, usually the freshest-looking raw table that bypasses every contract you’ve carefully built.
Here’s what that looks like in practice in the form of some failure modes:
1. Increasing Schema drift
Agents might query raw ingestion tables because they appear recent with data being freshly ingested. These tables often contain low quality, duplicated data. Agents accessing them will end up producing inconsistent joins, missing filters, and broken aggregations, silently bypassing your dbt’s “transformation” contracts entirely.
2. Orchestration misuse
An agent might trigger a full backfill DAG in Airflow instead of an incremental one to only bring over new or updated records. Or it may kick off an experimental pipeline in production out of cycle that would could spike compute costs. Downstream tables corrupt could get corrupted. SLAs may fail to be met. By the time someone notices the mishap, it’s probably too late.
3. Metrics inconsistency
Two runs of the same query, same prompt, same model resulting in non-deterministic answers. Because the agent selected different source models each time. Idempotency goes for a toss, Reproducibility disappears. Trust in data takes a nosedive.
4. Governance nightmares
The agent accesses PII tables, restricted schemas, or non-approved datasets with no perceived restrictions. Not maliciously. Just because nothing in the system told it not to.
This last one is the one that could end careers.
How AGENTS.md is our Fix
AGENTS.md reduces the surface are of risk by shrinking the search space, and setting boundaries from access everything to access only the right things.
If you’ve worked in data, you already know some of these patterns that are established when you architect the data platform:
- Medallion architecture defines layer boundaries through Bronze, Silver and Gold
- Data mesh defines domain boundaries
- Data contracts define semantic boundaries
AGENTS.md does the same except it makes those boundaries explicitly consumable by an AI agent at runtime.
How should we structure AGENTS.md?
Here is a structure that has worked for me fairly well.
## Execution Scope
<!-- Think of this as IAM policy for your reasoning layer. -->
Allowed:
- Read from ANALYTICS schema only
- Execute dbt models in /models/marts
- Trigger Airflow DAGs tagged "production_ready"
Not Allowed:
- Access raw ingestion schemas
- Write to warehouse tables
- Execute backfill or experimental DAGs
## Data Source Hierarchy
<!-- You're encoding your medallion architecture directly into agent behaviour. -->
Priority order:
1. Curated marts (dbt gold layer)
2. Aggregated intermediate models
3. Staging models (only if explicitly required)
Never use:
- Raw ingestion tables
- Deprecated models
## Contract Enforcement
<!-- This is your semantic layer made clear to an agent. -->
- All metrics must come from versioned dbt models
- Use suffix _v2 or latest only
- customer_lifetime_value_v2 is the authoritative source
## Orchestration Rules
<!-- Every line here can save you thousands in unnecessary compute usage. -->
- Only trigger DAGs tagged: production_ready
- Never run full refresh unless explicitly instructed
- Prefer incremental pipelines
## Decision Logic
<!-- This is where you control non-determinism directly. -->
- Prefer stable datasets over recent ones
- When multiple valid options exist, choose highest version
- If confidence < 80%, do not execute, escalate instead
## Output Requirements
<!-- Traceability and downstream validation built in here. -->
- Include source table references
- Include execution timestamp
- Return structured JSONThe Design Principle
In distributed systems, we don’t assume a node will “do the right thing.” We design systems where the only available path is the correct path.
Apply the same logic here for Agents:
- Minimise degrees of freedom
- Encode the decision, don’t delegate it
- Push determinism upstream
Don’t rely on the model to choose correctly when facing ambiguity. Strive hard to remove the ambiguity.
In Conclusion…
If your AI system is inconsistent, it is not a model problem. It is usually a system design problem.
You have exposed a complex, multi-layered data platform without abstraction and expected an LLM to navigate it correctly every time.
We already solved these problems in data engineering through Contracts, Governance, Lineage, Determinism. AI agents don’t require new thinking, they only necessitate us to apply the old thinking at a new interface.
Dont treat agents as Engineers. Treat them as distributed systems components, thats when things start to work.