Integration guidelines
How an agent, script, or MCP client should watch for changes, poll, retry, and hold credentials so it stays within its limits.
Watch for changes with webhooks
To learn when something changes, subscribe an outbound webhook instead of listing tasks or posts on a timer. A webhook sends a signed POST to your endpoint when a subscribed event happens. Events cover posts, comments, reactions, projects, members, tasks, docs, canvases, time entries, and Chat. See Webhooks.
Post lists have no changed-since filter. A poller has to read whole pages again to find out what changed, while a webhook delivers the change itself. Task lists accept updatedSince, and notifications and audit logs accept a since timestamp. See API conventions.
Webhooks need a public HTTPS endpoint. To try one against a local server, pf webhooks listen forwards delivery records to it. See CLI webhooks.
handoff.created, handoff.status_changed, and handoff.updated. MCP events require a client with an approved callback receiver. For local agents, run pf handoffs wait as a background command; it polls outside the model and returns when work is ready.Poll slowly when you have to
- Use pf handoffs wait for a local background wait. For MCP-only polling, wait 30 seconds between checks and 60 seconds after an empty result; respect retryAfterSeconds.
- Read several statuses in one call with
statuses. The inbox allows two first-page polls a minute for each key or token and direction, and every status shares that budget. Faster polls returnrate_limit_exceeded. - For your own tasks, call
list_taskswithassigneeIdset tomeandupdatedSinceset to the largestupdatedAtyou have seen minus 5 seconds, skipping tasks you already have, and follownextCursoruntil it is null. Do not read the whole list again. A new comment does not changeupdatedAt, so for comments passsincetolist_task_comments. For notifications and audit logs, pass the time of your last read assince. For post lists, keep the last result you read and compare against it, and poll no more than once every five minutes. check_authreturns youruserId. Compare it with each task's assignee and each comment's author to skip your own writes.- Run one poller per credential. Two workers polling with the same key share its budget, and both get throttled.
- Under a scheduler, such as cron or an agent host schedule, run one bounded check per tick and exit. Do not start a loop that never ends. See Personal tool handoffs for a scheduled inbox check.
Keep one MCP session
- A client on the 2026 transport sends each request on its own and has no session to manage. Use it when your client supports it.
- A client that negotiates a 2025 protocol version gets a session from
initialize, whether it signs in with OAuth or an API token. Send itsMcp-Session-Idwith every later request. Do not callinitializeagain for each tool call. - When the run ends, send
DELETE /api/mcpwith the sameMcp-Session-Id. A session you leave open expires 24 hours after its last request. - Share one session per credential and workspace within a process. A session belongs to the workspace it was opened for, so a token that works across workspaces needs one session for each. Requests from every session on a key count against that key's limits.
See MCP transport for request examples.
Handle limits and retries
- HTTP 429
- Wait for the
Retry-Afterseconds, add a little random delay, and stop after a few attempts. See Rate limits. - rate_limit_exceeded from an MCP tool
- The tool call returns an error result with
retryAfterSeconds. Wait that long before calling the tool again. - A read fails with a server error or times out
- Retry it with exponential backoff. The pf CLI retries a read that gets a server error up to three times, but not a read that times out.
- A write fails with a server error or timeout
- Check whether the write went through before sending it again. Routes and tools that accept
idempotencyKeyorrequestKeyreturn the first result when you resend the same key. See API conventions for the routes that accept one. - A validation error
- Change the input. Sending the same request again returns the same error.
Before a batch job, check the remaining quota with GET /api/v1/limits, pf limits, or the get_limits tool. Slow down as the remaining count nears zero.
Make fewer calls
- Change up to 50 tasks in one call with
POST /api/v1/tasks/bulkor thebulk_update_taskstool. - Follow cursors page by page and stop once you have what you need. Do not read a list again from the start to find one item.
- In the CLI, ask for only the fields a script reads, such as
--json id,title,status. - Keep data that rarely changes, such as projects and members, for the length of a run instead of reading it before every call.
Give each agent its own credential
- Give each agent or tool its own API token or OAuth connection. Each key has its own rate limit, and a personal tool's handoff inbox belongs to the credential that registered it.
- All of one person's personal tokens share a limit of 2,000 requests a minute, so a busy agent on a personal token slows that person's other tools.
- Grant only the scopes the agent needs. An agent that only reads needs only read scopes. See Scopes and token types.
- Run unattended jobs on a workspace-owned service account.
- Keep keys in an environment variable or a secret store. Never put a key in source control, a shared log, or an agent's prompt. Revoke and replace a key that leaks.
Give the agent these rules
An agent follows rules it reads at the start of a session. Add these lines to AGENTS.md, CLAUDE.md, or the instruction file your agent reads. The MCP server also sends a short version of them to the client when it connects.
## Project Feed limits
- Use pf handoffs wait --json as a local background command to wait for work.
If only MCP is available, poll 30 seconds apart, or 60 seconds when empty.
- If the MCP client uses a 2025 protocol version, keep one session for the
whole run. Do not call initialize per tool call, and end the session with
DELETE /api/mcp when you finish. The 2026 transport has no session.
- After a rate-limit error, wait the seconds it reports before trying again.
- When you retry a write that accepts requestKey or idempotencyKey, send the
same value. For other writes, check whether the first attempt went through
before retrying.
- Use one background wait per receiving credential. Do not wrap pf handoffs list in a tight loop.
- Change up to 50 tasks with one bulk call instead of one call per task.