-
Notifications
You must be signed in to change notification settings - Fork 6
Description
π Issue: SDK Discrepancy in Scheduled Workflow API β Missing actor and Inconsistent repeats Handling in Python
Overview
There are two key inconsistencies between the Python and JavaScript (Node.js) SDKs for the createSchedules workflow API in Knock:
β Discrepancy 1: actor Not Supported in Python SDK
-
Node.js SDK explicitly allows passing an
actor:await knock.workflows.createSchedules(workflowKey, { recipients, scheduled_at, data, actor // β Supported }); -
Python SDK neither accepts
actoras a parameter nor includes it in the request payload:async def create(...): ... return await self._post("/v1/schedules", body={...}) # actor missing -
This is a functional gap. The Python SDK claims in its docstring to support inline identification for
actor,recipient, andtenant, yet onlyrecipientandtenantare actually handled.
π§ Recommendation:
-
Add an
actorparameter to the Python SDKβscreate()method. -
Ensure it is included in the request payload and transformed appropriately.
β Discrepancy 2: repeats is Required in Python but Optional in Node.js
-
Node.js SDK allows simple one-time schedules without specifying
repeats:await knock.workflows.createSchedules(workflowKey, { recipients, scheduled_at, data, actor }); -
Python SDK enforces
repeatsas a mandatory argument:async def create( *, recipients: List[RecipientRequestParam], repeats: Iterable[ScheduleRepeatRuleParam], # β Required ... ) -
This makes one-time scheduling more complex than necessary in Python, unlike the intuitive experience in JavaScript.
π§ Recommendation:
-
Make
repeatsoptional in the Python SDK. -
Default to one-time scheduling when
scheduled_atis provided butrepeatsis not.
π¨ Why This Matters
-
These inconsistencies lead to a fragmented developer experience across platforms.
-
Python developers currently face extra friction and functional limitations, even for common use cases like one-time workflows with an
actor. -
This violates the principle of SDK parity and can cause confusion, bugs, or incorrect implementation.
β Proposed Fix Summary
| Feature | Node.js SDK | Python SDK | Action Needed |
|---|---|---|---|
| actor | β Supported | β Missing | Add actor param + body support |
| repeats | β Optional | β Required | Make optional + default to one-time |