import { APIResource } from "../../core/resource.mjs"; import * as AgentAPI from "./agent.mjs"; import { APIPromise } from "../../core/api-promise.mjs"; import { RequestOptions } from "../../internal/request-options.mjs"; /** * Operations for creating and managing scheduled agents */ export declare class Schedules extends APIResource { /** * Create a new scheduled agent that runs on a cron schedule. The agent will be * triggered automatically based on the cron expression. * * @example * ```ts * const scheduledAgentItem = * await client.agent.schedules.create({ * cron_schedule: '0 9 * * *', * name: 'Daily Code Review', * enabled: true, * prompt: * 'Review open pull requests and provide feedback', * }); * ``` */ create(body: ScheduleCreateParams, options?: RequestOptions): APIPromise; /** * Retrieve detailed information about a specific scheduled agent, including its * configuration, history, and next scheduled run time. * * @example * ```ts * const scheduledAgentItem = * await client.agent.schedules.retrieve('scheduleId'); * ``` */ retrieve(scheduleID: string, options?: RequestOptions): APIPromise; /** * Update an existing scheduled agent's configuration. All fields except * agent_config are required. * * @example * ```ts * const scheduledAgentItem = * await client.agent.schedules.update('scheduleId', { * cron_schedule: 'cron_schedule', * enabled: true, * name: 'name', * }); * ``` */ update(scheduleID: string, body: ScheduleUpdateParams, options?: RequestOptions): APIPromise; /** * Retrieve all scheduled agents accessible to the authenticated user. Results are * sorted alphabetically by name. * * @example * ```ts * const schedules = await client.agent.schedules.list(); * ``` */ list(options?: RequestOptions): APIPromise; /** * Delete a scheduled agent. This will stop all future scheduled runs. * * @example * ```ts * const schedule = await client.agent.schedules.delete( * 'scheduleId', * ); * ``` */ delete(scheduleID: string, options?: RequestOptions): APIPromise; /** * Pause a scheduled agent. The agent will not run until resumed. * * @example * ```ts * const scheduledAgentItem = * await client.agent.schedules.pause('scheduleId'); * ``` */ pause(scheduleID: string, options?: RequestOptions): APIPromise; /** * Resume a paused scheduled agent. The agent will start running according to its * cron schedule. * * @example * ```ts * const scheduledAgentItem = * await client.agent.schedules.resume('scheduleId'); * ``` */ resume(scheduleID: string, options?: RequestOptions): APIPromise; } /** * Scheduler-derived history metadata for a scheduled agent */ export interface ScheduledAgentHistoryItem { /** * Timestamp of the last successful run (RFC3339) */ last_ran?: string | null; /** * Timestamp of the next scheduled run (RFC3339) */ next_run?: string | null; } export interface ScheduledAgentItem { /** * Unique identifier for the scheduled agent */ id: string; /** * Timestamp when the schedule was created (RFC3339) */ created_at: string; /** * Cron expression defining when the agent runs (e.g., "0 9 \* \* \*" for daily at * 9am UTC) */ cron_schedule: string; /** * Whether the schedule is currently active */ enabled: boolean; /** * Human-readable name for the schedule */ name: string; /** * The prompt/instruction for the agent to execute */ prompt: string; /** * Timestamp when the schedule was last updated (RFC3339) */ updated_at: string; /** * Configuration for a cloud agent run */ agent_config?: AgentAPI.AmbientAgentConfig; created_by?: AgentAPI.UserProfile; /** * Configuration for a cloud environment used by scheduled agents */ environment?: AgentAPI.CloudEnvironmentConfig; /** * Scheduler-derived history metadata for a scheduled agent */ history?: ScheduledAgentHistoryItem; /** * Error message from the last failed spawn attempt, if any */ last_spawn_error?: string | null; /** * Ownership scope for a resource (team or personal) */ scope?: AgentAPI.Scope; updated_by?: AgentAPI.UserProfile; } export interface ScheduleListResponse { /** * List of scheduled agents */ schedules: Array; } export interface ScheduleDeleteResponse { /** * Whether the deletion was successful */ success: boolean; } export interface ScheduleCreateParams { /** * Cron expression defining when the agent runs (e.g., "0 9 \* \* \*" for daily at * 9am UTC) */ cron_schedule: string; /** * Human-readable name for the schedule */ name: string; /** * Configuration for a cloud agent run */ agent_config?: AgentAPI.AmbientAgentConfig; /** * Whether the schedule should be active immediately */ enabled?: boolean; /** * The prompt/instruction for the agent to execute. Required unless * agent_config.skill_spec is provided. */ prompt?: string; /** * Whether to create a team-owned schedule. Defaults to true for users on a single * team. */ team?: boolean; } export interface ScheduleUpdateParams { /** * Cron expression defining when the agent runs */ cron_schedule: string; /** * Whether the schedule should be active */ enabled: boolean; /** * Human-readable name for the schedule */ name: string; /** * Configuration for a cloud agent run */ agent_config?: AgentAPI.AmbientAgentConfig; /** * The prompt/instruction for the agent to execute. Required unless * agent_config.skill_spec is provided. */ prompt?: string; } export declare namespace Schedules { export { type ScheduledAgentHistoryItem as ScheduledAgentHistoryItem, type ScheduledAgentItem as ScheduledAgentItem, type ScheduleListResponse as ScheduleListResponse, type ScheduleDeleteResponse as ScheduleDeleteResponse, type ScheduleCreateParams as ScheduleCreateParams, type ScheduleUpdateParams as ScheduleUpdateParams, }; } //# sourceMappingURL=schedules.d.mts.map