Cost-tiered quality gate evaluation with early termination for multi-agent computational pipelines
A cost-tiered quality gate evaluation system with dynamic tool discovery optimizes multi-agent AI computational pipelines by ensuring inexpensive checks are performed first, reducing AI inference costs and enhancing efficiency through early termination and project-specific tool integration.
Patent Information
- Application Number
- US19/647434
- Authority / Receiving Office
- US · United States
- Patent Type
- Patents(United States)
- Current Assignee / Owner
- Priority Date
- 2026-01-21
- Filing Date
- 2026-04-14
- Publication Date
- 2026-12-01
- Estimated Expiration
- 2046-04-14
AI Technical Summary
Existing multi-agent AI computational systems lack mechanisms to dynamically discover project-specific validation tools and incorporate them into quality gate evaluation pipelines, leading to sub-optimal evaluation ordering where expensive AI evaluations are performed unnecessarily.
Implement a cost-tiered quality gate evaluation system with a gate cost tier classifier that orders quality gates by computational resource requirements, using a three-tier hierarchy to ensure inexpensive pattern-matching gates are evaluated first, and incorporate project-specific validation tools through a dynamic gate discovery engine, allowing early termination of higher-cost evaluations when lower-tier gates determine the outcome.
This approach reduces unnecessary AI inference costs by detecting failures at lower computational tiers, optimizing computational pipeline costs and improving efficiency by incorporating project-specific validation tools.
Smart Images

Figure US12818373-D00000_ABST
Abstract
Description
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application claims priority to and the benefit of U.S. Provisional Application No. 63 / 964,857, filed Jan. 21, 2026, the entire disclosure of which is incorporated herein by reference.BACKGROUND
[0002] Multi-agent AI computational systems typically coordinate autonomous AI agents through structured pipelines. Pipelines can be expressed as directed acyclic graphs (DAGs) where each node represents a task assigned to an AI agent. After each task produces output, one or more quality gates evaluate the output against configurable criteria to determine whether the output satisfies a required standard. Quality gates may take multiple forms. In some systems, pattern-matching checks verify the presence or absence of required content, structural checks verify output format and completeness, and AI-based evaluation checks employ a secondary AI model to assess the output against a natural-language quality rubric. These gate types may have different computational resource requirements. Pattern-matching and structural checks may execute in microseconds with negligible computational cost, while AI-based evaluation may require invoking an AI model inference application programming interface (API), consuming input and output tokens at computational cost per invocation.
[0003] In some conventional systems, composite quality gates combine multiple sub-gates using Boolean logic (e.g., all sub-gates must pass, or at least one sub-gate must pass). Composite gates may employ short-circuit evaluation, terminating upon detecting a determining result. However, in some approaches, the evaluation order of sub-gates within a composite gate may be determined by a declaration sequence specified by a pipeline designer rather than by the computational cost of each sub-gate. In such approaches, an expensive AI evaluation sub-gate declared before a cheaper pattern-matching sub-gate may execute first, even when the pattern-matching sub-gate would have detected the same failure at lower cost. Additionally, between zero-cost pattern matching and high-cost AI evaluation, project-specific validation tools (e.g., linters, type checkers, test suites) may catch a class of defects at zero AI inference cost. However, some systems may lack mechanisms to dynamically discover which project-specific validation tools are available for a given project and to incorporate those tools into the quality gate evaluation pipeline.BRIEF DESCRIPTION OF THE DRAWINGS
[0004] FIG. 1 is a block diagram illustrating a system architecture for cost-tiered quality gate evaluation in a multi-agent computational pipeline system, in accordance with some embodiments.
[0005] FIG. 2 is a flowchart illustrating a method for cost-tiered evaluation of a composite AND quality gate with early termination, in accordance with some embodiments.
[0006] FIG. 3 is a flowchart illustrating a process for dynamic gate discovery from an agent memory system, in accordance with some embodiments.
[0007] FIG. 4 is a diagram illustrating cost reduction across feedback loop iterations using tiered quality gate evaluation, in accordance with some embodiments.
[0008] FIG. 5 is a block diagram illustrating a gate type hierarchy and cost tier assignment, in accordance with some embodiments.
[0009] FIG. 6 is a block diagram illustrating an example computing device suitable for implementing the systems and methods described herein, in accordance with some embodiments.
[0010] The technologies described herein will become more apparent to those skilled in the art from studying the Detailed Description in conjunction with the drawings. Embodiments or implementations describing aspects of the invention are illustrated by way of example, and the same references can indicate similar elements. While the drawings depict various implementations for the purpose of illustration, those skilled in the art will recognize that alternative implementations can be employed without departing from the principles of the present technologies. Accordingly, while specific implementations are shown in the drawings, the technology is amenable to various modifications.DETAILED DESCRIPTION
[0011] The following detailed description is made with reference to the accompanying drawings. The implementations described herein are illustrative and not limiting. Other implementations may be utilized, and structural and operational changes may be made without departing from the scope of the present disclosure.
[0012] Multi-agent AI computational systems can coordinate autonomous AI agents through structured pipelines, where pipelines can be expressed as directed acyclic graphs (DAGs) with each node representing a task assigned to an AI agent. After each task produces output, one or more quality gates can evaluate the output against configurable criteria to determine whether the output satisfies a required standard. Quality gates can take multiple forms, including pattern-matching checks that verify the presence or absence of required content, structural checks that verify output format and completeness, and AI-based evaluation checks that employ a secondary AI model to assess the output against a natural-language quality rubric. These gate types can have different computational resource requirements. Pattern-matching and structural checks can execute in microseconds with negligible computational cost, while AI-based evaluation can require invoking an AI model inference application programming interface (API), consuming input and output tokens at computational cost per invocation.
[0013] In many systems, composite quality gates combine multiple sub-gates using Boolean logic (e.g., all sub-gates must pass, or at least one sub-gate must pass). Composite gates can employ short-circuit evaluation, terminating upon detecting a determining result. However, in many techniques, the evaluation order of sub-gates within a composite gate can be determined by a declaration sequence specified by a pipeline designer rather than by the computational cost of each sub-gate. In such techniques, an expensive AI evaluation sub-gate declared before a cheaper pattern-matching sub-gate can execute first, even when the pattern-matching sub-gate would have detected the same failure at lower cost. Additionally, between zero-cost pattern matching and high-cost AI evaluation, project-specific validation tools (e.g., linters, type checkers, test suites) can catch a class of defects at zero AI inference cost. However, many systems can lack mechanisms to dynamically discover which project-specific validation tools are available for a given project and to incorporate those tools into the quality gate evaluation pipeline.
[0014] Embodiments of the present disclosure provide systems, methods, and computer-readable media for cost-tiered quality gate evaluation with early termination in multi-agent computational pipelines. A quality gate evaluator can include a gate cost tier classifier that classifies a plurality of quality gate evaluations associated with a phase into one or more cost tiers based on a computational resource requirement of each quality gate evaluation. The cost tiers can include a first cost tier associated with pattern-matching operations that consume negligible computational resources, a second cost tier associated with local tool execution operations that consume compute resources but no AI model inference tokens, and a third cost tier associated with AI model inference operations that consume input tokens and output tokens at a computational cost per invocation. A cost-ordered composite gate executor can receive a composite quality gate configuration containing a plurality of sub-gates combined using Boolean logic, order the sub-gates by ascending cost tier to produce an ordered evaluation sequence, and execute the sub-gates according to the ordered evaluation sequence. Upon determining that a sub-gate at a lower cost tier has produced a result that determines the outcome of the composite gate (e.g., a failing result in an AND composite gate, or a passing result in an OR composite gate), the executor can terminate execution of remaining sub-gates at higher cost tiers.
[0015] The disclosed technology addresses the problem of sub-optimal evaluation ordering in many systems where the evaluation order of sub-gates within a composite gate can be determined by a declaration sequence specified by a pipeline designer rather than by the computational cost of each sub-gate. By classifying quality gate evaluations into cost tiers and ordering them by ascending cost tier before execution, the disclosed systems can ensure that inexpensive pattern-matching gates are evaluated before expensive AI model inference gates, thereby avoiding unnecessary AI inference costs when failures can be detected at lower cost tiers. Additionally, a dynamic gate discovery engine can query an agent memory system for learned project-specific validation commands associated with a project context and inject the discovered commands as tool execution quality gate evaluations at an intermediate cost tier between pattern-matching gates and AI evaluation gates. This addresses the challenge faced by many systems that lack mechanisms to dynamically discover which project-specific validation tools are available for a given project and to incorporate those tools into the quality gate evaluation pipeline. A cost reduction tracker can record, in a decision log, a tier execution record comprising a termination tier, a count of quality gate evaluations executed, a count of quality gate evaluations skipped, and an estimated computational cost reduced, enabling visibility into computational pipeline cost optimization. In embodiments where a phase is part of a feedback loop that iterates between a correction phase and a verification phase, the cost reduction can compound across iterations, as iterations that fail at a lower cost tier do not invoke AI model inference operations at higher cost tiers.System Architecture
[0016] FIG. 1 illustrates a system architecture for cost-tiered quality gate evaluation in a multi-agent computational pipeline system, in accordance with some embodiments. The system architecture includes a workflow orchestrator 102 that coordinates one or more AI agents (not shown) through a multi-agent computational pipeline expressed as a DAG. Each node in the DAG represents a phase, and each phase produces an output that is evaluated by a quality gate evaluator 104.
[0017] In some embodiments, the quality gate evaluator 104 includes a gate cost tier classifier 110, a cost-ordered composite gate executor 120, a cost reduction tracker 130, and a dynamic gate discovery engine 140.
[0018] In some implementations, the system architecture implements a three-tier cost hierarchy where the cost tiers include a first cost tier (also referred to herein as an “instant tier” or “Tier 0”) associated with pattern-matching and structural check operations that consume negligible computational resources, a second cost tier (also referred to herein as a “local tool tier” or “Tier 1”) associated with local tool execution operations that consume compute resources but no AI model inference tokens, and a third cost tier (also referred to herein as an “AI evaluation tier” or “Tier 2”) associated with AI model inference operations that consume input tokens and output tokens at a computational cost per invocation. The ordinal terms “first,”“second,” and “third” are used as arbitrary labels to distinguish claim elements and do not necessarily correspond to the tier numbering (Tier 0, Tier 1, Tier 2) used in this description. For example, a claim reciting “a first cost tier” and “a second cost tier” uses those labels to distinguish two tiers by their attributes, not to refer to specific numbered tiers of the cost tier hierarchy. The first cost tier associated with pattern-matching operations and second cost tier associated with AI model inference operations can be understood as covering a subset of the full three-tier structure. The “first” and “second” cost tiers can map to any two tiers in the hierarchy using their functional attributes rather than requiring all three tiers to be present.
[0019] In some implementations, pattern-matching operations are quality gate evaluations classified into the first cost tier that consume negligible computational resources. In some implementations, negligible computational resources refers to operations that execute in sub-millisecond time, consume no external API calls, and require no network communication. Examples include in-memory string matching, regular expression evaluation, and character counting operations that complete in microseconds using only local CPU and memory resources. The first cost tier includes one or more of the following gate types: a keyword presence check that verifies presence of one or more required keywords in the output; a keyword absence check that verifies absence of one or more forbidden keywords; a minimum length check that verifies the output meets a minimum character count; a blocked phrase check that verifies the output does not contain one or more phrases indicating the agent was unable to complete the task; a code block count check that verifies the output contains a minimum number of code blocks; a completion marker check that verifies presence of a success marker and absence of a failure marker; a deliverables check that verifies the output contains one or more expected deliverables; a template modification check that verifies the output differs from an input template; and a regular expression check that verifies the output matches a regular expression pattern.
[0020] In some implementations, a quality gate is an evaluation mechanism that assesses output produced by an AI agent against configurable criteria to determine whether the output satisfies a required standard. Quality gates can take multiple forms, including pattern-matching checks that verify the presence or absence of required content, structural checks that verify output format and completeness, and AI-based evaluation checks that employ a secondary AI model to assess the output against a natural-language quality rubric. For example, a keyword presence check can verify presence of one or more required keywords in the output, while a minimum length check can verify the output meets a minimum character count. A natural-language quality rubric for evaluating generated code might state: “The code must compile without errors, include docstrings for all public functions, follow PEP 8 style guidelines, and correctly implement the specified algorithm. Deduct points for unused imports, hardcoded values that should be parameters, or missing error handling.”
[0021] In some implementations, AI model inference evaluation gates are quality gate evaluations classified into the third cost tier. Each model evaluation gate invokes an AI model inference API to evaluate the output against a natural-language quality rubric. The AI model consumes input tokens (the rubric and the output) and produces output tokens (the evaluation result), incurring a computational cost per invocation. A natural-language quality rubric can specify evaluation criteria in human-readable form, such as requirements for code correctness, documentation completeness, or adherence to project conventions.
[0022] The gate cost tier classifier 110 receives a quality gate configuration associated with a phase and classifies each quality gate evaluation (also referred to herein as a “gate” or “sub-gate”) within the configuration into one of a plurality of cost tiers based on a computational resource requirement of the gate. In some implementations, a computational resource requirement refers to the resources consumed when executing a quality gate evaluation. Pattern-matching and structural checks can execute in microseconds with negligible computational cost, while AI-based evaluation can require invoking an AI model inference application programming interface (API), consuming input and output tokens at computational cost per invocation. Tool execution gates consume compute resources (e.g., CPU time, memory) but do not consume AI model inference tokens.
[0023] In some implementations, tool execution gates are quality gate evaluations classified into the second cost tier that invoke an external validation tool (e.g., a linter, a type checker, a test suite, or a build command) on the output or on files produced by the AI agent. Tool execution gates consume compute resources (e.g., CPU time, memory) but do not consume AI model inference tokens. The gate configuration includes a command string (e.g., “make check,”“ruff check.,” or “pytest tests / ”), a pass condition (e.g., “exit code equals zero”), and a timeout value.
[0024] The cost-ordered composite gate executor 120 receives a composite quality gate configuration containing a plurality of sub-gates combined using Boolean logic (e.g., AND or OR), reorders the sub-gates by ascending cost tier, and executes the sub-gates in the reordered sequence. When a sub-gate at a lower cost tier produces a result that determines the outcome of the composite gate (e.g., a failing result in an AND composite gate, or a passing result in an OR composite gate), the executor 120 terminates execution of remaining sub-gates at higher cost tiers.
[0025] The cost reduction tracker 130 records, in a decision log, the cost incurred during each quality gate evaluation, the cost reduced by skipping higher-tier evaluations, and cumulative cost reduction across a computational pipeline run. In some embodiments, the decision log is a structured log (e.g., JSON Lines format) that records a termination tier, a count of gates executed, a count of gates skipped, and an estimated cost reduced per evaluation.
[0026] The dynamic gate discovery engine 140 queries an agent memory system 150 (illustrated and described in more detail with reference to FIG. 3) for learned project-specific validation commands and injects the discovered commands as quality gates at the second cost tier (local tool tier) before AI evaluation gates at the third cost tier. In some implementations, the agent memory system 150 is a persistent storage system that maintains knowledge acquired by AI agents during prior task executions. The agent memory system 150 may store multiple categories of memory, including episodic memory (records of specific past events), semantic memory (general knowledge about domains), and procedural memory (learned commands and workflows). The system exposes a query interface (e.g., GraphQL, REST API, or direct database access) that enables other system components to retrieve relevant memories based on project context, memory type, and confidence thresholds. In some embodiments, the agent memory system 150 stores procedural memory entries via a GraphQL interface, and each entry includes a command string, a pass condition, and a confidence score indicating reliability of the command for quality validation.
[0027] In some implementations, procedural memory is a category of memory stored in an agent memory system that contains learned validation commands from prior project interactions. The query specifies a memory type of “procedural,” a category of “validation\_command,” and a project identifier matching the project context. The agent memory system stores procedural memory entries via a GraphQL interface, enabling the dynamic gate discovery engine to retrieve project-specific commands for incorporation into quality gate evaluations. In some implementations, a confidence score is a numerical value indicating the reliability of a learned validation command for quality validation purposes. Each entry includes a command string, a pass condition, and a confidence score indicating reliability of the command for quality validation. The confidence threshold is a configurable parameter in the range of 0 to 1. In some embodiments, the confidence threshold is set to 0.7, and entries with a confidence score below the threshold are excluded from injection into the composite quality gate configuration, such that only sufficiently reliable validation commands are incorporated into the evaluation pipeline.
[0028] In some implementations, learned project-specific validation commands are validation commands that an agent memory system has stored based on prior interactions with a particular project. The dynamic gate discovery engine queries the agent memory system for procedural memory entries associated with the project, where the query specifies a memory type of “procedural,” a category of “validation\_command,” and a project identifier matching the project context. For example, the engine filters the returned entries by a confidence threshold of 0.7 or greater, and for each entry that meets the threshold, constructs a tool execution gate configuration including a command string (e.g., “make check,”“ruff check.,” or “pytest tests / ”), a pass condition (e.g., “exit code equals zero”), and a timeout value.Cost-Ordered Composite Gate Execution
[0029] FIG. 2 illustrates a method 200 for cost-tiered evaluation of a composite AND quality gate with early termination, in accordance with some embodiments.
[0030] At step 202, the cost-ordered composite gate executor 120 (FIG. 1) receives a composite quality gate configuration containing a plurality of sub-gates and an indication that all sub-gates must pass (AND logic).
[0031] At step 204, the executor 120 classifies each sub-gate into a cost tier by invoking the gate cost tier classifier 110.
[0032] At step 206, the executor 120 sorts the sub-gates by ascending cost tier using a stable sort. In some embodiments, the stable sort preserves a relative order of sub-gates within the same cost tier. For example, if a composite gate configuration declares sub-gates in the order [AI_eval_1, pattern_check_A, AI_eval_2, pattern_check_B], a stable sort by ascending cost tier produces [pattern_check_A, pattern_check_B, AI_eval_1, AI_eval_2], preserving the relative order of pattern_check_A before pattern_check_B and AI_eval_1 before AI_eval_2 as originally declared.
[0033] At step 208, the executor 120 begins executing the sorted sub-gates, starting with sub-gates in the lowest cost tier.
[0034] At decision step 210, for each sub-gate, the executor 120 determines whether the sub-gate produces a passing result. If the sub-gate passes, the method proceeds to step 212 to check whether additional sub-gates remain. If additional sub-gates remain, the method returns to step 208 to execute the next sub-gate. If no additional sub-gates remain, the method proceeds to step 214 to return a passing result for the composite gate.
[0035] If at decision step 210 the sub-gate produces a failing result, the method proceeds to step 216. At step 216, the executor 120 terminates execution of all remaining sub-gates, including sub-gates at the same cost tier and sub-gates at higher cost tiers. The method then proceeds to step 218 to return a failing result for the composite gate, along with the reason from the failing sub-gate.
[0036] At step 220, the cost reduction tracker 130 records the evaluation result (also referred to herein as a “tier execution record”) including: the cost tier at which evaluation terminated (the termination tier), the number of sub-gates executed, the number of sub-gates skipped, and an estimated cost reduced by skipping the remaining sub-gates.
[0037] In some embodiments, the estimated cost of a gate evaluation is determined by a lookup in a cost table mapping gate types to estimated per-invocation costs (e.g., $0.001 for pattern-matching gates, $0.005 for tool execution gates, $0.05 for AI model inference gates). In some implementations, the cost table is a data structure stored in memory that associates each gate type identifier with a numerical cost value. The cost table may be implemented as a hash map, a lookup array indexed by gate type enumeration, or a configuration file loaded at system initialization. The cost values may be expressed in monetary units (e.g., USD), token counts, or abstract cost units for relative comparison. In other embodiments, the estimated cost is a moving average of actual costs observed over previous evaluations of the same gate type.
[0038] In some embodiments, the method 200 is adapted for a composite OR quality gate. For an OR gate, sub-gates are also sorted by ascending cost tier, and if a sub-gate at a lower cost tier produces a passing result, execution of remaining sub-gates at higher cost tiers is terminated. This optimization is based on the observation that for an OR gate, a single passing result at a cheap tier makes expensive evaluations unnecessary.Dynamic Gate Discovery
[0039] FIG. 3 illustrates a process 300 for dynamic gate discovery from an agent memory system 150, in accordance with some embodiments.
[0040] At step 302, the dynamic gate discovery engine 140 (FIG. 1) receives a composite quality gate configuration associated with a phase and a project context identifying the project being processed. In some implementations, a phase is a node in a DAG representing a multi-agent computational pipeline, where each node in the DAG represents a phase, and each phase produces an output that is evaluated by a quality gate evaluator. One or more AI agents are coordinated using the pipeline, assigning tasks to agents at each phase and collecting the resulting output for quality evaluation before proceeding to subsequent phases. In some implementations, a project context is an identifier that associates a multi-agent computational pipeline with a particular project being processed. The dynamic gate discovery engine receives a composite quality gate configuration associated with a phase and a project context identifying the project being processed. The project context enables the system to query an agent memory system for validation commands that are specific to the identified project rather than generic commands applicable across all projects.
[0041] At step 304, the engine 140 queries the agent memory system 150 for procedural memory entries associated with the project. In some embodiments, the query specifies a memory type of “procedural,” a category of “validation_command,” and a project identifier matching the project context.
[0042] At step 306, the engine 140 filters the returned entries by a confidence threshold. The confidence threshold is a configurable parameter in the range of 0 to 1. In some embodiments, the confidence threshold is set to 0.7, and entries with a confidence score below the threshold are excluded.
[0043] At step 308, for each entry that meets the confidence threshold, the engine 140 constructs a tool execution gate configuration. The gate configuration includes a command string (e.g., “make check,”“ruff check.,” or “pytest tests / ”), a pass condition (e.g., “exit code equals zero”), and a timeout value.
[0044] At step 310, the engine 140 injects the constructed tool execution gates into the composite quality gate configuration. In some embodiments, for an AND composite gate, the discovered gates are appended to the existing sub-gates. Because the cost-ordered executor 120 (FIG. 1) subsequently sorts all sub-gates by cost tier, the injected tool execution gates (second cost tier) will be positioned between existing pattern-matching gates (first cost tier) and existing AI evaluation gates (third cost tier), in what is referred to herein as an intermediate cost tier.Cost Reduction Tracking
[0045] In some embodiments, a cost reduction tracker maintains a cumulative cost summary across a computational pipeline run. The cumulative summary includes: a total number of quality gate evaluations performed, a breakdown of evaluations by termination tier (e.g., how many evaluations terminated at the first cost tier versus the second or third cost tier), a total computational cost incurred across all evaluations, a total estimated computational cost reduced by skipping higher-tier evaluations, a reduction percentage computed as reduced cost divided by total potential cost, and a per-tier catch rate indicating the percentage of failures detected at each cost tier.
[0046] FIG. 4 is a diagram illustrating cost reduction across feedback loop iterations using tiered quality gate evaluation, in accordance with some embodiments. The diagram depicts a feedback loop scenario including three iterations, where each iteration evaluates the output of a correction phase against a composite quality gate containing sub-gates at multiple cost tiers. For example, a feedback loop may iterate up to five times attempting to correct code generated by an AI agent. In iteration 1, the agent's output fails a keyword presence check at Tier 0; the system provides feedback and the agent regenerates. In iteration 2, the output again fails at Tier 0. In iteration 3, the output passes Tier 0 and Tier 1 but fails the AI evaluation at Tier 2. In iteration 4, all gates pass and the loop terminates successfully. The cost-tiered approach saved two AI inference invocations (iterations 1 and 2) by detecting failures at Tier 0.
[0047] FIG. 4 demonstrates how cost-tiered evaluation with early termination can reduce computational costs when failures are detected at lower cost tiers in early iterations. As described in more detail with reference to FIG. 1, the cost-ordered composite gate executor 120 orders sub-gates by ascending cost tier and terminates execution upon detecting a determining result, enabling the cost reduction illustrated in the diagram. In some implementations, a determining result is a sub-gate evaluation result that, under the applicable Boolean logic, conclusively establishes the outcome of the composite gate without requiring evaluation of remaining sub-gates. For an AND composite gate, a failing result is a determining result because the composite gate cannot pass regardless of subsequent sub-gate outcomes. For an OR composite gate, a passing result is a determining result because the composite gate will pass regardless of subsequent sub-gate outcomes.
[0048] In iteration 1 (402), the evaluation begins at Tier 0 (the instant tier) with a contains check that produces a failing result, as indicated by Tier 0 contains FAIL (404). The contains check is a keyword presence check that verifies presence of one or more required keywords in the output, as described in more detail with reference to FIG. 5. Because the composite gate uses AND logic and a failure at any tier determines the overall outcome, the executor terminates evaluation immediately without proceeding to higher cost tiers. Tier 1 SKIPPED reduced 0 (406) indicates that the local tool tier was skipped with zero cost reduction because tool execution gates in this example have negligible token cost, though they may consume compute resources such as CPU time and memory. Tier 2 SKIPPED reduced 0.005 (408) indicates that the AI evaluation tier was skipped, reducing an estimated 0.005 units of computational cost that would have been incurred by invoking the AI model inference API. The estimated cost is determined by a lookup in a cost table mapping gate types to estimated per-invocation costs, as described with reference to FIG. 2.
[0049] Iteration 2 (410) follows a similar pattern. The Tier 0 contains check again produces a failing result, as shown by Tier 0 contains FAIL (412). The executor terminates evaluation, causing Tier 1 SKIPPED reduced 0 (414) and Tier 2 SKIPPED reduced 0.005 (416) to be recorded in the decision log as part of a tier execution record. This iteration demonstrates that repeated failures at the instant tier can compound cost reduction across multiple feedback loop cycles. As described in the Interaction with Feedback Loops section, a feedback loop with N iterations where the first K iterations (where K<N) fail at the first cost tier saves K times the cost of one AI evaluation gate invocation.
[0050] In iteration 3 (418), the corrected output passes all quality gates. Tier 0 contains PASS (420) indicates that the pattern-matching check succeeded, allowing evaluation to proceed to the next tier. Tier 1 make check PASS (422) shows that a learned project-specific validation command executed successfully. This tool execution gate was discovered by the dynamic gate discovery engine 140 querying the agent memory system 150 for procedural memory entries associated with the project, as described in more detail with reference to FIG. 3. The “make check” command represents a project-specific build validation command that was injected into the composite quality gate configuration at the intermediate cost tier between pattern-matching gates and AI evaluation gates. Tier 2 model_eval PASS (424) indicates that the AI model inference evaluation also passed, where the AI model consumed input tokens (the quality rubric and the output) and produced output tokens (the evaluation result), incurring the computational cost recorded in the summary. The overall passing result for the composite gate allows the feedback loop to terminate successfully.
[0051] The summary (426) aggregates metrics across all iterations, corresponding to the cumulative cost summary maintained by the cost reduction tracker 130. Cost incurred (428) shows a value of 0.005 for one model evaluation invocation, representing the single AI inference call in iteration 3 when all gates passed. Cost reduced (430) shows a value of 0.010 for two skipped model evaluations, corresponding to the AI evaluations avoided in iterations 1 and 2 due to early termination at the instant tier. Savings percentage (432) displays 67%, computed as the reduced cost divided by the total potential cost (0.010 reduced divided by 0.015 total potential cost). Tier 0 catch rate (434) shows 67%, indicating that two of three iterations terminated at the instant tier using pattern-matching failures, demonstrating the effectiveness of cost-tiered evaluation in detecting defects before incurring AI inference costs. This per-tier catch rate metric enables visibility into computational pipeline cost optimization and can inform decisions about which types of quality gates are most effective for a given project context.Gate Cost Tier Classification
[0052] FIG. 5 illustrates a gate type hierarchy 500 and cost tier assignment, in accordance with some embodiments. The gate cost tier classifier 110 (FIG. 1) assigns each quality gate type to a cost tier according to a mapping.
[0053] In some embodiments, the first cost tier (instant tier) 504 includes one or more of the following gate types: a keyword presence check (also referred to herein as a “contains” gate) that verifies presence of one or more required keywords in the output; a keyword absence check (also referred to herein as a “not_contains” gate) that verifies absence of one or more forbidden keywords; a minimum length check that verifies the output meets a minimum character count; a blocked phrase check that verifies the output does not contain one or more phrases indicating the agent was unable to complete the task; a code block count check that verifies the output contains a minimum number of code blocks; a completion marker check that verifies presence of a success marker and absence of a failure marker; a deliverables check that verifies the output contains one or more expected deliverables; a template modification check that verifies the output differs from an input template; and a regular expression check that verifies the output matches a regular expression pattern.
[0054] In some embodiments, the second cost tier (local tool tier) 506 includes one or more tool execution gates. Each tool execution gate invokes an external validation tool (e.g., a linter, a type checker, a test suite, or a build command) on the output or on files produced by the AI agent. Tool execution gates consume compute resources (e.g., CPU time, memory) but do not consume AI model inference tokens.
[0055] In some embodiments, the third cost tier (AI evaluation tier) 508 includes one or more model evaluation gates. Each model evaluation gate invokes an AI model inference API to evaluate the output against a natural-language quality rubric. The AI model consumes input tokens (the rubric and the output) and produces output tokens (the evaluation result), incurring a computational cost per invocation.
[0056] In some embodiments, a composite gate containing a plurality of sub-gates is assigned a cost tier equal to a maximum cost tier among its sub-gates.Interaction with Feedback Loops
[0057] In some embodiments, the multi-agent computational pipeline includes one or more feedback loops. A feedback loop iterates between a correction phase and a verification phase, where the verification phase evaluates the corrected output against a quality gate. Each iteration of the feedback loop invokes quality gate evaluation.
[0058] With cost-tiered quality gate evaluation, early iterations that fail on pattern-matching gates at the first cost tier do not invoke AI evaluation gates at the third cost tier, reducing the per-iteration cost. In some embodiments, the cost reduction compound across iterations: a feedback loop with N iterations where the first K iterations (where K<N) fail at the first cost tier saves K times the cost of one AI evaluation gate invocation.
[0059] In some embodiments, a per-iteration cost limit is checked against the actual cost incurred during the iteration. Because tiered early termination may reduce the actual cost below a theoretical maximum, the cost limit check benefits from the reduced actual cost.Interaction with Gate Failure Analysis
[0060] In some embodiments, the system includes a two-tier failure analysis system comprising a first analysis tier (also referred to herein as “Tier A analysis”) that performs instant, configuration-aware analysis of gate failures, and a second analysis tier (also referred to herein as “Tier B analysis”) that performs AI-based root cause analysis of gate failures in a background thread.
[0061] In some embodiments, the cost tier at which a quality gate evaluation terminates informs the failure analysis. A termination at the first cost tier (pattern-matching failure) may trigger only Tier A analysis, which can provide targeted suggestions without AI inference cost. A termination at the third cost tier (AI evaluation failure) may trigger both Tier A and Tier B analysis for deeper root cause investigation.Example Computing Device
[0062] FIG. 6 illustrates an example computing device 600 suitable for implementing the systems and methods described herein, in accordance with some embodiments. The computing device 600 includes one or more processors 602 coupled to a memory 604 via a bus 606. The memory 604 stores instructions that, when executed by the one or more processors 602, cause the one or more processors 602 to perform the methods described herein.
[0063] In some embodiments, the computing device 600 further includes a storage device 608 (e.g., a solid-state drive or hard disk drive), a network interface 610 for communicating with AI model inference APIs and agent memory systems, and optionally one or more accelerators 612 (e.g., a graphics processing unit or a tensor processing unit).
[0064] In some embodiments, the computing device 600 is a cloud server, an edge computing device, or a personal computing device. The methods described herein may be performed by the computing device 600 alone or in combination with one or more remote computing devices accessed via the network interface 610.Remarks
[0065] The terms used in this description are used in their ordinary and customary meaning as would be understood by a person of ordinary skill in the relevant art, unless the term is explicitly defined herein. No special significance should be attributed to a term merely because it is elaborated upon herein, and no special significance should be attributed to the lack of elaboration regarding a term.
[0066] As used herein, the terms “comprise,”“comprising,”“include,”“including,” and grammatical variants thereof are intended to be non-limiting, such that recitation of items in a list is not to the exclusion of other like items that can be substituted or added to the listed items. The terms “one or more” and “at least one” with reference to an element are intended to include both the singular and the plural.
[0067] As used herein, the term “or” is intended to encompass both exclusive and inclusive cases, i.e., “A or B” is intended to be synonymous with “at least one of A and B,” unless the context clearly indicates otherwise. In some instances, “or” may be used to indicate alternatives that are mutually exclusive.
[0068] Use of the terms “a” and “an” in this description and the appended claims is intended to include both the singular and the plural. Where the context permits, singular includes plural and vice versa.
[0069] Unless specifically stated otherwise, or as is apparent from the discussion, terms such as “processing,”“computing,”“calculating,”“determining,” or the like refer to actions and / or processes of a computer or computing system, or similar electronic computing device, that manipulates and / or transforms data represented as physical, such as electronic, quantities within the computing system's registers and / or memories into other data similarly represented as physical quantities within the computing system's memories, registers, or other such information storage, transmission, or display devices.
[0070] Any claims using the phrase “means for” are intended to invoke 35 U.S.C. Section 112(f) and should be construed to cover the corresponding structure described in the specification and equivalents thereof. Claims that do not use “means for” are not intended to invoke Section 112(f) regardless of whether the word “for” appears in any other context.
[0071] The term “module” as used herein refers broadly to software, firmware, hardware, or any combination thereof. A software module may be implemented as a set of instructions stored in a non-transitory computer-readable medium and executable by one or more processors. A firmware module may be implemented as a set of instructions stored in a non-volatile memory device. A hardware module may be implemented as a circuit, an integrated circuit, an FPGA, or other physical component.
[0072] All patents, patent applications, and other references cited herein are incorporated by reference in their entirety for all purposes, except to the extent that any disclaimer or inconsistency would conflict with the present disclosure. In the event of a conflict between any incorporated reference and the present disclosure, the present disclosure controls.
[0073] The above description is illustrative and not restrictive. Many variations will become apparent to those of skill in the art upon review of this disclosure. The scope of the invention should be determined not by the above description, but by the appended claims, along with the full scope of equivalents to which such claims are entitled.
Claims
1. A computer-implemented method comprising:receiving, by one or more processors, an output produced by an artificial intelligence (AI) agent executing a phase of a multi-agent computational pipeline;classifying, by the one or more processors, a plurality of quality gate evaluations associated with the phase into one or more cost tiers based on a computational resource requirement of each quality gate evaluation,wherein the plurality of quality gate evaluations comprises at least a first quality gate evaluation classified into a first cost tier associated with a pattern-matching operation and a second quality gate evaluation classified into a second cost tier associated with an AI model inference operation, the second cost tier having a higher computational resource requirement than the first cost tier;ordering the plurality of quality gate evaluations by ascending cost tier to produce an ordered evaluation sequence;executing the plurality of quality gate evaluations according to the ordered evaluation sequence, beginning with the first quality gate evaluation in the first cost tier; andupon determining that the first quality gate evaluation in the first cost tier has produced a failing result, terminating execution of the second quality gate evaluation in the second cost tier.
2. The computer-implemented method of claim 1, wherein the plurality of quality gate evaluations are sub-gates of a composite quality gate, andwherein the composite quality gate specifies that all of the sub-gates must pass for the composite quality gate to pass.
3. The computer-implemented method of claim 2, wherein the ordering the plurality of quality gate evaluations comprises performing a stable sort of the sub-gates by ascending cost tier, the stable sort preserving a relative order of sub-gates within a given cost tier.
4. The computer-implemented method of claim 1, comprising:recording, in a decision log stored in a memory accessible to the one or more processors, a tier execution record, the tier execution record comprising:a termination tier identifying a cost tier at which execution of the ordered evaluation sequence was terminated,a count of quality gate evaluations executed,a count of quality gate evaluations skipped, andan estimated computational cost reduced by terminating execution of the second quality gate evaluation.
5. The computer-implemented method of claim 4, further comprising:maintaining a cumulative cost summary across a plurality of phases of the multi-agent computational pipeline, the cumulative cost summary comprising:a total computational cost incurred,a total estimated computational cost reduced, anda per-tier catch rate indicating a percentage of failures detected at each cost tier.
6. The computer-implemented method of claim 1, further comprising:querying, by the one or more processors, an agent memory system for one or more learned validation commands associated with a project context of the multi-agent computational pipeline;constructing, from the one or more learned validation commands, one or more tool execution quality gate evaluations, the one or more tool execution quality gate evaluations are classified into an intermediate cost tier between the first cost tier and the second cost tier; andinjecting the one or more tool execution quality gate evaluations into the plurality of quality gate evaluations before the ordering.
7. The computer-implemented method of claim 6, wherein querying the agent memory system comprises:transmitting a query specifying a memory type of procedural memory and a project identifier; andfiltering one or more returned entries by a confidence threshold,wherein returned entries of the one or more returned entries having a confidence score below the confidence threshold are excluded.
8. A system comprising:one or more processors; anda memory coupled to the one or more processors and storing instructions that, when executed by the one or more processors, cause the one or more processors to:receive an output produced by an artificial intelligence (AI) agent executing a phase of a multi-agent computational pipeline;classify a plurality of quality gate evaluations associated with the phase into one or more cost tiers based on a computational resource requirement of each quality gate evaluation,wherein the plurality of quality gate evaluations comprises at least a first quality gate evaluation classified into a first cost tier associated with a pattern-matching operation and a second quality gate evaluation classified into a second cost tier associated with an AI model inference operation, the second cost tier having a higher computational resource requirement than the first cost tier;order the plurality of quality gate evaluations by ascending cost tier to produce an ordered evaluation sequence;execute the plurality of quality gate evaluations according to the ordered evaluation sequence, beginning with the first quality gate evaluation in the first cost tier; andupon determining that the first quality gate evaluation in the first cost tier has produced a failing result, terminate execution of the second quality gate evaluation in the second cost tier.
9. The system of claim 8, wherein the plurality of quality gate evaluations are sub-gates of a composite quality gate, andwherein the composite quality gate specifies that all of the sub-gates must pass for the composite quality gate to pass.
10. The system of claim 9, wherein the instructions further cause the one or more processors to perform a stable sort of the sub-gates by ascending cost tier, the stable sort preserving a relative order of sub-gates within a given cost tier.
11. The system of claim 8, wherein the instructions further cause the one or more processors to:record, in a decision log stored in the memory, a tier execution record, the tier execution record comprising:a termination tier identifying a cost tier at which execution of the ordered evaluation sequence was terminated,a count of quality gate evaluations executed,a count of quality gate evaluations skipped, andan estimated computational cost reduced by terminating execution of the second quality gate evaluation.
12. The system of claim 8, wherein the instructions further cause the one or more processors to:maintain a cumulative cost summary across a plurality of phases of the multi-agent computational pipeline, the cumulative cost summary comprising a total computational cost incurred, a total estimated computational cost reduced, and a per-tier catch rate indicating a percentage of failures detected at each cost tier.
13. The system of claim 8, wherein the instructions further cause the one or more processors to:query an agent memory system for one or more learned validation commands associated with a project context of the multi-agent computational pipeline;construct, from the one or more learned validation commands, one or more tool execution quality gate evaluations, the one or more toll execution quality gate evaluations are classified into an intermediate cost tier between the first cost tier and the second cost tier; andinject the one or more tool execution quality gate evaluations into the plurality of quality gate evaluations before ordering.
14. The system of claim 8, wherein the instructions further cause the one or more processors to:transmit a query to an agent memory system specifying a memory type of procedural memory and a project identifier; andfilter one or more returned entries by a confidence threshold, wherein returned entries of the one or more returned entries having a confidence score below the confidence threshold are excluded.
15. A non-transitory computer-readable storage medium storing instructions that, when executed by one or more processors, cause the one or more processors to:receive an output produced by an artificial intelligence (AI) AI-agent executing a phase of a multi-agent computational pipeline;classify a plurality of quality gate evaluations associated with the phase into one or more cost tiers based on a computational resource requirement of each quality gate evaluation,wherein the plurality of quality gate evaluations comprises at least a first quality gate evaluation classified into a first cost tier associated with a pattern-matching operation and a second quality gate evaluation classified into a second cost tier associated with an AI model inference operation,the second cost tier having a higher computational resource requirement than the first cost tier, andwherein the plurality of quality gate evaluations are sub-gates of a composite quality gate, the composite quality gate specifying that at least one sub-gate must pass for the composite quality gate to pass;order the plurality of quality gate evaluations by ascending cost tier to produce an ordered evaluation sequence; andexecute the plurality of quality gate evaluations according to the ordered evaluation sequence, beginning with the first quality gate evaluation in the first cost tier.
16. The non-transitory computer-readable storage medium of claim 15, wherein the instructions cause the one or more processors to:upon determining that the first quality gate evaluation in the first cost tier has produced a passing result, terminate execution of the second quality gate evaluation in the second cost tier.
17. The non-transitory computer-readable storage medium of claim 16, wherein the executing and the terminating are performed in each iteration of a feedback loop, such that an iteration that fails at the first cost tier does not invoke the AI model inference operation at the second cost tier.
18. The non-transitory computer-readable storage medium of claim 15, wherein the ordering comprises sorting the plurality of quality gate evaluations by ascending cost tier using a stable sort that preserves a relative order of quality gate evaluations within a given cost tier.
19. The non-transitory computer-readable storage medium of claim 15, wherein the instructions cause the one or more processors to:record a tier execution record, the record tier execution record comprising:an identifier of a termination tier at which execution of the ordered evaluation sequence was terminated,a count of quality gate evaluations executed and a count of quality gate evaluations skipped, andan estimated computational cost reduced by the terminating.
20. The non-transitory computer-readable storage medium of claim 15, wherein the phase is part of a feedback loop that iterates between a correction phase and a verification phase.
Citation Information
Patent Citations
Methods and systems for derivation-based data backup
CN111880964A
Computationally efficient tiered inference for multiple fault diagnosis
US20100306587A1
Streaming physics collision detection in multithreaded rendering software pipeline
US20110283086A1
Nodal self-determination based on computational cost
WO2025234984A1
