extensions/pi-a2a/SKILL.md
# pi-a2a Long-Running Tasks Skill ## Overview The pi-a2a extension supports **long-running tasks** that can execute for hours or days without timeouts. This is essential for: - Data processing pipelines - Batch operations - Research and aggregation tasks - External API jobs with unpredictable duration - Any A2A task that exceeds the standard timeout ## When to Use **Use long-running tasks when:** - Task execution time is unpredictable or known to exceed 10 minutes - The remote agent is proc
npx skillsauth add espennilsen/pi extensions/pi-a2aInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The pi-a2a extension supports long-running tasks that can execute for hours or days without timeouts. This is essential for:
Use long-running tasks when:
Don't use for:
Enable in settings.json:
{
"pi-a2a": {
"longRunningTasks": {
"enabled": true,
"maxTaskAgeHours": 168,
"resumeRetryAttempts": 3,
"resumeRetryDelayMs": 5000,
"pollingIntervalMs": 300000
}
}
}
```text
### Configuration Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `enabled` | boolean | `false` | Enable long-running task support |
| `maxTaskAgeHours` | number | `168` (7 days) | Maximum task retention period |
| `resumeRetryAttempts` | number | `3` | Retry attempts for resume failures |
| `resumeRetryDelayMs` | number | `5000` | Delay between retries |
| `pollingIntervalMs` | number | `300000` (5 min) | Hub polling interval |
## How It Works
### Architecture
┌─────────────────────────────────────────────────────────────┐ │ 1. Task Initiated │ │ - Task state saved to SQLite │ │ - Session ID assigned │ │ - Agent continues other work │ └─────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────┐ │ 2. Background Polling (every 5 min) │ │ - Checks hub for task completion │ │ - Detects state changes │ └─────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────┐ │ 3. Task Completes │ │ - State updated in SQLite │ │ - Resume request queued │ └─────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────┐ │ 4. Smart Resume Queue │ │ - Waits for agent to be idle │ │ - Processes one request at a time │ │ - Validates session ID (prevents stale callbacks) │ └─────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────┐ │ 5. Response Delivered │ │ - Completion message injected into chat │ │ - Task result available │ └─────────────────────────────────────────────────────────────┘
### Session Persistence
Tasks are stored in `db/a2a-long-running.db` with:
- `taskId` - A2A task identifier
- `contextId` - Conversation context
- `sessionId` - Pi session that owns the task
- `state` - Current task state
- `createdAt` / `lastUpdatedAt` - Timestamps
- `response` / `error` - Task result
### Resume Queue
The resume queue ensures responses are delivered at the right time:
1. **Agent Busy**: Queue the resume request
2. **Agent Idle**: Process immediately
3. **Session Mismatch**: Skip (task belongs to old session)
4. **Failure**: Retry with backoff (up to `resumeRetryAttempts`)
## Usage Patterns
### Pattern 1: Long-Running Data Processing
```typescript
// Send task to data processing agent
const result = await a2a_send({
agent: "data-processor",
message: "Process this 10GB dataset...",
});
// Agent continues other work immediately
// Task result delivered when processing completes (hours later)
// Start long-running pipeline
const pipelineTask = await a2a_send({
agent: "pipeline-orchestrator",
message: "Run full ETL pipeline",
});
// Check status periodically or wait for completion notification
// Result delivered automatically when pipeline finishes
// Start research task
const researchTask = await a2a_send({
agent: "research-agent",
message: "Aggregate all news about AI safety from past month",
});
// Agent can handle other requests while research runs
// Results delivered when aggregation completes
maxTaskAgeHours appropriately for your use case# View pending long-running tasks
sqlite3 db/a2a-long-running.db "SELECT task_id, state, created_at FROM long_running_tasks WHERE state NOT IN ('completed', 'failed');"
# View queued resume requests
sqlite3 db/a2a-long-running.db "SELECT task_id, priority, retry_count FROM resume_queue ORDER BY enqueued_at;"
long_running_task_saved - Task state persistedlong_running_task_completed - Task finishedresume_request_enqueued - Resume queuedresume_queue_processed - Response deliveredresume_queue_retry_scheduled - Retry scheduledlong_running_task_poll_error - Polling errorSymptoms: Task stuck in "working" state for extended period
Solutions:
pollingIntervalMs if hub is rate-limitedlong_running_task_poll_errorSymptoms: Task completed but response not delivered
Solutions:
resume_queue_* logsSymptoms: resume_queue_stale_session in logs
Cause: Task belongs to previous Pi session
Solutions:
maxTaskAgeHours if this occurs frequentlymaxTaskAgeHours){
"pi-a2a": {
"longRunningTasks": {
"enabled": true,
"maxTaskAgeHours": 24,
"resumeRetryAttempts": 5,
"pollingIntervalMs": 60000
}
}
}
{
"pi-a2a": {
"longRunningTasks": {
"enabled": true,
"maxTaskAgeHours": 168,
"resumeRetryAttempts": 3,
"pollingIntervalMs": 300000
}
}
}
{
"pi-a2a": {
"longRunningTasks": {
"enabled": false
}
}
}
taskTimeoutMs (default: 10 min)development
Orchestrate cmux terminal panes — split terminals, run parallel processes, read output from other panes, and use the built-in browser. Use when working inside cmux and you need to run a dev server, watch tests, spawn sub-agents, or preview web pages.
testing
Review UI designs and implementations for accessibility, consistency, usability, and visual quality. Use when asked to review a design, audit accessibility, check UI consistency, compare implementation against mockups, or evaluate a user interface.
tools
Create, review, and improve skills for Pi agents. A skill is a folder with a SKILL.md that teaches an agent specialized workflows, domain knowledge, or tool integrations. Use when asked to create a new skill, improve an existing skill, review a skill for quality, scaffold a skill from a workflow, or convert documentation into a skill. Also triggers on "make a skill for", "build a skill", "skill for [topic]", "teach the agent to", or "package this workflow as a skill".
development
Best practices for Remotion - Video creation in React