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

# Create Agent Log

> Create an agent log entry.

Called by agent runners to report their actions. The log entry
is persisted to SurrealDB and published to NATS for real-time
streaming to connected mission control clients.

Returns:
    Created agent log entry with server-populated fields.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /projects/{project_id}/agents/{agent_id}/logs
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /projects/{project_id}/agents/{agent_id}/logs:
    post:
      tags:
        - agents
      summary: Create Agent Log
      description: |-
        Create an agent log entry.

        Called by agent runners to report their actions. The log entry
        is persisted to SurrealDB and published to NATS for real-time
        streaming to connected mission control clients.

        Returns:
            Created agent log entry with server-populated fields.
      operationId: agents-create_agent_log
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            title: Project Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentLogCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentLog'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentLogCreate:
      properties:
        log_type:
          $ref: '#/components/schemas/AgentLogType'
        message:
          type: string
          title: Message
        instance_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance Id
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
      type: object
      required:
        - log_type
        - message
      title: AgentLogCreate
      description: |-
        Request body for creating an agent log entry.

        Attributes:
            log_type: Category of this log entry.
            message: Human-readable description of what happened.
            instance_id: Agent instance that produced this log entry.
            metadata: Flexible payload (tool name, arguments, error details, etc.).
    AgentLog:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        agent_resource_id:
          type: string
          title: Agent Resource Id
        instance_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance Id
        log_type:
          $ref: '#/components/schemas/AgentLogType'
        message:
          type: string
          title: Message
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        expires_at:
          type: string
          format: date-time
          title: Expires At
      type: object
      required:
        - agent_resource_id
        - log_type
        - message
      title: AgentLog
      description: |-
        A recorded action or decision by an AI agent.

        Agent logs live inside each organization's SurrealDB namespace —
        the namespace is the organization boundary, so no per-record
        ``organization_id`` field is carried on the row.

        Attributes:
            id: SurrealDB record ID (populated by database).
            agent_resource_id: SurrealDB ID of the agent resource.
            instance_id: Agent instance that produced this log entry.
            log_type: Category of this log entry.
            message: Human-readable description of what happened.
            metadata: Flexible payload (tool name, arguments, error details, etc.).
            timestamp: When this action occurred.
            expires_at: When this log entry should be garbage collected.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentLogType:
      type: string
      enum:
        - trigger_fired
        - agent_started
        - agent_completed
        - agent_error
        - tool_call
        - tool_result
        - reasoning
        - decision
        - plan_created
        - plan_updated
        - step_started
        - step_completed
      title: AgentLogType
      description: Types of agent log entries.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````