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

# Get agent definition

> Retrieve a single agent definition with its 10 most recent runs.

**Permission:** `agents:read` (Pro plan and above)




## OpenAPI

````yaml get /api/agents/{id}
openapi: 3.1.0
info:
  title: Dacard.ai API
  description: >
    Decision intelligence platform for AI-native product teams.

    Score, connect, and compound your product maturity across two original
    frameworks.
  version: 0.1.0
  contact:
    name: Darren Card
    email: darren@darrencard.com
    url: https://darrencard.com
  license:
    name: Proprietary
servers:
  - url: https://app.dacard.ai
    description: Production
  - url: http://localhost:3001
    description: Local development
security: []
tags:
  - name: Scoring
    description: AI maturity scoring engine
  - name: Lifecycle
    description: Development Lifecycle assessment
  - name: Products
    description: Product management and analytics
  - name: Dashboard
    description: Dashboard and suite analytics
  - name: Account
    description: Account and team management
  - name: Billing
    description: Stripe billing integration
  - name: User
    description: User profile, onboarding, and preferences
  - name: System
    description: Health checks and diagnostics
  - name: Internal
    description: Internal and admin endpoints (PQL tracking, demo data management)
  - name: Agents
    description: Agent Studio - autonomous AI agents, triggers, and artifacts
  - name: Intelligence
    description: Alerts, coaching context, and score timeline
  - name: Anomalies
    description: Signal anomaly detection, acknowledgment, and sensitivity overrides
  - name: Outcomes
    description: Longitudinal outcome observations for validation study (E2.2)
  - name: Settings
    description: User and account notification preferences
  - name: Webhooks
    description: Outbound webhook management
  - name: API Keys
    description: API key management (Team and Enterprise plans)
paths:
  /api/agents/{id}:
    get:
      tags:
        - Agents
      summary: Get agent definition
      description: |
        Retrieve a single agent definition with its 10 most recent runs.

        **Permission:** `agents:read` (Pro plan and above)
      operationId: getAgent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Agent definition ID
      responses:
        '200':
          description: Agent definition with recent runs
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    allOf:
                      - $ref: '#/components/schemas/AgentDefinition'
                      - type: object
                        properties:
                          recentRuns:
                            type: array
                            items:
                              $ref: '#/components/schemas/AgentRun'
        '401':
          description: Authentication required
        '404':
          description: Agent not found
      security:
        - clerkAuth: []
        - bearerAuth: []
components:
  schemas:
    AgentDefinition:
      type: object
      properties:
        id:
          type: string
          format: uuid
        accountId:
          type: string
          format: uuid
        agentType:
          type: string
          enum:
            - strategic_intelligence
            - anomaly_detection
            - competitive_monitor
            - coaching_digest
            - voc_analysis
            - strategy_brief
            - code_quality
            - spec_quality
        name:
          type: string
        description:
          type: string
        status:
          type: string
          enum:
            - active
            - paused
        config:
          $ref: '#/components/schemas/AgentConfig'
        lastRunAt:
          type: string
          format: date-time
          nullable: true
        lastRunStatus:
          type: string
          enum:
            - completed
            - failed
            - running
          nullable: true
        totalRuns:
          type: integer
        successRate:
          type: number
          description: Percentage of successful runs (0-100)
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    AgentRun:
      type: object
      properties:
        id:
          type: string
          format: uuid
        agentId:
          type: string
          format: uuid
        accountId:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - running
            - completed
            - failed
        triggerType:
          type: string
          enum:
            - schedule
            - event
            - manual
            - cron
        productId:
          type: string
          format: uuid
          nullable: true
        artifactsGenerated:
          type: integer
        tasksCompleted:
          type: integer
        totalTasks:
          type: integer
        tokensUsed:
          type: integer
          nullable: true
        errorMessage:
          type: string
          nullable: true
        startedAt:
          type: string
          format: date-time
        completedAt:
          type: string
          format: date-time
          nullable: true
        durationMs:
          type: integer
          nullable: true
    AgentConfig:
      type: object
      description: >-
        Agent-specific configuration (schedule, thresholds, notification
        settings)
      additionalProperties: true
      properties:
        schedule:
          type: string
          description: Cron expression for scheduled runs (e.g. "0 9 * * 1" for Monday 9am)
        notifySlack:
          type: boolean
          description: Whether to send Slack notifications on artifact creation
        productIds:
          type: array
          items:
            type: string
            format: uuid
          description: Limit the agent to specific products (empty means all products)
  securitySchemes:
    clerkAuth:
      type: apiKey
      in: cookie
      name: __session
      description: |
        Clerk session cookie. Authentication is handled by Clerk.
        Sign in at https://app.dacard.ai/sign-in to obtain a session.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        Clerk JWT session token. Obtain via Clerk's frontend SDK
        using `getToken()` or via the Clerk Backend API.

````