Skip to content

Conversation

@natemort
Copy link
Member

What changed?

  • Add preliminary structure for scheduling activities within Workflow.
  • Invoking activity functions within a Workflow will schedule them as an activity.
  • DataConverter is no longer async so that it can be used outside of the main event loop.
  • CadenceError -> CadenceRpcError to indicate that it's the base error for all Rpc errors, not all errors the client may raise.
  • State machine restructure
    • State machines are split into multiple files and moved to workflow.statemachine
    • HistoryEvents are dispatched to state machines based on their class and a field specified in the decorator. This resolves the ambiguity in handling events and the custom handling needed for each type.
    • DecisionManager stores all state machines in a single ordered dictionary, and reorders it when state machines are manipulated. This is required for the decisions to be ordered correctly.
    • State machines interact with futures, completing them based on the history
    • Canceling the futures will cancel the activities/timers

Why?

  • Core workflow functionality

How did you test it?

  • Unit tests. We need the deterministic event loop and workflow execution supported before this can effectively be tested.

Potential risks

Release notes

Documentation Changes

@natemort natemort changed the title Support scheduling Activities within Workflows feat: Support scheduling Activities within Workflows Oct 22, 2025
name: str
type_hint: Type | None
default_value: Any | None
has_default: bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this field?

@natemort natemort force-pushed the schedule_activity branch 3 times, most recently from 2175a82 to d3576ce Compare October 29, 2025 22:11
async def from_data(
self, payload: Payload, type_hints: List[Type | None]
) -> List[Any]:
def from_data(self, payload: Payload, type_hints: List[Type | None]) -> List[Any]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember the original reason for making this async is to support blob retrieval. Is it no longer needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the DataConverter is async we can only use it within the main event loop. It's possible to keep it async but we would have to restructure how and when we convert values. When applying history events for example, we would need to convert all the resulting payloads first and then use them within the state machines.

I think we can explore making it async or introducing another concept in the future. For example, we could add some sort of processor that takes a Payload and returns a new Payload, potentially compressing, encoding, or even downloading the payload from a path. Then the converter still just operates on bytes.

@natemort natemort merged commit 9410b26 into cadence-workflow:main Nov 3, 2025
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants