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

# Create a new schedule

> Create a new schedule and register it with the scheduler.

Args:
    body (`CreateScheduleRequest`): Schedule configuration.
    user_id (`str`): Authenticated user ID.
    storage (`StorageBase`): Storage instance.
    scheduler (`SchedulerManager`): Scheduler manager.

Returns:
    `CreateScheduleResponse`:
        The ID of the newly created schedule.

Raises:
    `HTTPException`: 404 if the specified agent does not exist.



## OpenAPI

````yaml /versions/2.0.2/en/deploy/openapi.json post /schedule/
openapi: 3.1.0
info:
  title: AgentScope
  version: 2.0.1
servers: []
security: []
paths:
  /schedule/:
    post:
      tags:
        - schedule
      summary: Create a new schedule
      description: |-
        Create a new schedule and register it with the scheduler.

        Args:
            body (`CreateScheduleRequest`): Schedule configuration.
            user_id (`str`): Authenticated user ID.
            storage (`StorageBase`): Storage instance.
            scheduler (`SchedulerManager`): Scheduler manager.

        Returns:
            `CreateScheduleResponse`:
                The ID of the newly created schedule.

        Raises:
            `HTTPException`: 404 if the specified agent does not exist.
      operationId: create_schedule_schedule__post
      parameters:
        - name: x-user-id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Caller's user ID. Temporary header-based identity; will be
              replaced by JWT auth.
            title: X-User-Id
          description: >-
            Caller's user ID. Temporary header-based identity; will be replaced
            by JWT auth.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateScheduleRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateScheduleResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateScheduleRequest:
      properties:
        name:
          type: string
          title: Name
          description: Display name of the schedule.
        description:
          type: string
          title: Description
          description: Optional description.
          default: ''
        cron_expression:
          type: string
          title: Cron Expression
          description: Standard 5-field cron expression, e.g. '0 9 * * 1-5'.
        timezone:
          type: string
          title: Timezone
          description: IANA timezone name, e.g. 'America/New_York' or 'Asia/Shanghai'.
          default: UTC
        agent_id:
          type: string
          title: Agent Id
          description: Agent to run when the schedule fires.
        chat_model_config:
          $ref: '#/components/schemas/ChatModelConfig'
          description: Model configuration for the auto-created session.
        enabled:
          type: boolean
          title: Enabled
          description: Whether the schedule is active immediately after creation.
          default: true
        stateful:
          type: boolean
          title: Stateful
          description: If True, consecutive executions share the same session context.
          default: false
        permission_mode:
          $ref: '#/components/schemas/PermissionMode'
          description: Permission level for the agent during scheduled execution.
          default: dont_ask
      type: object
      required:
        - name
        - cron_expression
        - agent_id
        - chat_model_config
      title: CreateScheduleRequest
      description: Request body for creating a new schedule.
    CreateScheduleResponse:
      properties:
        schedule_id:
          type: string
          title: Schedule Id
          description: Server-assigned schedule identifier.
      type: object
      required:
        - schedule_id
      title: CreateScheduleResponse
      description: Response body after creating a schedule.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChatModelConfig:
      properties:
        type:
          type: string
          title: Type
        credential_id:
          type: string
          title: Credential Id
        model:
          type: string
          title: Model
        parameters:
          additionalProperties: true
          type: object
          title: Parameters
      type: object
      required:
        - type
        - credential_id
        - model
        - parameters
      title: ChatModelConfig
      description: The model configuration class.
    PermissionMode:
      type: string
      enum:
        - default
        - accept_edits
        - explore
        - bypass
        - dont_ask
      title: PermissionMode
      description: >-
        The mode of permission.


        Permission modes control how the system handles tool execution requests.

        Different modes are suitable for different scenarios:


        +---------------+--------------------------------------------------+--------------------------------+

        | Mode          | Behavior                                         | Use
        Case                       |

        +===============+==================================================+================================+

        | DEFAULT       | All operations require explicit permission       |
        Default mode, most secure      |

        |               | (unless there are explicit allow rules)         
        |                                |

        +---------------+--------------------------------------------------+--------------------------------+

        | ACCEPT_EDITS  | - Auto-allow file writes in working directories | User
        present, rapid iteration  |

        |               | - Auto-allow file reads in working directories  |
        development                    |

        |               | - Auto-allow filesystem commands (mkdir, rm, mv)
        |                                |

        |               | - Other operations follow normal rules          
        |                                |

        +---------------+--------------------------------------------------+--------------------------------+

        | EXPLORE       | Read-only mode:                                  |
        Exploring codebase, planning   |

        |               | - Allow: Read, Grep, Glob (read-only tools)     |
        implementation                 |

        |               | - Deny: Write, Edit, Bash (modification tools) 
        |                                |

        +---------------+--------------------------------------------------+--------------------------------+

        | BYPASS        | All operations automatically allowed             |
        Testing environment, sandbox,  |

        |               | (no permission checks)                           |
        fully trusted scenarios        |

        +---------------+--------------------------------------------------+--------------------------------+

        | DONT_ASK      | Convert all ASK decisions to DENY                |
        Scheduled tasks, background    |

        |               | (user not available to answer prompts)           |
        execution when user is away    |

        +---------------+--------------------------------------------------+--------------------------------+


        Attributes:
            DEFAULT: Default mode - requires explicit permission for each action
            ACCEPT_EDITS: Accept edits mode - automatically allows file edits within working directories
            EXPLORE: Explore mode - read-only, no writes or command execution allowed
            BYPASS: Bypass mode - allows all actions without permission checks
            DONT_ASK: Don't ask mode - converts all ASK decisions to DENY (for unattended execution)
    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

````