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

# Get Experiment

> Return one experiment by opaque identifier.

Use this tool when a previous MCP call has already produced an
``experiment_id`` and the caller needs the current persisted experiment
object. The identifier is opaque and should be forwarded exactly as
returned by prior MCP responses.

When to Use:
    - Call this after any MCP route returns an ``experiment_id`` and the
      caller needs the latest persisted experiment state.
    - Call this instead of ``get_experiment_by_name`` when an ID is already
      available.

Constraints:
    - Treat ``experiment_id`` as opaque and forward it unchanged.
    - Access is limited to experiments visible to the authenticated caller.

Args:
    experiment_id: Experiment identifier from an earlier MCP call.
    user: Authenticated user resolved from the API key.
    db: Active database session.

Returns:
    The resolved experiment object for the caller scope.

Raises:
    HTTPException: Raised with ``404`` when the experiment is not available
        to the caller.



## OpenAPI

````yaml https://api.haiqu.ai/openapi.json get /ai/{experiment_id}
openapi: 3.1.0
info:
  title: Haiqu API
  summary: Haiqu RESTful API service.
  description: Cloud service providing the access to Haiqu cloud runtime
  contact:
    name: Haiqu Inc.
    url: https://haiqu.ai/
    email: info@haiqu.ai
  version: 1.4.0
servers: []
security: []
paths:
  /ai/{experiment_id}:
    get:
      summary: Get Experiment
      description: |-
        Return one experiment by opaque identifier.

        Use this tool when a previous MCP call has already produced an
        ``experiment_id`` and the caller needs the current persisted experiment
        object. The identifier is opaque and should be forwarded exactly as
        returned by prior MCP responses.

        When to Use:
            - Call this after any MCP route returns an ``experiment_id`` and the
              caller needs the latest persisted experiment state.
            - Call this instead of ``get_experiment_by_name`` when an ID is already
              available.

        Constraints:
            - Treat ``experiment_id`` as opaque and forward it unchanged.
            - Access is limited to experiments visible to the authenticated caller.

        Args:
            experiment_id: Experiment identifier from an earlier MCP call.
            user: Authenticated user resolved from the API key.
            db: Active database session.

        Returns:
            The resolved experiment object for the caller scope.

        Raises:
            HTTPException: Raised with ``404`` when the experiment is not available
                to the caller.
      operationId: get_experiment_by_id
      parameters:
        - name: experiment_id
          in: path
          required: true
          schema:
            type: string
            title: Experiment Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContextExperimentModel'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyQuery: []
        - APIKeyHeader: []
components:
  schemas:
    ContextExperimentModel:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          default: ''
        creation_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Creation Date
        tags:
          anyOf:
            - type: string
            - type: 'null'
          title: Tags
          default: ''
        circuits_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Circuits Count
          default: 0
        jobs_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Jobs Count
          default: 0
        last_action_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Action Date
        context:
          type: string
          title: Context
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          default: ''
      type: object
      required:
        - id
        - name
        - context
      title: ContextExperimentModel
      description: |-
        Represent an experiment with MCP-specific context metadata.

        ``description`` and ``creation_date`` remain optional for compatibility
        with legacy database rows.

        Attributes:
            description: Plain-text experiment description. Optional for legacy
                rows that still store ``NULL``.
            creation_date: Experiment creation timestamp. Optional for legacy rows
                that still store ``NULL``.
            context: Additional plain-text guidance for AI agents consuming the
                experiment.
            url: Dashboard URL for the experiment when available.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyQuery:
      type: apiKey
      in: query
      name: HAIQU_API_KEY
    APIKeyHeader:
      type: apiKey
      in: header
      name: authorization

````