Skip to content

Commit fab8f04

Browse files
brianstrauchclaude
authored andcommitted
Add @workflow.init decorator to python.md Key Concepts (#57)
* docs: add @workflow.init decorator to python.md Key Concepts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Apply suggestion from @brianstrauch * Update references/python/python.md --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 849d577 commit fab8f04

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

references/python/python.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ if __name__ == "__main__":
9898

9999
### Workflow Definition
100100
- Use `@workflow.defn` decorator on class
101+
- Put any state initialization logic in the `__init__` of your workflow class to guarantee that it happens before signals/updates arrive. If your state initialization logic requires the workflow parameters, then add the `@workflow.init` decorator and parameters to your `__init__`.
101102
- Use `@workflow.run` on the entry point method
102103
- Must be async (`async def`)
103104
- Use `@workflow.signal`, `@workflow.query`, `@workflow.update` for handlers

0 commit comments

Comments
 (0)