Skip to main content
The dbt™ test maintainer is a DinoAI agent that writes missing tests for any model changed in a pull request, runs dbt test to confirm they pass, and commits the result directly to the PR branch. It can also be invoked as a sub-agent by the end-to-end PR reviewer, which delegates test-writing instead of just flagging the gap in its verdict.
PrerequisitesEstimated time: 20 minutes.

Steps

1

Create the agent

In the Agent app, open Agents, select New agent, and start from the test-failure-analyst template (or Start from scratch). Fill in the builder fields with the content below. See Build an agent in the UI for a tour of the builder.Name: test-maintainerRole:
Goal:
Backstory:
Model: leave Auto selected.Allowed tools (everything else is refused, see the Tools Reference):
  • read_file, write_file, search_files_and_directories, ripgrep_search
  • get_model_health, get_lineage
  • run_sql_query
  • run_terminal_command
  • post_slack_message
  • notify_parent_session
Output: set the Slack channel to #data-quality (or your team’s channel).
get_model_health and get_lineage are dbt Discovery tools: the first tells the agent which tests already exist and their last statuses, the second shows downstream JOIN/GROUP BY usage so not_null candidates are grounded in real consumption. notify_parent_session lets this agent report back when invoked as a sub-agent; without invoke_agent in the list, it cannot delegate further, so the delegation graph stays exactly two levels deep.
2

Deploy the agent

Select Deploy and choose where the agent lives: Just here saves it to the workspace and makes it live immediately, Open a pull request commits it to your repo as .dinoai/agents/test-maintainer.yml so it is governed as code. Both appear in the Bolt agent picker. See Creating Agents in the App.
3

Run it on every PR with Bolt

Add a Run Paradime DinoAI Agent command to a Bolt schedule and trigger it on pull request merge, so the agent writes tests whenever a model changes. The command runs natively with no API keys to configure. See Run an agent with Bolt for the full walkthrough.Pick test-maintainer and give it a task that names the model, for example:
4

Review the written tests

After the agent runs, open the PR. You’ll see a new commit test: add missing tests for <model> [DinoAI], a per-model summary, and the same summary in #data-quality. The agent always runs dbt test before reporting completion, so every committed test is one it verified passes (or set to severity: warn with an explanation).
On a PR that adds or changes a model without full test coverage, the agent commits inferred unique, not_null, accepted_values, and relationships tests that pass dbt test. Tests that fire on genuine bad data are committed at severity: warn with a # DATA ISSUE comment rather than blocking the pipeline. The agent never commits a test failing at severity: error, and never removes or reformats existing passing tests.

How it works

The agent is handed a model name and branch. Each session reads the model and its upstream sources, checks existing coverage via get_model_health, infers and writes tests into the schema YAML, runs dbt test --select <model>, iterates until green, and commits to the PR branch.

Tests the agent writes

The agent never writes a test it cannot justify from the SQL. When a test candidate is ambiguous it adds a # TODO: confirm test logic with owner comment in the YAML rather than guessing.

Use as a sub-agent of the PR reviewer

If you have the PR reviewer set up, add test-maintainer to the reviewer’s Squad in the builder (and invoke_agent to the reviewer’s allowed tools) so the reviewer delegates test-writing rather than just flagging the gap in its verdict. The test maintainer then calls notify_parent_session with its findings once complete so the reviewer can include the result in its final verdict.
When used as a sub-agent, the test maintainer receives the branch name and model name via the invoke_agent message rather than from a Bolt context. Make sure the PR reviewer includes both in its delegation message.

Next steps

Run an agent with Bolt

Trigger this agent on a schedule, on merge, or in Turbo CI.

End-to-end PR reviewer

The parent agent that can delegate to this one.

dbt™ documentation backfiller

Backfill missing descriptions on the same PR.

Programmable Agents reference

The agent schema, tools, and API.