How AI Agents Find Their Own Work
When the task queue is empty, Klawty agents scan their domain for work — emails, GitHub issues, analytics drops. Here's how discovery works without creating spam.
The idle agent problem
You deploy an agent. It processes its backlog. The backlog is empty. Now what?
In most frameworks, the agent sits idle until a human creates a new task or an API trigger fires. This defeats the purpose of autonomy. An agent that can't find its own work is just an API endpoint with a personality.
Discovery in AGENT.md
Every Klawty agent has a discovery prompt in its AGENT.md frontmatter:
discovery:
prompt: "Check Gmail for new client emails. Check tracker for overdue items. Check calendar for upcoming deadlines."
sources: [gmail, tracker-db, calendar]
daily_cap: 12
When the agent's task queue is empty, the runtime triggers a discovery cycle instead of a regular task cycle. The agent receives its discovery prompt and access to the specified sources. Its job: find work that needs doing.
What discovery looks like
Each agent scans a different domain:
Leila (Client Ops) — Scans Gmail for unread client emails. Checks the tracker database for overdue action items. Looks at the calendar for meetings that need prep.
Raph (Dev) — Scans GitHub repositories for new issues, failed CI runs, and open PRs that need review. Checks staging environments for deployment drift.
Zara (Marketing) — Checks Google Analytics for traffic drops. Reviews Search Console for new ranking opportunities. Looks for content gaps based on keyword data.
Falco (Finance) — Scans email for incoming invoices. Checks the financial tracker for overdue payments. Looks for recurring expenses that need processing.
From discovery to task
When an agent discovers work, it doesn't act on it immediately. It creates a task with evidence:
{
"agent": "leila",
"title": "Reply to Meridian — delivery date inquiry",
"priority": "high",
"field": "client-comms",
"evidence": "Email from [email protected] received 2026-02-26T08:14:00Z asking about delivery timeline for order #4821",
"source": "gmail-discovery"
}
The evidence field is critical. It forces the agent to justify why this task exists. A task without evidence is a hallucination. A task with a specific email ID, timestamp, and content summary is actionable.
The task enters the backlog with normal priority rules. On the next regular cycle, the agent picks it up and executes it with full context.
Why not act immediately?
Two reasons.
Dedup — Discovery runs on every idle cycle (potentially every 15 minutes). Without the task creation step, the agent would re-discover and re-act on the same email every cycle. By creating a task first, the 4-layer dedup system catches duplicates before they become actions.
Prioritization — A discovered task might be less urgent than a task assigned by a human or another agent. The task queue handles priority ordering. Discovery tasks compete fairly with manual tasks.
Daily caps
The daily_cap field prevents runaway discovery. If an agent finds 50 potential tasks in one scan (say, a Gmail inbox with 50 unread emails), it creates at most 12 tasks per day. The rest wait for tomorrow's discovery cycle.
SELECT COUNT(*) FROM tasks
WHERE agent = ?
AND json_extract(metadata, '$.source') LIKE '%-discovery'
AND created_at > datetime('now', '-24 hours');
If the count exceeds daily_cap, discovery stops for the day. This prevents an overflowing inbox from monopolizing the agent's entire work queue.
Discovery is what makes the difference between a tool that waits for instructions and a system that runs your operations. The agent finds the work, creates the task, and then executes it — all without a human opening a dashboard or typing a command.