The AgentExecutorCronJob Object
The AgentExecutorCronJob Object
The AgentExecutorCronJob object represents a scheduled job in Agent Orbit that executes an agent at regular intervals based on a cron expression. It contains the following attributes:
Attributes
pythonCopy codeclass AgentExecutorCronJob:
id: str # Unique identifier for the cron job
agent_id: str # ID of the agent associated with the cron job
name: str # Name of the cron job
status: Literal["suspended", "running"] # Current status of the cron job
expression: str # Cron expression defining the schedule
execution_stream_address: str # Address of the execution stream
created: str # Timestamp when the cron job was created
modified: str # Timestamp when the cron job was last modifiedCron Expression
The expression field uses a cron expression to define the job's schedule. You can generate or validate cron expressions using tools like crontab.guru.
Example Usage
Here’s how you can work with the AgentExecutorCronJob object:
Retrieve a Cron Job
pythonCopy codeimport agentorbit
# Set your API key for authentication
agentorbit.api_key = "YOUR_API_KEY"
# Retrieve a specific AgentExecutorCronJob by ID
cron_job = agentorbit.AgentExecutorCronJob.retrieve(id="987e6543-b21a-98c7-f210-789432165000")
# Display the retrieved cron job details
print(f"Cron Job ID: {cron_job.id}")
print(f"Agent ID: {cron_job.agent_id}")
print(f"Name: {cron_job.name}")
print(f"Status: {cron_job.status}")
print(f"Cron Expression: {cron_job.expression}")
print(f"Execution Stream: {cron_job.execution_stream_address}")
print(f"Created: {cron_job.created}")
print(f"Last Modified: {cron_job.modified}")Last updated