Skip to content
Get started
Guides

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.

Every task consists of:

ComponentDescriptionRequired
NameHuman-readable identifierYes
PromptInstructions for the AIYes
ModelWhich AI model to useYes
ScheduleWhen to runYes
SourcesData connectionsNo
SkillsReusable instructionsNo
DestinationsWhere to deliver resultsNo
  1. Navigate to Tasks in the sidebar
  2. Click New Task
  3. Fill in the task details
  4. Click Create Task
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
});

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'
}

All times are in your organization’s configured timezone. Set your timezone in SettingsOrganization.

  1. Be Specific: Clearly describe what you want
  2. Provide Context: Explain why the task matters
  3. Define Output Format: Specify how results should be structured
  4. Set Boundaries: Clarify what to include/exclude

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.

Prompts can include dynamic variables:

Generate a {{frequency}} report for {{organization_name}}.
Today's date is {{current_date}}.

Sources give your task access to real-time data. When sources are attached, the AI can query them during execution.

// Attach sources when creating
const 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 task
await client.promptly.tasks.update(task.id, {
sources: ['source_slack_ghi789']
});

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.

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']
});
const tasks = await client.promptly.tasks.list();
for (const task of tasks.data) {
console.log(`${task.name}: ${task.isActive ? 'Active' : 'Paused'}`);
}
await client.promptly.tasks.update('task_abc123', {
prompt: 'Updated instructions...',
isActive: false // Pause the task
});
await client.promptly.tasks.delete('task_abc123');

Don’t wait for the schedule—run immediately:

const run = await client.promptly.tasks.run('task_abc123');
console.log('Run ID:', run.id);
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}`);
}
const allRuns = await client.promptly.runs.list({
organizationId: 'org_abc123',
limit: 50
});
StatusDescription
pendingScheduled, waiting to execute
runningCurrently executing
completedFinished successfully
failedEncountered an error

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);
}