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

# Context Agent Run

> Run a preset context agent by agentOId. The agent's configuration (topK, rerank, sources, etc.) is loaded from the database. Runtime input only provides query and optional additionalContext.



## OpenAPI

````yaml post /api/v2/agents/context/run
openapi: 3.0.0
info:
  version: 1.0.0
  title: Octave API
  description: API for Octave workspace management and AI-powered content generation
servers:
  - url: https://app.octavehq.com
security:
  - ApiKeyAuth: []
paths:
  /api/v2/agents/context/run:
    post:
      tags:
        - Agents
        - Context
      summary: Context Agent Run
      description: >-
        Run a preset context agent by agentOId. The agent's configuration (topK,
        rerank, sources, etc.) is loaded from the database. Runtime input only
        provides query and optional additionalContext.
      operationId: runContextAgent
      requestBody:
        description: Context agent input (query + context)
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  minLength: 1
                  description: Question or task to fetch context for
                additionalContext:
                  type: object
                  nullable: true
                  properties:
                    person:
                      type: object
                      nullable: true
                      properties:
                        firstName:
                          type: string
                          nullable: true
                        lastName:
                          type: string
                          nullable: true
                        title:
                          type: string
                          nullable: true
                        email:
                          type: string
                          nullable: true
                          format: email
                        linkedInProfileUrl:
                          type: string
                          nullable: true
                          format: uri
                        crmContactId:
                          type: string
                          nullable: true
                        crmLeadId:
                          type: string
                          nullable: true
                        crmAccountId:
                          type: string
                          nullable: true
                      description: >-
                        Optional context about the person associated with the
                        query
                    company:
                      type: object
                      nullable: true
                      properties:
                        name:
                          type: string
                          nullable: true
                        domain:
                          type: string
                          nullable: true
                        linkedInProfileUrl:
                          type: string
                          nullable: true
                          format: uri
                        crmAccountId:
                          type: string
                          nullable: true
                      description: >-
                        Optional context about the company associated with the
                        query
                    details:
                      type: string
                      nullable: true
                      description: Free-form text providing additional context
                  description: Optional person/company/details to enhance search
                agentOId:
                  type: string
                  description: Agent OId for preset context configuration
                  example: agent_abc123
                runtimeContext:
                  type: string
                  minLength: 1
                  description: >-
                    Runtime context string — used as the query if 'query' is not
                    provided. Consistent with other agent type APIs (email,
                    content, enrich, etc.).
              required:
                - agentOId
              description: Context agent input with query and optional context
              example:
                agentOId: agent_abc123
                runtimeContext: How do you help with HIPAA compliance?
                additionalContext:
                  person:
                    firstName: John
                    lastName: Doe
                    title: CISO
                    email: john.doe@healthcare.com
                  company:
                    name: Healthcare Corp
                    domain: healthcare.com
                  details: Large healthcare provider in California
      responses:
        '200':
          description: Context agent run successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  _metadata:
                    $ref: '#/components/schemas/Metadata'
                  found:
                    type: boolean
                    description: Whether the operation was successful
                    example: true
                  message:
                    type: string
                    nullable: true
                    description: Message
                    example: Additional information
                  data:
                    $ref: '#/components/schemas/ContextAgentData'
                required:
                  - _metadata
                  - found
                  - data
        '400':
          description: Bad request - invalid input or agent type mismatch
          content:
            application/json:
              schema:
                type: object
                properties:
                  _metadata:
                    $ref: '#/components/schemas/Metadata'
                  message:
                    type: string
                required:
                  - _metadata
                  - message
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  _metadata:
                    $ref: '#/components/schemas/Metadata'
                  message:
                    type: string
                required:
                  - _metadata
                  - message
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  _metadata:
                    $ref: '#/components/schemas/Metadata'
                  message:
                    type: string
                required:
                  - _metadata
                  - message
      deprecated: false
components:
  schemas:
    Metadata:
      type: object
      properties:
        usage:
          type: number
          default: 0
          description: API usage
          example: 0
        requestId:
          type: string
          description: Request ID
          example: requestId
        message:
          type: string
          description: Message
          example: message
        timestamp:
          type: string
          description: Timestamp
          example: '2021-01-01T00:00:00.000Z'
      required:
        - requestId
        - timestamp
    ContextAgentData:
      type: object
      properties:
        documents:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - PERSONA
                  - USE_CASE
                  - REFERENCE_CUSTOMER
                  - PROOF_POINT
                  - SEGMENT
                  - COMPETITOR
                  - ALTERNATIVE
                  - BUYING_TRIGGER
                  - OBJECTION
                  - PRODUCT
                  - SERVICE
                  - PLAYBOOK
                  - HYPOTHESIS
                  - PERSON_LINKEDIN
                  - COMPANY_WEBSITE
                  - COMPANY_RESEARCH
                  - PERSON_RESEARCH
                  - WEB_SEARCH
                  - CRM_CONTEXT
                  - GLOBAL_RESOURCE
                  - WEBSITE_RESOURCE
                description: Type/source of this context document
              id:
                type: string
                description: >-
                  Unique identifier (oId for library entities, external_id for
                  resources)
              name:
                type: string
                nullable: true
                description: Name or title of the document
              data:
                type: object
                nullable: true
                additionalProperties:
                  nullable: true
                description: Document content/details
              score:
                type: number
                nullable: true
                minimum: 0
                maximum: 10
                description: >-
                  Reranking relevance score (0-10 scale) - only present if
                  reranking was applied
              reasoning:
                type: string
                nullable: true
                description: >-
                  Explanation of why this document is relevant (if
                  reasoning.perDocument enabled)
            required:
              - type
              - id
          description: Array of context documents
        reasoning:
          type: string
          nullable: true
          description: >-
            Overall summary of how documents help answer query (if
            reasoning.overall enabled)
      required:
        - documents
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````