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

# Schedule Agent Run Endpoint

> Schedule an agent to run via Mage AI.

- Creates a SCHEDULE trigger (time-based) if it doesn't exist
- Supports cron expressions and presets (@hourly, @daily, @weekly, @monthly)
- Lazily creates triggers on first schedule (not during agent creation)

Request body:
{
    "agent_id": "agent95",
    "user_id": "user@example.com",
    "session_id": "session_abc",
    "new_message": {"content": "Hello", "role": "user"},
    "run_mode": "single",  # optional
    "streaming": false,     # optional
    "agent_metadata": {},    # optional
    "schedule_interval": "@hourly",  # NEW: @hourly, @daily, @weekly, @monthly, or cron
    "start_time": "2026-02-13T10:30:00" 
}

Returns:
    Schedule information including run_id and status



## OpenAPI

````yaml /api-reference/openapi.json post /api/adk/schedule_run
openapi: 3.1.0
info:
  title: apowerb API
  description: REST API of the apowerb agentic framework (open-source edition).
  version: 0.1.2
  license:
    name: MIT
    url: https://github.com/apowerb/apowerb/blob/main/LICENSE
servers:
  - url: https://api.example.com
    description: Your apowerb instance
  - url: http://localhost:8000
    description: Local stack
security: []
paths:
  /api/adk/schedule_run:
    post:
      tags:
        - adk
      summary: Schedule Agent Run Endpoint
      description: >-
        Schedule an agent to run via Mage AI.


        - Creates a SCHEDULE trigger (time-based) if it doesn't exist

        - Supports cron expressions and presets (@hourly, @daily, @weekly,
        @monthly)

        - Lazily creates triggers on first schedule (not during agent creation)


        Request body:

        {
            "agent_id": "agent95",
            "user_id": "user@example.com",
            "session_id": "session_abc",
            "new_message": {"content": "Hello", "role": "user"},
            "run_mode": "single",  # optional
            "streaming": false,     # optional
            "agent_metadata": {},    # optional
            "schedule_interval": "@hourly",  # NEW: @hourly, @daily, @weekly, @monthly, or cron
            "start_time": "2026-02-13T10:30:00" 
        }


        Returns:
            Schedule information including run_id and status
      operationId: schedule_agent_run_endpoint_api_adk_schedule_run_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleAgentRunRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ScheduleAgentRunRequest:
      properties:
        agent_id:
          type: string
          title: Agent Id
        user_id:
          type: string
          title: User Id
        session_id:
          type: string
          title: Session Id
        new_message:
          additionalProperties: true
          type: object
          title: New Message
        run_mode:
          type: string
          title: Run Mode
          default: single
        streaming:
          type: boolean
          title: Streaming
          default: false
        agent_metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Agent Metadata
        schedule_interval:
          type: string
          title: Schedule Interval
          default: '@hourly'
        start_time:
          anyOf:
            - type: string
            - type: 'null'
          title: Start Time
      type: object
      required:
        - agent_id
        - user_id
        - session_id
        - new_message
      title: ScheduleAgentRunRequest
      description: Request schema for scheduling an agent run.
    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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

## Related topics

- [Run Agent Now Endpoint](/api-reference/adk/run-agent-now-endpoint.md)
- [Run Agent From Jwt Endpoint](/api-reference/adk/run-agent-from-jwt-endpoint.md)
- [Run Agent From Refresh Token Endpoint](/api-reference/adk/run-agent-from-refresh-token-endpoint.md)
- [List Schedule Runs](/api-reference/scheduler/list-schedule-runs.md)
- [Sessions and runs](/concepts/sessions-and-runs.md)
