Skip to content
Sign up

Schedule Agent Message

client.agents.schedule.create(stringagentID, ScheduleCreateParams { messages, schedule, callback_url, 2 more } body, RequestOptionsoptions?): ScheduleCreateResponse { id, next_scheduled_at }
post/v1/agents/{agent_id}/schedule

Schedule a message to be sent by the agent at a specified time or on a recurring basis.

ParametersExpand Collapse
agentID: string
body: ScheduleCreateParams { messages, schedule, callback_url, 2 more }
messages: Array<Message>
content: Array<UnionMember0 { text, signature, type } | UnionMember1 { source, type } > | string
Accepts one of the following:
Array<UnionMember0 { text, signature, type } | UnionMember1 { source, type } >
UnionMember0 { text, signature, type }
text: string
signature?: string | null
type?: "text"
UnionMember1 { source, type }
source: Source { data, media_type, detail, type }
data: string
media_type: string
detail?: string
type?: "base64"
type: "image"
string
role: "user" | "assistant" | "system"
Accepts one of the following:
"user"
"assistant"
"system"
name?: string
otid?: string
sender_id?: string
type?: "message"
schedule: UnionMember0 { scheduled_at, type } | UnionMember1 { cron_expression, type }
Accepts one of the following:
UnionMember0 { scheduled_at, type }
scheduled_at: number
type?: "one-time"
UnionMember1 { cron_expression, type }
cron_expression: string
type: "recurring"
callback_url?: string
include_return_message_types?: Array<"system_message" | "user_message" | "assistant_message" | 6 more>
Accepts one of the following:
"system_message"
"user_message"
"assistant_message"
"reasoning_message"
"hidden_reasoning_message"
"tool_call_message"
"tool_return_message"
"approval_request_message"
"approval_response_message"
max_steps?: number
ReturnsExpand Collapse
ScheduleCreateResponse { id, next_scheduled_at }
id: string
next_scheduled_at?: string
Schedule Agent Message
import Letta from '@letta-ai/letta-client';

const client = new Letta({
  apiKey: process.env['LETTA_API_KEY'], // This is the default and can be omitted
});

const schedule = await client.agents.schedule.create('agent_id', {
  messages: [{ content: [{ text: 'text' }], role: 'user' }],
  schedule: { scheduled_at: 0 },
});

console.log(schedule.id);
{
  "id": "id",
  "next_scheduled_at": "next_scheduled_at"
}
Returns Examples
{
  "id": "id",
  "next_scheduled_at": "next_scheduled_at"
}