/bankr-agent-dev:bankr-api-workflowfrom bankr-agent-dev
Implements the submit-poll-complete async job pattern for the Bankr Agent API, including polling loops, job status transitions, and rich data processing.
Ships in bankr-agent-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Complete reference for the asynchronous job pattern used by the Bankr Agent API.
1. SUBMIT -> POST /agent/prompt -> Get jobId + threadId
2. POLL -> GET /agent/job/{id} -> Check status every 2s
3. COMPLETE -> Terminal status -> Process response + richData
const response = await fetch(`${API_URL}/agent/prompt`, {
method: "POST",
headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({
prompt: "What is my ETH balance?",
threadId: "thr_XYZ789", // optional: continue conversation
}),
});
// → { success: true, jobId: "job_abc123", threadId: "thr_XYZ789", status: "pending" }
Request fields:
prompt (string, required): Natural language prompt (max 10,000 chars)threadId (string, optional): Continue existing conversation. Omit for new thread.const status = await fetch(`${API_URL}/agent/job/${jobId}`, {
headers: { "x-api-key": API_KEY },
});
const cancel = await fetch(`${API_URL}/agent/job/${jobId}/cancel`, {
method: "POST",
headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
});
| Status | Description | Action |
|---|---|---|
pending | Job queued, not started | Keep polling |
processing | Job running | Keep polling, show statusUpdates |
completed | Finished successfully | Read response and richData |
failed | Encountered error | Check error field |
cancelled | Was cancelled | No further action |
success, jobId, threadId, status, prompt, createdAtresponse — Natural language textrichData — Array of structured data (charts, social cards)transactions — Array of executed transactionscompletedAt, processingTimestatusUpdates — Array of { message, timestamp }startedAt, cancellableerror — Error messagecompletedAtcancelledAtasync function waitForCompletion(
jobId: string,
onProgress?: (message: string) => void
): Promise<JobStatusResponse> {
const POLL_INTERVAL = 2000; // 2 seconds
const MAX_POLLS = 150; // 5 minutes max
let lastUpdateCount = 0;
for (let i = 0; i < MAX_POLLS; i++) {
const status = await getJobStatus(jobId);
// Report new status updates
if (onProgress && status.statusUpdates) {
for (let j = lastUpdateCount; j < status.statusUpdates.length; j++) {
onProgress(status.statusUpdates[j].message);
}
lastUpdateCount = status.statusUpdates.length;
}
// Terminal states
if (["completed", "failed", "cancelled"].includes(status.status)) {
return status;
}
await new Promise((r) => setTimeout(r, POLL_INTERVAL));
}
throw new Error("Job timed out");
}
// Start a conversation
const first = await submitPrompt("What is the price of ETH?");
const threadId = first.threadId;
// Continue the conversation (agent remembers context)
const second = await submitPrompt("And what about BTC?", threadId);
// Each response includes the same threadId
Completed jobs may include richData:
type RichData = {
type?: string; // "social-card", "chart", etc.
[key: string]: unknown;
};
The response field always has a text summary regardless of richData content.
| Status | Error | Resolution |
|---|---|---|
| 400 | Invalid request / Prompt too long | Check input (max 10,000 chars) |
| 401 | Authentication required | Check API key |
| 403 | Agent API not enabled | Enable at bankr.bot/api |
| 404 | Job not found | Check jobId is correct |
| 429 | Rate limit exceeded | Wait for resetAt timestamp |
// Handle rate limits
if (response.status === 429) {
const error = await response.json();
const waitMs = error.resetAt - Date.now();
console.log(`Rate limited. Resets in ${Math.ceil(waitMs / 60000)} minutes`);
}
import { submitPrompt, waitForCompletion } from "./bankr-client";
async function main() {
// Submit
const { jobId } = await submitPrompt("Swap 0.1 ETH for USDC on Base");
console.log(`Job: ${jobId}`);
// Poll with progress
const result = await waitForCompletion(jobId, (msg) => {
console.log(`Progress: ${msg}`);
});
// Handle result
if (result.status === "completed") {
console.log(result.response);
for (const tx of result.transactions || []) {
console.log(`Transaction: ${tx.type}`);
}
} else if (result.status === "failed") {
console.error(`Failed: ${result.error}`);
}
}
bankr-api-basics - Endpoint documentation and TypeScript interfacesbankr-client-patterns - Reusable client code with execute() helperbankr-sign-submit-api - Synchronous endpoints (no polling needed)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
16 skills in this plugin
/bankr-api-basicsBankr Dev - API BasicsThis skill should be used when the user asks about "Bankr API", "Bankr Agent API", "how does Bankr work", "Bankr job status", "Bankr response format", or "building on Bankr". Provides endpoint documentation, job patterns, and TypeScript interfaces./bankr-arbitrary-transactionBankr Dev - Arbitrary TransactionsThis skill should be used when building apps that submit raw EVM transactions, custom contract calls, or need to execute pre-built calldata through Bankr. Covers JSON format, validation, and integration patterns./bankr-automationBankr Dev - AutomationThis skill should be used when building automated trading systems, implementing limit orders, or adding DCA/TWAP functionality. Covers limit orders, stop losses, DCA schedules, and TWAP execution./bankr-client-patternsBankr Dev - Client PatternsThis skill should be used when the user asks to "implement Bankr client", "write bankr-client.ts", "create API client for Bankr", "common files for Bankr project", "package.json for Bankr", "tsconfig for Bankr", "Bankr TypeScript patterns", "Bankr response types", or needs the reusable client code and common project files for Bankr API integrations./bankr-leverage-tradingBankr Dev - Leverage TradingThis skill should be used when building perpetual trading bots, implementing leverage functionality, or adding position management. Covers Avantis integration, long/short positions, and risk controls./bankr-market-researchBankr Dev - Market ResearchThis skill should be used when building market data displays, implementing price feeds, or adding technical analysis. Covers prices, market caps, technical analysis, sentiment, and trending tokens.npx claudepluginhub bankrbot/claude-plugins --plugin bankr-agent-dev