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 a reviewer

If you review pull requests with a custom reviewer in DinoAI Code Review, such as the end-to-end PR reviewer, add test-maintainer to the reviewer’s Squad in the builder (and invoke_agent to the reviewer’s allowed tools). The reviewer then delegates test-writing instead of only reporting the gap as a finding. The test maintainer calls notify_parent_session with its result once complete, so the reviewer can include it in its review.
When used as a sub-agent, the test maintainer receives the branch name and model name in the invoke_agent message, not from a Bolt context. A review session is checked out at the pull request’s head commit, so make sure the reviewer passes the head branch from the head: line of its review message.
On a workspace connected through the GitLab connection, a DinoAI agent can push only to its own paradime/<session id> branch, so the test maintainer can’t commit to the merge request branch. Use it there to write and test the tests, and have the reviewer report them as findings.

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.