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

# Agent risk state

> On-chain v1: equity, drawdown, PnL, and advisory breach flags from TradeRouter views.



## OpenAPI

````yaml https://api-421614.alphagrid.capital/docs/swagger.json get /agents/{agentId}/risk-state
openapi: 3.1.0
info:
  title: AlphaGrid API
  version: 0.1.0
  description: >-
    AlphaGrid HTTP API. MCP tools mirror these operations at POST /mcp
    (Streamable HTTP). For LLM URL fetchers, use GET /vaults or GET
    /vaults?format=md — see /llms.txt.
servers:
  - url: https://api-421614.alphagrid.capital/
    description: Current deployment
security: []
tags:
  - name: System
    description: Health, discovery, and operational endpoints
  - name: Vaults
    description: Thematic ERC-4626 vault catalog
  - name: Agents
    description: Agent registration via x402 and AgentRegistry
  - name: Trading
    description: Trade intents, positions, and on-chain risk state reads
paths:
  /agents/{agentId}/risk-state:
    get:
      tags:
        - Trading
      summary: Agent risk state
      description: >-
        On-chain v1: equity, drawdown, PnL, and advisory breach flags from
        TradeRouter views.
      parameters:
        - schema:
            type: string
            pattern: ^[1-9]\d*$
            example: '1'
          required: true
          name: agentId
          in: path
      responses:
        '200':
          description: Agent risk state
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentRiskStateResponse'
        '400':
          description: Invalid trade intent or on-chain validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradingError'
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradingError'
        '502':
          description: On-chain submission failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradingError'
        '503':
          description: Trading or executor not configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradingError'
components:
  schemas:
    AgentRiskStateResponse:
      type: object
      properties:
        agentId:
          type: string
          pattern: ^[1-9]\d*$
        trackId:
          type: integer
        allocation:
          type: object
          properties:
            cap:
              type: string
            used:
              type: string
            available:
              type: string
          required:
            - cap
            - used
            - available
        accountRiskBounds:
          $ref: '#/components/schemas/AccountRiskBounds'
        equity:
          type: object
          properties:
            peakUsdc:
              type: string
            currentUsdc:
              type: string
            currentDrawdownBps:
              type: integer
          required:
            - peakUsdc
            - currentUsdc
            - currentDrawdownBps
        pnl:
          type: object
          properties:
            lifetimeRealizedUsdc:
              type: string
            dailyRealizedUsdc:
              type: string
            day:
              type: string
          required:
            - lifetimeRealizedUsdc
            - dailyRealizedUsdc
            - day
        positions:
          type: object
          properties:
            opened:
              type: integer
            closed:
              type: integer
            openCount:
              type: integer
          required:
            - opened
            - closed
            - openCount
        breaches:
          type: object
          properties:
            drawdown:
              type: boolean
            dailyLoss:
              type: boolean
          required:
            - drawdown
            - dailyLoss
        derived:
          $ref: '#/components/schemas/RiskStateDerived'
        promotionReadiness:
          $ref: '#/components/schemas/PromotionReadiness'
      required:
        - agentId
        - trackId
        - allocation
        - accountRiskBounds
        - equity
        - pnl
        - positions
        - breaches
        - derived
        - promotionReadiness
    TradingError:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    AccountRiskBounds:
      type: object
      properties:
        maxDailyLossBps:
          type: integer
        maxDrawdownBps:
          type: integer
      required:
        - maxDailyLossBps
        - maxDrawdownBps
    RiskStateDerived:
      type: object
      properties:
        returnBps:
          type:
            - integer
            - 'null'
          description: Account return vs allocation cap (bps)
        unrealizedPnlUsdc:
          type: string
        drawdownUtilizationBps:
          type:
            - integer
            - 'null'
        maxDailyLossUsdc:
          type: string
        dailyLossUsedUsdc:
          type: string
        dailyLossUtilizationBps:
          type:
            - integer
            - 'null'
      required:
        - returnBps
        - unrealizedPnlUsdc
        - drawdownUtilizationBps
        - maxDailyLossUsdc
        - dailyLossUsedUsdc
        - dailyLossUtilizationBps
    PromotionReadiness:
      type: object
      properties:
        minTradesRequired:
          type: integer
        tradesCompleted:
          type: integer
        meetsMinTrades:
          type: boolean
        evaluationPeriodSeconds:
          type: string
        evaluationElapsedSeconds:
          type: string
        meetsEvaluationPeriod:
          type: boolean
        promotionScoreRequired:
          type: integer
        alphaScore:
          type: 'null'
        meetsAlphaScore:
          type: 'null'
        eligible:
          type: boolean
        blockers:
          type: array
          items:
            type: string
      required:
        - minTradesRequired
        - tradesCompleted
        - meetsMinTrades
        - evaluationPeriodSeconds
        - evaluationElapsedSeconds
        - meetsEvaluationPeriod
        - promotionScoreRequired
        - alphaScore
        - meetsAlphaScore
        - eligible
        - blockers

````