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

# Create Schedule

> Create a new schedule for recurring workflow execution for an agent.



## OpenAPI

````yaml https://agentex.dev-sgp.scale.com/openapi.json post /agents/{agent_id}/schedules
openapi: 3.1.0
info:
  title: Agentex API
  version: 0.1.0
servers: []
security: []
paths:
  /agents/{agent_id}/schedules:
    post:
      tags:
        - Schedules
      summary: Create Schedule
      description: Create a new schedule for recurring workflow execution for an agent.
      operationId: create_schedule_agents__agent_id__schedules_post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateScheduleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScheduleResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateScheduleRequest:
      properties:
        name:
          type: string
          maxLength: 64
          minLength: 1
          pattern: ^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$
          title: Schedule Name
          description: >-
            Human-readable name for the schedule (e.g., 'weekly-profiling').
            Will be combined with agent_id to form the full schedule_id.
        workflow_name:
          type: string
          title: Workflow Name
          description: Name of the Temporal workflow to execute (e.g., 'sae-orchestrator')
        task_queue:
          type: string
          title: Task Queue
          description: Temporal task queue where the agent's worker is listening
        workflow_params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Workflow Parameters
          description: Parameters to pass to the workflow
        cron_expression:
          anyOf:
            - type: string
            - type: 'null'
          title: Cron Expression
          description: >-
            Cron expression for scheduling (e.g., '0 0 * * 0' for weekly on
            Sunday)
        interval_seconds:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Interval Seconds
          description: Alternative to cron - run every N seconds
        execution_timeout_seconds:
          anyOf:
            - type: integer
              minimum: 1
            - type: 'null'
          title: Execution Timeout
          description: Maximum time in seconds for each workflow execution
        start_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Start At
          description: When the schedule should start being active
        end_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End At
          description: When the schedule should stop being active
        paused:
          type: boolean
          title: Paused
          description: Whether to create the schedule in a paused state
          default: false
      type: object
      required:
        - name
        - workflow_name
        - task_queue
      title: CreateScheduleRequest
      description: Request model for creating a new schedule for an agent
    ScheduleResponse:
      properties:
        schedule_id:
          type: string
          title: Schedule ID
          description: Unique identifier for the schedule
        name:
          type: string
          title: Schedule Name
          description: Human-readable name for the schedule
        agent_id:
          type: string
          title: Agent ID
          description: ID of the agent this schedule belongs to
        state:
          $ref: '#/components/schemas/ScheduleState'
          title: State
          description: Current state of the schedule
        action:
          $ref: '#/components/schemas/ScheduleActionInfo'
          title: Action
        spec:
          $ref: '#/components/schemas/ScheduleSpecInfo'
          title: Spec
          description: Schedule specification
        num_actions_taken:
          type: integer
          title: Number of Actions Taken
          description: Number of times the schedule has executed
          default: 0
        num_actions_missed:
          type: integer
          title: Number of Actions Missed
          description: Number of scheduled executions that were missed
          default: 0
        next_action_times:
          items:
            type: string
            format: date-time
          type: array
          title: Next Action Times
          description: Upcoming scheduled execution times
        last_action_time:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Action Time
          description: When the schedule last executed
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: When the schedule was created
      type: object
      required:
        - schedule_id
        - name
        - agent_id
        - state
        - action
        - spec
      title: ScheduleResponse
      description: Response model for schedule operations
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ScheduleState:
      type: string
      enum:
        - ACTIVE
        - PAUSED
      title: ScheduleState
      description: Schedule state enum
    ScheduleActionInfo:
      properties:
        workflow_name:
          type: string
          title: Workflow Name
          description: Name of the workflow being executed
        workflow_id_prefix:
          type: string
          title: Workflow ID Prefix
          description: Prefix for workflow execution IDs
        task_queue:
          type: string
          title: Task Queue
          description: Task queue for the workflow
        workflow_params:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
          title: Workflow Parameters
          description: Parameters passed to the workflow
      type: object
      required:
        - workflow_name
        - workflow_id_prefix
        - task_queue
      title: ScheduleActionInfo
      description: Information about the scheduled action
    ScheduleSpecInfo:
      properties:
        cron_expressions:
          items:
            type: string
          type: array
          title: Cron Expressions
          description: Cron expressions for the schedule
        intervals_seconds:
          items:
            type: integer
          type: array
          title: Interval Seconds
          description: Interval specifications in seconds
        start_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Start At
          description: When the schedule starts being active
        end_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End At
          description: When the schedule stops being active
      type: object
      title: ScheduleSpecInfo
      description: Information about the schedule specification
    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

````