DEV Community

Aryan Rajput
Aryan Rajput

Posted on

Verifying Sub-Agent Stage Gates in GitLab's AI Catalog Without Mocking the Execution Graph

The Hook

In a hierarchical multi-agent system where parent AI flows delegate tasks to specialized sub-agents, stubbing out your stage-availability validator (StageCheck.available?) in unit tests guarantees that broken sub-agent capability gates will slip silently into production.

The Deep Dive

As enterprise AI systems evolve from single-turn prompts into orchestrated multi-agent graphs, GitLab's AI Catalog allows platform teams to define declarative AI flows that compose steps and invoke sub-agent definitions. Before a parent flow can execute or delegate to a referenced sub-agent—particularly when a flow definition references sub-agents directly without an explicit include block—the orchestration engine must validate stage and feature availability via StageCheck.available?.

While working on MR !271084 (test(ai): use real stage check for flows without include) in gitlab-org/gitlab (approved by Fiona McCawley and Hannah Baker), I examined how AI Catalog flow validation specs tested flows that reference sub-agents without an include stanza. When test suites globally stub StageCheck.available? to return true, they bypass the actual traversal logic that inspects each sub-agent's stage metadata and license/feature-flag gates. If a schema change alters how sub-agent references are resolved when include is omitted, a mocked spec continues passing while real-world flow execution fails at runtime.

In MR !271084, I refactored the AI flow verification suite to exercise the real StageCheck.available? implementation across flows without include, proving that the validator accurately traverses sub-agent references and enforces stage availability boundaries without relying on brittle test doubles.

The GitLab Hero Angle

GitLab Duo Agent Platform and the AI Catalog (MR !271084) enforce deterministic stage-gate verification across parent flows and sub-agents—giving enterprises cryptographic and policy certainty that autonomous multi-agent workflows respect stage and tier boundaries.

The Takeaway

When testing multi-agent orchestration graphs, never mock the policy or stage-availability evaluator (StageCheck.available?) across structural edge cases like omitted include blocks—test the real validator against real graph topologies.

Top comments (0)