-
Notifications
You must be signed in to change notification settings - Fork 0
docs: async polling guide and SDK 0.6.0 examples #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add new async-polling.mdx page explaining the job-based API model - Update quickstart to show 202 responses and polling pattern - Update authentication to explain idempotency key's role in polling - Update concepts to note all graph generation is async - Add SDK SupermodelClient usage examples with polling configuration Closes supermodeltools/supermodel-public-api#336
|
Caution Review failedThe pull request is closed. WalkthroughAdds an async polling guide and updates docs to reflect asynchronous graph generation: submit with Idempotency-Key, receive 202 with jobId/retryAfter, poll by re-submitting the same key, and unified response envelope; navigation and concept texts updated; no public APIs changed. (≈40 words) Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client as Client
participant API as API Server
participant Queue as Job Queue
participant Worker as Worker
participant Store as Result Store
Client->>API: POST /graphs (Idempotency-Key)
API-->>Client: 202 Accepted (jobId, retryAfter)
API->>Queue: enqueue(jobId, payload)
Note over Queue,Worker: asynchronous processing
Worker->>Store: write result (jobId -> result)
Worker-->>Queue: mark job done
Client->>API: POST /graphs (same Idempotency-Key) — poll
API->>Store: fetch(jobId)
alt result available
API-->>Client: 200 OK (status: succeeded, result)
else still processing
API-->>Client: 202 Accepted (status: pending, retryAfter)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@async-polling.mdx`:
- Around line 116-126: The example config has two issues: the timeoutMs value
(600000) is inconsistent with the "5 minutes" comment and the AbortController is
missing; update timeoutMs to 300000 (or change the comment to "10 minutes") and
add a controller instance before creating the SupermodelClient (e.g., create an
AbortController and pass controller.signal into the client) so the referenced
controller.signal is defined and can be used to cancel polling (call
controller.abort() where appropriate); adjust comments accordingly.
🧹 Nitpick comments (2)
async-polling.mdx (1)
93-112: Heads up on Blob in Node.js.The
Blobconstructor exists natively in Node.js 18+, but if users are on an older version or using CommonJS, they might hit issues. Might be worth a quick note or showing the alternative:// Node.js 18+ (native Blob) const file = new Blob([zipBuffer], { type: 'application/zip' }); // Older Node.js versions // const { Blob } = require('buffer');Not a blocker — just something that could save a support ticket or two.
quickstart.mdx (1)
53-65: Quick clarification might help here.The polling requires re-uploading the zip file each time, which might surprise users coming from APIs where you poll a
/jobs/{id}endpoint. Maybe add a small note explaining why?Something like:
"Yes, you re-submit the file — the server uses your Idempotency-Key to find the existing job and won't re-process it."
Not a blocker, just might prevent some "wait, really?" moments.
- Fix comment: 600000ms is 10 minutes, not 5 - Define AbortController before referencing controller.signal
Integration Test Results - All EndpointsTested all 5 graph endpoints against production API following the documented async polling pattern. Test fixture: 4-file TypeScript project (main.ts, utils.ts, logger.ts, validator.ts) with imports, classes, and an intentionally dead function ( Flow VerifiedAll endpoints follow the documented pattern exactly:
Results by Endpoint
Response Envelope (actual)Initial submission (all 5 returned this shape): {
"status": "pending",
"jobId": "docs-test-dep-9C8C3CBC-9E99-4BE5-B9BC-36C06BE15772",
"retryAfter": 10,
"error": null,
"result": null
}After polling (example from dependency graph): {
"status": "completed",
"jobId": "docs-test-dep-9C8C3CBC-9E99-4BE5-B9BC-36C06BE15772",
"retryAfter": null,
"error": null,
"result": {
"generatedAt": "2026-01-24T18:11:27.032Z",
"message": "dependency graph generated successfully",
"stats": null,
"graph": {
"nodes": [...],
"relationships": [...]
}
}
}Documentation Accuracy Notes
All 5 endpoints are functional and match the documented contract. |
- Initial status is "pending" (not "processing") - retryAfter is 10 in production - Sequence diagram shows pending → processing → completed flow
Summary
SupermodelClientSDK examples with configurable polling behaviorTest plan
npx mintlify dev)/async-polling,/api-reference/...)@supermodeltools/sdk@0.6.0API surfaceCloses supermodeltools/supermodel-public-api#336
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.