> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usedino.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents

> What Dino's quality modules test, how they work, and what they find.

Dino's architecture has **12** autonomous agents. Each agent owns one quality dimension of your API. They run independently and produce their own findings.

The **CLI pipeline** currently wires **seven** deterministic module names (including **`rest-fuzzer`**). Additional agents ship on their own cadence; the architecture stays the same.

## GraphQL quality modules

<CardGroup cols={2}>
  <Card title="Input Fuzzer" icon="shuffle">
    Test how your API handles bad input using five mutation strategies:

    * **Type coercion**: strings where integers are expected
    * **Boundary values**: MAX\_SAFE\_INTEGER, empty strings, zero, negatives
    * **Injection strings**: SQL injection, XSS payloads, GraphQL abuse
    * **Null and empty**: null arguments, empty arrays, missing required fields
    * **Malformed Unicode**: invalid UTF-8, zero-width characters
  </Card>

  <Card title="Response Validator" icon="check-double">
    Validates every response against the declared schema:

    * **Type mismatches**: field declared as `Int` returns string
    * **Unexpected nulls**: non-nullable field returns null
    * **Extra fields**: response contains undeclared fields
    * **Missing fields**: declared field absent from response
  </Card>

  <Card title="RBAC Matrix" icon="shield-halved">
    Tests every mutation against every role:

    * **No token**: request with no auth header
    * **Expired token**: past its TTL
    * **Wrong role**: valid token, unauthorised role
    * **Correct role**: should succeed

    Auto-skips if auth is not configured.
  </Card>

  <Card title="Rate Limit Validator" icon="gauge-high">
    Tests whether rate limiting is enforced:

    * Whether rate limiting exists at all
    * Approximate threshold before throttling
    * Presence of `X-RateLimit-*` and `Retry-After` headers
    * Proper 429 status codes
  </Card>

  <Card title="Error Code Validator" icon="triangle-exclamation">
    Validates error response quality:

    * **Format consistency**: Do all errors follow the same structure?
    * **Information leakage**: stack traces, file paths, internal state?
    * **GraphQL error classification**: proper `extensions.code` values?
    * **HTTP status codes**: appropriate 400 vs 500?
  </Card>

  <Card title="Deprecation Tracker" icon="clock-rotate-left">
    Tracks deprecation lifecycle:

    1. **Active** — field is live
    2. **Deprecated** — has `@deprecated` directive
    3. **Sunset** — scheduled for removal
    4. **Removed** — gone from schema

    Catches undocumented deprecations and missing directives.
  </Card>
</CardGroup>

## REST: `rest-fuzzer`

When OpenAPI-backed REST operations are present, the pipeline runs `rest-fuzzer`19 strategies across **six** attack surfaces:

| Surface          | Strategies | What it probes                                                                                                                     |
| ---------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| **Body**         | 5          | Type confusion, oversized payloads, deep nesting, null injection, SQL/XSS/NoSQL-style injection strings                            |
| **Path**         | 1          | Path parameter manipulation                                                                                                        |
| **Query**        | 1          | Query-string injection                                                                                                             |
| **Method**       | 1          | HTTP verb confusion                                                                                                                |
| **Content-Type** | 1          | MIME and parser edge cases                                                                                                         |
| **Schema**       | 6          | Enum bypass, format bypass, numeric boundaries, string length, mass assignment, `readOnly` injection                               |
| **Headers**      | 4          | Auth bypass strings (JWT `none`, empty bearer, SQL-in-header), host injection, IP spoofing across common proxy headers, CORS probe |

Quick CI presets may run a subset; full mode exercises the complete strategy set.

## REST: OpenAPI response validation (`validateResponseAgainstSpec`)

The **`validateResponseAgainstSpec`** function in `@dino/agents` compares a captured REST response to the OpenAPI document (inline JSON schemas). It returns six ordered checks:

| Check                     | Meaning                                                        |
| ------------------------- | -------------------------------------------------------------- |
| `STATUS_DOCUMENTED`       | HTTP status appears under `responses`                          |
| `CONTENT_TYPE_MATCH`      | Actual `Content-Type` aligns with the documented body          |
| `REQUIRED_FIELDS_PRESENT` | Required JSON properties are present                           |
| `NO_EXTRA_FIELDS`         | Response does not include undeclared properties                |
| `NO_WRITEONLY_EXPOSED`    | `writeOnly` Fields are not returned on read paths              |
| `BODY_TYPE_MATCH`         | JSON value kinds match the schema (string/number/object/array) |

<Info>
  This API is **shipped and tested** for programmatic use (for example, tying validators into your own runners). **`dino scan`** currently drives REST findings primarily through **`rest-fuzzer`** plus shared modules such as `error-code-validator` where REST traffic is exercised, not through a separate `rest-response-validator` tool name on the CLI.
</Info>

## More agents coming

Dino's architecture is built to support multiple quality dimensions: correctness, security, performance, compliance, and more. Each agent goes through the same quality pipeline before shipping: thousands of tests, false-output validation, and deterministic verification.

New agents ship with each release.

## How modules work together

Modules are independent. They do not share state, do not depend on each other, and do not run in a fixed order. The pipeline runs all selected modules and collects findings when they complete.

This means:

* A defect in one module cannot corrupt another's results
* You can turn off individual modules without affecting the rest
* New modules can be added without modifying existing ones
* Each module can be tested in complete isolation

<Tip>
  Run a single module: `dino scan --tools rest-fuzzer`

  Combine modules: `dino scan --tools input-fuzzer,rbac-matrix,rest-fuzzer`

  By default, all shipped modules run (subject to RBAC auto-skip rules).
</Tip>

## AI reasoning (optional)

On top of the deterministic modules, Dino offers AI reasoning strategies that analyse findings across modules:

| Strategy            | What it does                                                                          |
| ------------------- | ------------------------------------------------------------------------------------- |
| **Schema Change**   | Risk-assessing breaking changes with migration guidance.                              |
| **Coverage Gap**    | Identifies untested operations and recommends priorities                              |
| **Cross-Agent**     | Correlates findings across modules (e.g., auth bypass + error leak = compounded risk) |
| **API Description** | Generates descriptions for undocumented operations                                    |

AI reasoning is optional and requires `DINO_AI_KEY`. The deterministic engine always runs, AI enhances but never overrides.
