Skip to content

examples(governance): add dbt-backed data quality evidence flow - #2278

Merged
Imran Siddique (imran-siddique) merged 2 commits into
microsoft:mainfrom
SomeshZanwar:examples/dbt-data-quality-evidence
May 18, 2026
Merged

Imran Siddique (imran-siddique) merged 2 commits into
microsoft:mainfrom
SomeshZanwar:examples/dbt-data-quality-evidence

Conversation

@SomeshZanwar

Copy link
Copy Markdown
Contributor

Description

Extends the existing examples/data-quality-aware-governance/ example with a dbt-backed DataQualityEvidence flow, per maintainer direction in Discussion #2261.

This keeps the evidence shape local to the example and does not introduce any core package model or AGT runtime behavior change.

What this adds:

  • DataQualityEvidence — an example-local frozen dataclass representing dataset quality state at time of agent access
  • dbt_adapter.py — maps dbt run_results.json output into typed data quality evidence
  • fixtures/ — synthetic dbt pass/fail run result artifacts
  • updated example.py — wires AGT policy evaluation plus dbt-backed data quality evidence into a final allow/block decision
  • updated README.md — documents the flow, fields, scenarios, and non-goals

Scenarios demonstrated:

  1. Authorized agent + dbt tests passing → ALLOWED
  2. Authorized agent + dbt tests failing → BLOCKED at data quality layer
  3. Unauthorized agent + dbt tests passing → BLOCKED at AGT policy layer

No core package changes. No new dependencies.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Maintenance (dependency updates, CI/CD, refactoring)
  • Security fix

Package(s) Affected

  • agent-os-kernel
  • agent-mesh
  • agent-runtime
  • agent-sre
  • agent-governance
  • docs / root

Checklist

  • My code follows the project style guidelines (ruff check)
  • I have added tests that prove my fix/feature works
  • All new and existing tests pass (pytest)
  • I have updated documentation as needed
  • I have signed the Microsoft CLA

Attribution & Prior Art

  • This contribution does not contain code copied or derived from other projects without attribution
  • Any external projects that inspired this design are credited in code comments or documentation
  • If this PR implements functionality similar to an existing open-source project, I have listed it below

Prior art / related projects:

AI Assistance

  • I can explain every meaningful change in this PR: what it does, why, and what tradeoffs were considered
  • I have run tests and verification appropriate for this change
  • No part of this PR was autonomously submitted by an AI agent without my review
  • I have not used AI to generate review comments on others' PRs

If AI tools materially shaped this change, briefly note what was used:

ChatGPT was used for planning, drafting assistance, and step-by-step implementation support. I reviewed the files, ran the example manually, checked compilation, and verified the diff before submitting.

IP, Patents, and Licensing

  • This contribution does not implement patent-pending or patent-encumbered techniques
  • This contribution does not require an NDA or licensing agreement to understand or use
  • Any AI tools used have terms compatible with the MIT License

Related Issues

Addresses Discussion #2261.
Extends PR #2224.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 15, 2026
@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown
🤖 AI Agent: breaking-change-detector — API Compatibility

API Compatibility

No breaking changes detected.

@github-actions github-actions Bot added the size/XL Extra large PR (500+ lines) label May 15, 2026
@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown
🤖 AI Agent: docs-sync-checker — Docs Sync

Docs Sync

  • load_from_dbt_run_results() in dbt_adapter.py -- missing docstring
  • CHANGELOG.md -- entry added for the new dbt-backed data quality evidence example

Documentation is otherwise in sync.

@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown
🤖 AI Agent: code-reviewer — View details

TL;DR: 0 blockers, 1 warning. Example code is well-structured and adheres to project standards, but lacks automated tests.

# Sev Issue Where
1 Warn Missing automated tests examples/data-quality-aware-governance/adapters/dbt/

Action items:

  1. Add automated tests for the dbt adapter and DataQualityEvidence to ensure correctness and prevent regressions. Fine as follow-up PRs.

@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown
🤖 AI Agent: test-generator — `data_quality_evidence.py`

data_quality_evidence.py

  • test_data_quality_evidence_validation_status -- Ensure invalid validation_status values raise a ValueError.
  • test_data_quality_evidence_quality_score -- Verify quality_score outside the range [0.0, 1.0] raises a ValueError.
  • test_is_fresh_at -- Test is_fresh_at method for edge cases like exactly 0 hours or slightly over max_age_hours.

dbt_adapter.py

  • test_load_from_dbt_run_results_missing_file -- Confirm FileNotFoundError is raised for a missing run_results.json.
  • test_load_from_dbt_run_results_invalid_metadata -- Validate ValueError is raised when metadata.generated_at is missing.
  • test_load_from_dbt_run_results_quality_score_calculation -- Test quality_score calculation for edge cases like zero tests or all tests failing.

@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown
🤖 AI Agent: security-scanner — View details

No security issues found.

@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ⚠️ Warning See details
🛡️ Security Scan ✅ Passed No issues found
🔄 Breaking Changes ✅ Passed No issues found
📝 Docs Sync ✅ Passed No issues found
🧪 Test Coverage ✅ Completed Analysis complete

Verdict: ⚠️ Ready for human review

@miyannishar Nishar Miya (miyannishar) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Somesh Zanwar (@SomeshZanwar), the implementation is solid — the DataQualityEvidence dataclass is well-written, the dbt adapter is clean, and you followed the direction from the discussion exactly on the core requirements (example-level, no core package changes, no new dependencies, dbt fixtures as input). Good work on all of that.

One thing to revisit though. In the discussion you said:

"I'll draft a standalone example... I'll keep it self-contained"

And what landed replaces the existing generic example.py and README.md rather than sitting alongside them. The original example was tool-agnostic — it showed the two-layer governance pattern without prescribing dbt, Great Expectations, or any specific framework. That generic entry point has value for people who aren't using dbt.

Can you restructure so the original stays intact and the dbt-specific work lives in its own subdirectory?

examples/data-quality-aware-governance/
├── example.py              ← original generic example (restored)
├── README.md               ← original tool-agnostic docs (restored)
├── policy.yaml
└── adapters/
    └── dbt/
        ├── README.md       ← dbt-specific docs
        ├── dbt_adapter.py
        ├── data_quality_evidence.py
        └── fixtures/
            ├── dbt_run_results_pass.json
            └── dbt_run_results_fail.json

That way the generic pattern stays as the entry point, dbt is clearly positioned as one concrete adapter, and future contributors can add a great-expectations/ or soda/ adapter in the same pattern. This is also what "standalone" implied in the discussion.

The DataQualityEvidence dataclass and dbt_adapter.py are good as-is — no changes needed there, just the structural placement.

Two minor things while you're at it:

  • Both data_quality_evidence.py and dbt_adapter.py are missing a trailing newline (the diff shows \ No newline at end of file) — will likely fail the linter
  • _parse_timestamp strips the Z suffix producing a naive datetime — fine for the example scope, but worth a one-line comment saying this is intentional

@miyannishar

Copy link
Copy Markdown
Contributor

Also pls address the CI failures :)

@SomeshZanwar
Somesh Zanwar (SomeshZanwar) force-pushed the examples/dbt-data-quality-evidence branch from 60fb68e to 73159ec Compare May 16, 2026 16:03
@github-actions github-actions Bot added size/L Large PR (< 500 lines) and removed size/XL Extra large PR (500+ lines) labels May 16, 2026
@SomeshZanwar

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I restructured the PR so the generic example.py and README.md stay as the root entry point, and moved the dbt-specific implementation under:

examples/data-quality-aware-governance/adapters/dbt/

Also removed the hash/crypto usage, added the timestamp parsing comment, fixed whitespace, and amended the commit with DCO signoff.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example-only, no core changes. Code structure looks good. Pending items from prior review: add docstring to \load_from_dbt_run_results(), changelog entry, and tests for the adapter. Once those are addressed, this is ready to merge.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR: 0 blockers, 1 warning. Example-only scope, looks clean.

Sev Issue Location
Warn Spell-check CI failing - check for typos in new files adapters/dbt/*.py, README

Self-contained example under examples/, no core package changes. Fix spell-check and this is good to merge.

@imran-siddique

Copy link
Copy Markdown
Collaborator

Hey Somesh Zanwar (@SomeshZanwar) — are you still working on this? Would love to see it land. Let me know if the review feedback needs clarification.

@SomeshZanwar

Copy link
Copy Markdown
Contributor Author

Thanks, Imran. Yes, still working on it.

I’ll address the remaining items now:

  • add a clearer docstring for load_from_dbt_run_results()
  • add the changelog entry
  • fix the spell-check warning in the dbt adapter files / README

I’ll push a small follow-up commit once those are done.

Signed-off-by: SomeshZanwar <someshzanwar345@gmail.com>
Signed-off-by: SomeshZanwar <someshzanwar345@gmail.com>
@SomeshZanwar
Somesh Zanwar (SomeshZanwar) force-pushed the examples/dbt-data-quality-evidence branch from 0054fac to a8b9eae Compare May 18, 2026 14:33

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR: 0 blockers, approve.

Good example showing dbt run_results.json -> DataQualityEvidence -> policy decision flow. Clean structure under examples/data-quality-aware-governance/adapters/dbt/. Minor nit: cspell terms are appended unsorted but CI doesn't enforce ordering on the tail, so not blocking.

@SomeshZanwar

Copy link
Copy Markdown
Contributor Author

Thanks, Imran. Appreciate the review and approval.

@imran-siddique
Imran Siddique (imran-siddique) merged commit 34aefab into microsoft:main May 18, 2026
10 of 11 checks passed
MohammadHaroonAbuomar pushed a commit to MohammadHaroonAbuomar/agt-acs that referenced this pull request Jun 1, 2026
…osoft#2278)

* examples(governance): add dbt-backed data quality evidence flow

Signed-off-by: SomeshZanwar <someshzanwar345@gmail.com>

* docs(examples): address dbt evidence review feedback

Signed-off-by: SomeshZanwar <someshzanwar345@gmail.com>

---------

Signed-off-by: SomeshZanwar <someshzanwar345@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/L Large PR (< 500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants