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

# Evaluate a rule

> Evaluates a graph or policy from the release loaded by the Agent. Serves the same Rules API surface as BRMS, so clients can switch between BRMS and Agent without changes. Available since Agent 1.28.0; the legacy `/api/projects/{project}/evaluate/{key}` endpoint continues to work. A token is only required when the loaded release ships evaluation tokens: if none are scoped to the deployed target, requests are served without authentication; if at least one is, a matching `X-Access-Token` is required.



## OpenAPI

````yaml /openapi/agent.json post /api/rules/{project}/evaluate/{key}
openapi: 3.1.0
info:
  title: GoRules Agent API
  description: >-
    High-performance rule evaluation service. The Agent loads decision models
    from releases and executes them with minimal latency.
  contact:
    name: GoRules
    email: hi@gorules.io
  version: 1.28.0
servers:
  - url: https://agent.acme.com
    description: Your Agent deployment URL
security:
  - AccessToken: []
tags:
  - name: Rules
    description: >-
      Rules API - evaluation and OpenAPI discovery, matching the BRMS Rules API
      surface
  - name: Evaluation
    description: >-
      Legacy evaluation endpoints - still fully supported; new integrations
      should use the Rules API
  - name: Projects
    description: Project information
  - name: System
    description: Health and version endpoints
paths:
  /api/rules/{project}/evaluate/{key}:
    post:
      tags:
        - Rules
      summary: Evaluate a rule
      description: >-
        Evaluates a graph or policy from the release loaded by the Agent. Serves
        the same Rules API surface as BRMS, so clients can switch between BRMS
        and Agent without changes. Available since Agent 1.28.0; the legacy
        `/api/projects/{project}/evaluate/{key}` endpoint continues to work. A
        token is only required when the loaded release ships evaluation tokens:
        if none are scoped to the deployed target, requests are served without
        authentication; if at least one is, a matching `X-Access-Token` is
        required.
      operationId: rulesEvaluate
      parameters:
        - name: project
          in: path
          description: Project slug or ID
          required: true
          schema:
            type: string
          example: acme-lending
        - name: key
          in: path
          description: Document path of the graph or policy
          required: true
          schema:
            type: string
          example: loan-approval
      requestBody:
        description: Evaluation request with context data
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluateRequest'
            example:
              context:
                applicant:
                  creditScore: 760
                loan:
                  amount: 25000
              trace: false
        required: true
      responses:
        '200':
          description: >-
            Evaluation result. Includes a `meta` object describing the loaded
            release and an `X-Release-Id` response header when release metadata
            is available.
          content:
            application/json:
              schema:
                type: object
                properties:
                  performance:
                    type: string
                    description: Evaluation duration
                    example: 156.2µs
                  result:
                    type: object
                    description: Output of the evaluation
                    additionalProperties: true
                  trace:
                    type: object
                    description: Per-node trace (only when trace=true)
                    nullable: true
                  meta:
                    type: object
                    description: Project and release metadata for the loaded release
                    nullable: true
        '400':
          description: 'Invalid request or evaluation error: { code, details?, key? }'
        '401':
          description: Unauthorized - invalid or missing access token
        '404':
          description: Project or decision model not found
      security:
        - AccessToken: []
        - {}
components:
  schemas:
    EvaluateRequest:
      type: object
      description: Request body for decision evaluation
      required:
        - context
      properties:
        context:
          type: object
          description: >-
            Input data for the decision model. The structure depends on your
            decision model's expected input.
          additionalProperties: true
        trace:
          type: boolean
          nullable: true
          description: >-
            When true, includes detailed trace information in the response for
            debugging purposes.
          default: false
  securitySchemes:
    AccessToken:
      type: apiKey
      in: header
      name: X-Access-Token
      description: Evaluation token from project settings

````