How to use it

This glossary explains the terms of the workshop Same agent, different architecture, or Building Data Ready for Agentic AI, in the order they appear in blocks 0 to 5. It is for people attending and for anyone studying afterwards. The repository and the workshop materials are in Portuguese, so each English term below is the translation of the one used there.

The case is Aurora Cosméticos, a fictional company. An AI agent decides the daily budget of 6 paid media campaigns (Google, Meta, TikTok and YouTube). In the morning it makes disastrous decisions on corrupted data; over the day, each block adds a layer of architecture until it runs reliably.

The core idea: the agent’s decision logic doesn’t change. The data architecture around it does.

Each section has a table with the term, what it means and where it shows up in the project. Code names are in English (contracts.py), as in the repository.

The architecture on one page

Data moves up from the sources to Gold, and each layer only lets through what has proven reliable. The agent reads only official metrics and acts only through capabilities that check the real state and the guardrails.

The workshop architecture, from raw data to action: sources, Bronze, contract, Silver and Gold on the top row; semantic layer, MCP capabilities, autonomy, human approval and live platform on the bottom row; the agent, which acts only through the capabilities; observability and traceability at the base

Follow the arrows. The top row takes data from the sources to Gold; the bottom row goes from the semantic layer to the live platform, through the capabilities, the autonomy ladder and human approval. The dashed line is Block 0: with no layers at all, the agent reads the raw data and gets it wrong. At the bottom is what runs alongside the flow: observability and the trail of every decision. The number in the corner of each box is the workshop block; in green, the tool that replaces that module in the stack track.

Data layers

Data goes through three layers, each more reliable than the last, and the agent only reads the final one. This design is called the medallion architecture; the other areas below hold what isn’t analytical data.

LayerWhat it holdsWho reads itIn the project
BronzeData exactly as it arrived from the source, errors, duplicates and wrong types included. Each row carries its batch (batch_id) and load time (ingested_at).Nobody decides anything from it; only the contract reads it.bronze.campaigns, bronze.ad_spend, bronze.conversions
SilverOnly the rows that passed the contract, with the right type (numbers are numbers, dates are dates).The Gold build.silver.*, produced by contracts.apply()
GoldBusiness-ready data: one row per campaign per day, plus the health of each source (fresh or late?).The semantic layer, and through it the agent.gold.campaign_daily, gold.source_health
QuarantineRows that broke the contract, with the reason for each violation. It is the dead-letter queue.People investigating the problem at the source.quarantine.*, agentready quarantine
MetadataThe record of each batch: how many rows, how many rejected, whether it passed or was blocked, and under which contract version.agentready health and observability.meta.batch_status
Operational stateWhat happens in the real world: each campaign’s current budget, change history, approval queue, incidents. It isn’t analytical data.The agent’s capabilities, which check the state before acting.ops.campaigns and the other ops.* tables

Medallion architecture: the name of the Bronze → Silver → Gold pattern. The rule that matters in the workshop is just one: data moves up a layer only after it proves it is reliable.

Grain: what one row represents. In Gold, the grain is “one campaign on one day”. Summing or dividing at the wrong grain produces false numbers (see fan-out, in the semantic layer).

DuckDB: the analytical database that keeps every layer in a single file, with no server. That’s why the default track runs without Docker.

Contracts and quality (Block 1)

The contract is the law: it says what a piece of data must have to get in, and whatever fails goes to quarantine instead of reaching the agent.

TermWhat it meansIn the project
Data contractA versioned agreement between whoever produces and whoever consumes a dataset: columns, types, allowed values, unique key, owner and deadlines. Each rule becomes an automated check.contracts/*.odcs.yaml, applied by contracts.py
ODCSOpen Data Contract Standard, the open YAML format used to write the contracts (version 3.1).apiVersion: v3.1.0 in each contract
BatchOne delivery of data from the source, identified by batch_id. The contract evaluates each batch separately.meta.batch_status
Circuit breakerIf a batch’s rejected-row rate goes over the contract’s limit, the whole batch is blocked, good rows included. A very dirty batch signals a problem at the source.maxQuarantineRate in the contract (5% for conversions)
Freshness SLAThe maximum acceptable time since the last load. It applies per feed: GA4 can be up to date while Meta is stalled.latency: 24 h for conversions, per feed (source)
Late data isn’t zeroWhen a source is outside its SLA, Gold returns NULL (unknown) for revenue and orders, not 0. Zero would make the agent pause a campaign that sells well.gold.source_health and the freshness guard
IdempotencyLoading the same batch twice can’t double the numbers. The contract marks the second copy as a duplicate.unique key rule (unique)
Schema breakThe source changed or dropped a column. Nothing can be interpreted: the batch is blocked and Silver keeps the last good state.missing_columns() in contracts.py
BackfillThe late arrival of the missing batches. In the workshop, Meta’s data arrives and the feed becomes fresh again.agentready backfill-meta

The contract’s limit has a blind spot: a plausible but wrong value gets through. That is the cents incident in Block 5, caught by observability, not by the contract.

Semantic layer (Block 2)

The agent never writes SQL: it asks for metrics by name, and a compiler always generates the same SQL, with the official formula, at the right grain and with the freshness guard.

TermWhat it meansIn the project
Semantic layerBusiness definitions written as code: what each metric is, which dimensions it can be cut by and which domain rules apply. Different questions produce the same SQL.semantic/marketing.semantic.yaml, compiled by semantic.py
MeasureA summed column from Gold: spend, impressions, clicks, orders, gross revenue, discounts.measures in the YAML
MetricThe number the business uses, built from measures. It can be simple, a ratio or derived from other metrics.metrics in the YAML
DimensionHow to slice the metric: by campaign, by channel or by objective.dimensions in the YAML
Net revenueGross revenue minus discounts. In this business, “revenue” always means net revenue.net_revenue
ROASReturn on ad spend: net revenue ÷ spend. Below 1.0 the campaign loses money.roas; floor in guardrails.yaml
CACCustomer acquisition cost: spend ÷ orders (R$ per order).cac
CTRClick-through rate: clicks ÷ impressions.ctr
Ratio of sumsA ratio is computed by summing the numerator and the denominator and dividing at the end. The average of daily ratios gives the same weight to a R$ 10 day and a R$ 10,000 day, and gets it wrong._metric_sql() in semantic.py
Fan-outJoining tables at different grains (for example, orders with daily spend) multiplies rows, and the sum comes out inflated.the mistake the “guessed” SQL makes in Block 2
Freshness guardIf any conversion source in the group is outside its SLA, the metrics that depend on it come out as NULL, with data_status = stale.compile_sql()
Domain ruleA business rule written alongside the metrics. Example: awareness (reach) campaigns are never judged by ROAS.domain_model.rules
SynonymWords the business uses for the same metric (“faturamento”, “receita”). They translate a natural-language question into official names.agentready ask "..."

Agent and governed action (Blocks 0 and 3)

The agent acts only through business capabilities, and the backend is what authorizes: retrieved text informs, it never authorizes.

TermWhat it meansIn the project
AgentA program that reads the state, decides and acts on its own. Here, it adjusts or pauses campaigns to keep ROAS above the floor.agent.py
Naive agentThe “before” of Block 0: it reads Bronze directly and pauses the 2 best campaigns, putting about R$ 40k/day at risk.agentready agent naive
Ready agentThe same reasoning, now reading official metrics and acting only through the capabilities.agentready agent ready
BrainWhat picks the actions: fixed rules (rules, the demo default, deterministic) or Claude (optional). The capabilities and guardrails are the same for both.--brain rules / --brain claude
MCPModel Context Protocol, the open standard that exposes data and actions to AI agents. It separates resources (text to read) from tools (actions to call).mcp_server.py, server aurora-midia
CapabilityA business action with a name, rules and a trail, instead of free access to the database. There are 5: data health, campaign performance, read briefing, adjust budget and pause campaign.capabilities.py
PreconditionWhat the capability checks in the live state before acting: the campaign exists and is active, the data is fresh, the daily limit hasn’t been hit.ops.campaigns
GuardrailA limit the agent can’t cross, set by the business: up to ±20% change per action, 2 changes per campaign per day, a R$ 26,000/day cap for the portfolio, a minimum of R$ 300/day per campaign.config/guardrails.yaml
Prompt injectionInstructions hidden in a text the agent reads. In Block 3, a briefing tells it to raise YouTube to R$ 35k/day; the guardrails deny it.--gullible, briefing://campanhas/{id}
Text informs, never authorizesNo retrieved text (briefing, email, note) grants permission. Permission comes only from the guardrails and the autonomy ladder.Block 3 rule
ReversibilityHow much it costs to undo an action, and therefore how much autonomy it gets. R0: read only. R1: reversible (rollback restores the value). R2: reversible at a cost (pausing loses the platform’s learning). R3: irreversible, never exposed to the agent.reversibility in config/autonomy.yaml

Autonomy and human oversight (Block 4)

How much the agent can do on its own depends on how much it costs to undo the action. Every write is logged and can be undone.

TermWhat it meansIn the project
Autonomy ladderThe four rungs of agent freedom, from most restricted to most free: shadow, supervised, guarded and full. Each action has its own rung.config/autonomy.yaml, autonomy.py
shadowThe agent only records what it would do; nothing is executed. Good for testing a new agent against real data.agentready autonomy shadow
supervisedEvery action goes to the human approval queue. Pausing a campaign (R2) always stays here.pause_campaign: supervised
guardedExecutes on its own within the guardrails and escalates risky cases. Budget adjustment sits here, but changes above 10% need approval.adjust_campaign_budget: guarded
fullExecutes everything that passes the preconditions.agentready autonomy full
Global overrideA temporary change of rung for every action, for example for a demo. clear goes back to the configured one.agentready autonomy [level|clear]
Approval queueAction requests waiting for a person to approve or reject them, with the agent’s justification.agentready approvals, approve <REQ>, reject <REQ>
Change logThe history of every executed change: the value before, the value after, who asked and why.ops.* tables
RollbackUndoing a change from the change log, restoring the previous value. It’s what makes an action R1.agentready rollback <CHG>
Human-in-the-loopA person decides at the risk points, and the agent can’t answer for them. In the stack track, only the aprovadora user can approve.Required Actions in Airflow

Traceability and observability (Blocks 4 and 5)

Traceability answers “why did the agent do that?”; observability answers “is the data still good?”. The two meet in lineage, which links bad data to the decision it caused.

TermWhat it meansIn the project
TraceThe complete record of a decision, from the data read to the action taken, as a tree. Each decision has a trace_id.agentready trace last, HTML in traces/
SpanOne step inside the trace (read metrics, check a guardrail, call a capability), with a start, an end and attributes.tracing.span()
OpenTelemetryThe open standard for producing traces. Following the standard lets you swap the viewer without touching the agent.tracing.py
Hash chainEach line of the audit log stores the hash of the previous one. Changing an old line breaks the chain, and the tampering shows.audit.jsonl, agentready verify
Data observabilityContinuous checks that detect when data changes behavior, even while passing the contract.observability.py, agentready observe
5 pillarsFreshness (did it arrive on time?), volume (did the expected amount arrive?), distribution (are the values their usual size?), schema (are the columns the same?) and lineage (who depends on this data?).freshness(), volume(), distribution(), schema(), downstream()
LineageThe map of where each piece of data came from and where it goes, all the way to the agent’s decisions. It shows the downstream impact of a problem.agentready lineage [node] --since ts
IncidentA simulated failure at the source: values in cents, a renamed column, a duplicated batch or a stalled feed.agentready incident inject [type]
Cents incidentThe source starts sending values 100× larger. The contract approves them, because the value is plausible; the distribution pillar catches it.the central case of Block 5
TTD / TTRTime to detect and time to resolve an incident, the two measures of response quality.incident detect / resolve
Post-mortemThe report after the incident: what happened, the impact, the cause and what changes so it doesn’t happen again. Here, it should propose turning on blocking on distribution anomalies.templates/

Stack track (optional)

The stack track runs the same scenario with production tools, for those who want to keep studying. It needs Docker, 4 CPUs and 8 GB of RAM; the workshop demo doesn’t need it.

Substitution principle: a tool only gets in if it replaces a module of the default track. That’s why Grafana and the metadata catalog (Phase 5) were left out.

Parity: the proof that the agent decides the same way in both tracks, scenario by scenario (make parity).

ToolWhat it isReplacesBlock
Apache AirflowOrchestrator: runs the steps in order, with a schedule and history.pipeline.run() and the CLI commands1, 5
Airflow Human-in-the-loopThe approval screen inside Airflow (Required Actions).approvals / approve / reject4
dbtA tool that transforms data with versioned, tested SQL.building Silver, quarantine and Gold1, 2
CosmosShows each dbt model and test as a task in Airflow.the Python glue between steps1
Data Contract CLIReads the ODCS contracts and generates the dbt tests.reading the contract’s types1
FastAPI + dltSources simulated over HTTP, with failures and retries; dlt loads each source.the static load in generate.py1
Open Policy Agent (OPA)Policy engine: decides whether the action can be taken, outside the agent. No OPA, no writes.applying guardrails.yaml3
OpenTelemetry Collector + Arize PhoenixReceives traces from the pipeline and the agent and shows everything in the browser. The hash chain remains the official record.exporting and viewing tracing.py4
ElementaryObservability inside dbt, with the history of each test. It catches cents.observability.py5
OpenLineage + MarquezLineage emitted by the pipeline itself, all the way to the agent’s decision, in a navigable graph.the lineage command4, 5
DuckLakeA table format with snapshots: each run leaves a named marker, and you can read or restore any of them (time travel).the warehouse’s single file (data layers)5

The code is at cacaprog/marketing-de-workshop. For why this layer exists, read the Croesus article; for the results, the project page; for the engineering of each layer, inside the context layer; and for how it relates to skills and harnesses, skills, harness and the context layer.