Skip to content
Sign up

Schedule Agent Message

agents.schedule.create(stragent_id, ScheduleCreateParams**kwargs) -> ScheduleCreateResponse
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
agent_id: str
messages: Iterable[Message]
content: Union[Iterable[MessageContentUnionMember0], str]
Accepts one of the following:
Iterable[MessageContentUnionMember0]
Accepts one of the following:
class MessageContentUnionMember0UnionMember0:
text: str
signature: Optional[str]
type: Optional[Literal["text"]]
class MessageContentUnionMember0UnionMember1:
source: MessageContentUnionMember0UnionMember1Source
data: str
media_type: str
detail: Optional[str]
type: Optional[Literal["base64"]]
type: Literal["image"]
str
role: Literal["user", "assistant", "system"]
Accepts one of the following:
"user"
"assistant"
"system"
name: Optional[str]
otid: Optional[str]
sender_id: Optional[str]
type: Optional[Literal["message"]]
schedule: Schedule
Accepts one of the following:
class ScheduleUnionMember0:
scheduled_at: float
type: Optional[Literal["one-time"]]
class ScheduleUnionMember1:
cron_expression: str
type: Literal["recurring"]
callback_url: Optional[str]
include_return_message_types: Optional[List[Literal["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: Optional[float]
ReturnsExpand Collapse
class ScheduleCreateResponse:
id: str
next_scheduled_at: Optional[str]
Schedule Agent Message
import os
from letta_client import Letta

client = Letta(
    api_key=os.environ.get("LETTA_API_KEY"),  # This is the default and can be omitted
)
schedule = client.agents.schedule.create(
    agent_id="agent_id",
    messages=[{
        "content": [{
            "text": "text"
        }],
        "role": "user",
    }],
    schedule={
        "scheduled_at": 0
    },
)
print(schedule.id)
{
  "id": "id",
  "next_scheduled_at": "next_scheduled_at"
}
Returns Examples
{
  "id": "id",
  "next_scheduled_at": "next_scheduled_at"
}