Skip to content

Issue: SDK Discrepancy in Scheduled Workflow API β€” Missing actor and Inconsistent repeats Handling in PythonΒ #46

@nsgoneape

Description

@nsgoneape


🐞 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 actor as 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, and tenant, yet only recipient and tenant are actually handled.

πŸ”§ Recommendation:

  • Add an actor parameter to the Python SDK’s create() 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 repeats as 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 repeats optional in the Python SDK.

  • Default to one-time scheduling when scheduled_at is provided but repeats is 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions