Tasks
Create and manage scheduled AI tasks
Tasks are the core building block of 0ct. A task defines what you want AI to do, when to do it, where to get data from, and where to deliver results.
Task Components
Section titled “Task Components”Every task consists of:
| Component | Description | Required |
|---|---|---|
| Name | Human-readable identifier | Yes |
| Prompt | Instructions for the AI | Yes |
| Model | Which AI model to use | Yes |
| Schedule | When to run | Yes |
| Sources | Data connections | No |
| Skills | Reusable instructions | No |
| Destinations | Where to deliver results | No |
Creating a Task
Section titled “Creating a Task”Via Dashboard
Section titled “Via Dashboard”- Navigate to Tasks in the sidebar
- Click New Task
- Fill in the task details
- Click Create Task
Via SDK
Section titled “Via SDK”import Oct from '0ct';
const client = new Oct({ apiKey: process.env.OCT_API_KEY});
const task = await client.promptly.tasks.create({ name: 'Weekly Report', prompt: 'Generate a summary of this week\'s key metrics...', modelId: 'anthropic/claude-3-5-sonnet', frequency: 'weekly', scheduledDay: 'monday', scheduledTime: '09:00', isActive: true});Scheduling Options
Section titled “Scheduling Options”Frequency Types
Section titled “Frequency Types”Hourly: Run every N hours
{ frequency: 'hourly', hourlyInterval: 2 // Every 2 hours}Daily: Run once per day at a specific time
{ frequency: 'daily', scheduledTime: '09:00' // 9 AM}Weekly: Run on specific days
{ frequency: 'weekly', scheduledDay: 'monday', scheduledTime: '08:00'}One-time: Run once at a specific date/time
{ frequency: 'once', scheduledDate: '2026-02-15', scheduledTime: '15:00'}Timezone Handling
Section titled “Timezone Handling”All times are in your organization’s configured timezone. Set your timezone in Settings → Organization.
Prompt Engineering
Section titled “Prompt Engineering”Best Practices
Section titled “Best Practices”- Be Specific: Clearly describe what you want
- Provide Context: Explain why the task matters
- Define Output Format: Specify how results should be structured
- Set Boundaries: Clarify what to include/exclude
Example Prompts
Section titled “Example Prompts”Good Prompt:
Analyze our GitHub repository activity from the past week.
For each contributor, report:- Number of commits- Lines added/removed- Key changes made
Summarize overall team velocity and highlight any concerning trends.Format as a markdown report suitable for our weekly standup.Weak Prompt:
Tell me about our GitHub.Using Variables
Section titled “Using Variables”Prompts can include dynamic variables:
Generate a {{frequency}} report for {{organization_name}}.Today's date is {{current_date}}.Attaching Sources
Section titled “Attaching Sources”Sources give your task access to real-time data. When sources are attached, the AI can query them during execution.
// Attach sources when creatingconst task = await client.promptly.tasks.create({ name: 'Project Status', prompt: 'Summarize open issues and recent activity...', modelId: 'openai/gpt-4o', frequency: 'daily', scheduledTime: '09:00', sources: ['source_linear_abc123', 'source_github_def456']});
// Or update existing taskawait client.promptly.tasks.update(task.id, { sources: ['source_slack_ghi789']});Attaching Skills
Section titled “Attaching Skills”Skills provide reusable instructions that enhance your prompts:
const task = await client.promptly.tasks.create({ name: 'Customer Email', prompt: 'Draft a response to this customer inquiry...', modelId: 'anthropic/claude-3-5-sonnet', frequency: 'hourly', hourlyInterval: 1, skills: ['skill_writing_style', 'skill_product_knowledge']});Skills are prepended to your prompt, giving the AI consistent context.
Configuring Destinations
Section titled “Configuring Destinations”Destinations define where results are delivered:
const task = await client.promptly.tasks.create({ name: 'Daily Digest', prompt: 'Compile today\'s key updates...', modelId: 'openai/gpt-4o', frequency: 'daily', scheduledTime: '18:00', destinations: ['dest_email_team', 'dest_slack_channel']});Managing Tasks
Section titled “Managing Tasks”List All Tasks
Section titled “List All Tasks”const tasks = await client.promptly.tasks.list();
for (const task of tasks.data) { console.log(`${task.name}: ${task.isActive ? 'Active' : 'Paused'}`);}Update a Task
Section titled “Update a Task”await client.promptly.tasks.update('task_abc123', { prompt: 'Updated instructions...', isActive: false // Pause the task});Delete a Task
Section titled “Delete a Task”await client.promptly.tasks.delete('task_abc123');Trigger Manual Run
Section titled “Trigger Manual Run”Don’t wait for the schedule—run immediately:
const run = await client.promptly.tasks.run('task_abc123');console.log('Run ID:', run.id);Monitoring Runs
Section titled “Monitoring Runs”View Run History for a Task
Section titled “View Run History for a Task”const runs = await client.promptly.tasks.listRuns('task_abc123', { limit: 10});
for (const run of runs) { console.log(`${run.id}: ${run.status}`); console.log(`Tokens: ${run.tokensUsed}`);}View All Runs
Section titled “View All Runs”const allRuns = await client.promptly.runs.list({ organizationId: 'org_abc123', limit: 50});Run Statuses
Section titled “Run Statuses”| Status | Description |
|---|---|
pending | Scheduled, waiting to execute |
running | Currently executing |
completed | Finished successfully |
failed | Encountered an error |
Error Handling
Section titled “Error Handling”Tasks can fail for various reasons:
- Model API errors
- Source connection failures
- Destination delivery issues
- Prompt/response validation errors
Failed runs include error details:
const run = await client.promptly.runs.get('run_failed');
if (run.status === 'failed') { console.log('Error:', run.error);}Next Steps
Section titled “Next Steps”- Connect Sources - Give tasks access to your data
- Create Skills - Build reusable instructions
- Configure Destinations - Set up delivery channels