Governing AI Agents in dbt - materialization, new node type, or something else? #15387
Replies: 5 comments 6 replies
Can you help me understand why |
|
would there be a possibility to define this as an expansion on |
|
Great thread — we’ve been wrestling with the same question. We didn’t wait for a dbt-native agent construct because our agents sit in a different layer than our data models. dbt governs the semantic/data plane (semantic views, silver LLM outputs, tests, lineage). Cortex Agents are Snowflake config objects — orchestration instructions, tool wiring, skills, RBAC — that reference dbt-built objects but aren’t transformations themselves. We built a package as a separate CLI and deploy agents through the same platform stack we use for everything else in Snowflake: dbt → semantic views, LLM-backed silver/gold models, tests So for us it’s not “dbt vs agents” — it’s dbt for governed data, Flyway/Terraform/Package for platform + agent lifecycle |
|
This discussion seems very interesting and complex. The suggestions and alternatives make a lot of sense. For Pooja's use case, having a specific dbt object seems pretty useful, and having the agent version-controlled feels healthy and almost mandatory. But as Karthik stated, there are many other cases that do not depend on semantic models, and there could be other scenarios that wouldn't fit or wouldn't be useful to process agents in dbt. In the same way, while the fact that the agent is a DDL is an argument in favor of having a node type in dbt, it is also composed of YAML, which makes it especially complex. This hybrid nature could actually be an argument either for or against creating a custom materialization for this specific case. Another thing that worries me is that Snowflake's definition, format, and behavior might change, and we would have to constantly chase those changes. In a way, I think it's not general or consolidated enough yet to add it to dbt. I hadn't read the "Expectations for dbt contributors" before, and reading this part: "We also believe dbt as a framework should be extensible enough to "make the easy things easy, and the hard things possible". To that end, we don't believe it's appropriate for dbt to have an out-of-the-box solution for every niche problem. Users have the flexibility to achieve many custom behaviors by defining their own macros, materializations, hooks, and more. We view it as our responsibility as maintainers to decide when something should be "possible" — via macros, packages, etc. — and when something should be "easy" — built into the dbt standard." So, instead of just sharing my personal feeling, I ask myself if this should be "easy". And I think not, especially under the argument that it is not a consolidated technology yet, none of us would be surprised if it takes a different shape next year. Also, it doesn't cover a full range of use cases and it would be mainly for Snowflake out of the box tools, which could label it as a niche problem. After looking at the whole conversation, I feel like my comment might seem unhelpful and like a negative vote. Initially, I really engaged with the idea and felt the impulse to praise Pooja for the solution. But after paying attention to every comment and many angles of this, I'm just being honest and trying to be the most sensible. Reading this, I also remembered the Open Semantic Interchange OSI, but looking into it a bit, it doesn't cover Agent definitions yet, if that changes, this discussion would definitely gain a lot of traction. By no means do I think this idea should be shelved, the root concept is very interesting: dbt brought software development best practices to the data world, and Pooja's idea has the same spirit of extending that philosophy to the world of AI agents. |
|
I think this could be a new node type, and broader than just agents. Ultimately, these are ML/AI artifacts. They have training, testing, and inference steps, along with their own materialized state and versions. For something downstream, whether that’s another ML model or an agent, it needs to resolve the correct version and run inference against it. That seems like a different lifecycle from a normal dbt model or materialization. |
Uh oh!
There was an error while loading. Please reload this page.
Following Grace's feedback on PR #15371, I am opening this discussion to hash out the right approach before implementation.
The problem
Snowflake Cortex Agents can be created and modified directly in the Snowsight UI with no audit trail. There is currently no way to version-control, peer-review, or CI/CD-deploy an AI agent through dbt. The same governance guarantees dbt provides for tables, views, and semantic views do not extend to agents today.
The proposal
Managing AI agent definitions as dbt artifacts, versioned in git, deployed through CI/CD, visible in lineage. The key capability is
ref()insidetool_resources, so agents appear downstream of their semantic views in the DAG and semantic view references are environment-aware.Open questions
1. Materialization or new node type?
PR #15371 implemented this as a model materialization. Grace correctly notes that unlike table, view, and dynamic_table, a Cortex Agent does not create a ref-able relation in the warehouse. The precedent for non-data materializations is limited. A new node type (similar to how sources and exposures are distinct from models) might be more architecturally correct, but would require deeper changes to the DAG layer.
2. How would it inject into the DAG?
If it is a new node type rather than a materialization, how does dbt know to include it in
dbt run? Does it get its own command (dbt deploy-agents)? Or does it participate in the standard node execution graph?3. Snowflake-specific or multi-adapter?
Snowflake Cortex Agents are Snowflake-native. But the broader problem of governing AI agents as code through dbt likely applies to other platforms as AI agent objects emerge. Should the spec be designed with multi-adapter extensibility in mind from the start?
What we have seen work in production
We are exploring running this pattern as a local macro override with
CREATE OR REPLACE AGENTon every dbt run to bring agents closer to development and CI/CD and treat them as first-class citizens of the DAG lineage. The governance story works in practice. The open question is where this capability belongs in the dbt architecture.All reactions