AI agents can generate syntactically correct queries but can't validate semantic correctness without structured business context.
An agent asked to "join user events with profile data" generates:
SELECT e.*, p.name, p.email
FROM events e
JOIN profiles p ON e.user_id = p.user_id
WHERE e.event_date > CURRENT_DATE - 7Syntactically perfect. Semantically wrong. It doesn't know:
Valid join key is user_uuid not user_id (legacy field)
Events table has mixed schema versions (v1, v2)
Test events exist in production tables
Schema migration happened mid-quarter
The agent has no way to validate these rules because they exist as tribal knowledge, not queryable metadata. Without context propagation, agents can't distinguish between syntactically valid and semantically correct queries.
Hallucinated joins: Agent joins tables on fields that look related but violate business logic (joining on email instead of verified_customer_id). These are common edge cases that break assumptions.
Stale definitions: Agent uses a metric calculation that was deprecated three months ago
Missing filters: Agent doesn't know to exclude test data, pending transactions, or specific edge cases
Wrong aggregation: Agent sums fields that should be averaged or uses simple average where weighted average is required
The query runs successfully. Results are confidently wrong.
Structured context the agent can validate against:
Query: "join user events with profile data"
Context check:
- events.valid_join_key: "user_uuid"
- events.schema_version: "v2"
- events.exclude_test: true
- profiles.compatible_schemas: ["events_v2", "events_v3"]
- migration.completed: "2024-06-15"Agent generates the query, validates against current rules, adjusts if needed.
Related: What is a context-aware workflow?