Docs · guides
Missions - User Guide
Schedule AI agents to run work automatically — daily reports, weekly audits, cron jobs, and manual mission tasks.
Missions are scheduled AI tasks. Set up a mission, assign it to an agent, and it runs automatically on your schedule.
Use missions for recurring work: daily reports, weekly SEO audits, content publishing, data monitoring, and more. Missions appear in the org sidebar. Each mission has a working folder, chosen when you create it, that every run reads from and writes to.
Core Concepts
| Concept | Description |
|---|---|
| Mission | A named recurring or manually started work stream |
| Description | What the mission is for and what good output looks like |
| Schedule | When to run: manual or cron |
| Agent | Optional — runs the mission with this agent's role, model, skills, and MCP server access |
| Working folder | The folder every run works from (cwd, e.g. /marketing/seo). Relative paths in the description resolve from it |
| Task | A concrete mission item that can be started as work |
| Hooks | Shell scripts that run before or after each mission execution to control or validate runs |
Schedule Types
| Type | Description | Example |
|---|---|---|
| Manual | No cron schedule. Start mission tasks when needed | One-time setup task |
| Cron | Recurring server-side schedule | 0 9 * * MON (Mondays at 9am) |
Cron Examples
| Cron Expression | Description |
|---|---|
0 9 * * * | Every day at 9:00 AM |
0 9 * * MON | Every Monday at 9:00 AM |
0 9 * * 1-5 | Weekdays at 9:00 AM |
0 */6 * * * | Every 6 hours |
0 9 1 * * | First of every month at 9:00 AM |
Execution Model
Missions run via a job queue powered by BullMQ with Redis:
- 3 concurrent workers process missions in parallel
- Automatic retry: 2 attempts with exponential backoff on failure
- Stalled job detection: jobs that stop responding are recovered automatically
- Status flow:
pending->running->completed/failed
Mission runs work from the mission's working folder. The agent is the same organization-wide agent, with the same skills and MCP connections, whichever folder it works in.
Business Assessments and Run Reports
Every mission and assigned task asks the agent for a public conclusion and an updated business assessment. The assessment answers how the agent's area is doing, what works, what needs attention, and what to prioritize now and later. Agents are instructed to support judgments with evidence and keep unknown results explicit. Completing a task or publishing a file is not proof of business improvement.
Find the latest published assessment under State of mind on the agent's Overview. It includes the agent's confidence, a publication time, and a link to the source run. Only an accepted, completed run can update it; rejected or failed runs do not replace it. Later procedural reports leave the previous assessment available, and subsequent missions receive that assessment as context to reconcile with new evidence.
Recommended priorities are intentions until concrete work is assigned. Expand Mission history and schedule on the profile to review assignments, the next schedule, and individual mission reports.
Create a Mission
Via Web App
- Navigate to the Missions section in the sidebar
- Click + New Mission
- Configure:
- Title: "Weekly SEO Report"
- Goal: "Analyze this week's search performance. Compare to last week. Send the summary."
- Schedule: Cron —
0 9 * * MON - Agent: Select "Sarah" (optional)
- Working folder: Choose the folder, e.g.
/marketing/seo - Max Turns: 100 (optional)
- Team: auto (optional — controls subagent delegation)
- Save
Via CLI
teamday missions create \
--title "Weekly SEO Report" \
--description "Analyze this week's search performance, compare to last week, and summarize the findings." \
--schedule-cron "0 9 * * MON" \
--schedule-timezone "Europe/Bratislava" \
--agent-id <agent-id> \
--cwd /marketing/seo \
--task-title "Prepare this week's SEO report"
Discover the current CLI contract:
teamday missions create --help
teamday missions start --help
Via API
curl -X POST "https://app.teamday.ai/api/missions" \
-H "Authorization: Bearer $TEAMDAY_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Weekly SEO Report",
"description": "Analyze this week search performance, compare to last week, and summarize the findings.",
"cwd": "/marketing/seo",
"agent_id": "agent-sarah-id",
"schedule_cron": "0 9 * * MON",
"schedule_timezone": "Europe/Bratislava",
"initial_task": {
"title": "Prepare this week's SEO report"
}
}'
Response:
{
"mission": {
"id": "mission-xyz789",
"title": "Weekly SEO Report",
"status": "planning",
"schedule_cron": "0 9 * * MON",
"schedule_timezone": "Europe/Bratislava"
}
}
Mission Examples
Daily Data Summary
{
"title": "Daily Analytics Summary",
"description": "Pull yesterday's Google Analytics data. Report total visitors, top 5 pages, and bounce-rate change. Save to reports/daily/.",
"schedule_cron": "0 8 * * *",
"schedule_timezone": "Europe/Bratislava"
}
Weekly Content Audit
{
"title": "Weekly Content Audit",
"description": "Check all blog posts published this week for SEO compliance. Verify meta descriptions, image alt text, and internal links. Report any issues.",
"schedule_cron": "0 17 * * FRI",
"schedule_timezone": "Europe/Bratislava"
}
One-Time Setup
{
"title": "Initial SEO Baseline",
"description": "Run a comprehensive SEO audit of example.com. Document current rankings, backlinks, and technical issues. Save the baseline report to reports/."
}
Managing Missions
Update a Mission
Pause, change the schedule, or update the description:
curl -X PATCH "https://app.teamday.ai/api/missions/mission-xyz789" \
-H "Authorization: Bearer $TEAMDAY_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "paused",
"schedule_cron": "0 9 * * 1-5",
"schedule_timezone": "Europe/Bratislava"
}'
Mission Statuses
| Status | Description |
|---|---|
pending | Created, waiting for first scheduled run |
running | Currently executing |
completed | Finished successfully (one-time missions) |
failed | Execution failed (will retry if attempts remain) |
paused | Temporarily stopped by user |
Session Continuity
Missions support session continuity via the resumeSession flag. When enabled, each run resumes from the previous session's context using the stored lastSessionId, maintaining conversation history across runs.
This is useful for missions that build on previous results — like weekly reports that compare to last week, or monitoring tasks that track changes over time.
Agents and Missions
Binding an agent to a mission means:
- The mission runs with the agent's system prompt (
systemPrompt) - It uses the agent's model preference
- It has access to the agent's skills and MCP server references
If no agent is bound, the mission runs with default settings.
Best Practice
Create dedicated agents for mission types:
teamday agents create \
--name "Report Bot" \
--role "Automated Reporting" \
--system-prompt "You generate daily and weekly reports. Be concise. Use tables. Save reports to the reports/ directory with dated filenames."
Then bind it to multiple missions:
{"title": "Daily Sales Report", "agent_id": "report-bot-id", "schedule_cron": "0 8 * * *"}
{"title": "Weekly Performance Review", "agent_id": "report-bot-id", "schedule_cron": "0 9 * * MON"}
Writing Good Mission Descriptions
The mission description and task title are the instruction frame the agent receives. Write them like you'd brief a human colleague:
Vague (bad):
Check the website.
Specific (good):
Check example.com for broken links, missing meta descriptions, and pages with no H1 tag.
Save the results to reports/site-audit-{date}.md.
If critical issues are found, create a summary at the top.
Key tips:
- State the objective clearly
- Specify output format and location
- Include thresholds or criteria when relevant
- Mention what to do with the results
Hooks
Hooks are shell scripts that run at the boundary of each mission execution. Use them to skip runs when there is nothing to do, or to validate that the run produced expected output.
File placement
.teamday/missions/<mission-title-slug>/precheck.sh
.teamday/missions/<mission-title-slug>/postcheck.sh
The slug is your mission title lowercased with spaces replaced by hyphens — for example, a mission titled "Weekly SEO Report" uses .teamday/missions/weekly-seo-report/precheck.sh. Teamday also checks .teamday/missions/<mission-id>/ as a fallback when title-based lookup is ambiguous.
How hooks work
| Hook | When it runs | Exit 0 | Non-zero |
|---|---|---|---|
precheck.sh | After file sync, before the agent starts | Continues the run normally | Marks the occurrence as skipped — logs stdout/stderr as the reason, syncs any file changes, does not start the agent |
postcheck.sh | After the agent finishes, before artifact sync | Run marked completed | Run marked failed — hook output used as the error reason |
Both scripts run with the environment variables below; use TEAMDAY_CWD to locate the mission's working folder.
Environment variables
| Variable | Value |
|---|---|
TEAMDAY_LAST_RUN_AT | Unix timestamp of the previous scheduled occurrence, or 0 if this is the first run |
TEAMDAY_SCHEDULED_RUN_AT | Unix timestamp of the current occurrence |
TEAMDAY_MISSION_ID | Mission ID |
TEAMDAY_MISSION_TITLE | Mission title |
TEAMDAY_MISSION_TASK_ID | Current task ID |
TEAMDAY_CWD | Absolute path of the mission's working folder for this run |
TEAMDAY_WORKSPACE_ROOT | Absolute path of the root of the organization file tree (legacy name, kept for existing scripts) |
Example: skip when no new files have arrived
#!/bin/sh
# precheck.sh — skip the mission run if no files changed since last run
if [ "$TEAMDAY_LAST_RUN_AT" = "0" ]; then
echo "First run — proceeding"
exit 0
fi
# Find any file newer than the last run
NEW=$(find "$TEAMDAY_CWD" -newer /proc/1 -not -path '*/.git/*' | head -1)
if [ -z "$NEW" ]; then
echo "No new files since last run at $TEAMDAY_LAST_RUN_AT — skipping"
exit 1
fi
echo "New content found — proceeding"
exit 0
Make the script executable before committing:
chmod +x .teamday/missions/my-mission/precheck.sh
Next Steps
- Missions API Guide — Full API reference for mission management
- Folders and Files — Choose and prepare the folder a mission works in
- MCP Plugins — Connect external tools for mission use