-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Milestone
Description
Required prerequisites
- I have searched the Issue Tracker and Discussions that this hasn't already been reported. (+1 or comment there if it has.)
- Consider asking first in a Discussion.
Motivation
WorkforceCallback and its implementations (e.g., WorkforceLogger) are all synchronous (def). However, callbacks are frequently triggered inside async workflows. As async usage grows (logging, DB writes, async HTTP), synchronous callbacks may block the event loop and negatively impact scalability.
Solution
Refactor the WorkforceCallback interface and all implementations to be fully asynchronous:
- Change all callback methods to
async def - Update internal callback implementations and examples (e.g.,
WorkforceLogger) - Replace all callback invocation sites with
await cb.xxx(...) - Update related tests and documentation
This ensures callbacks support non-blocking I/O and align with the async-first direction of the Workforce architecture.
Impact Scope
workforce_callback.py(interface updates)WorkforceLoggerand other built-in callbacks- Callback invocation logic within
Workforce - Example callback usages and tests
- Public API docs & typing
Benefits
- Non-blocking callbacks allow async DB/logging/HTTP operations
- More consistent async API surface across Workforce
- Prevents unintended event-loop blocking
If maintainers agree with this direction, I’d be happy to submit the PR.
Alternatives
No response
Additional context
No response
Wendong-Fan and fengju0213
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status