-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Add optional stream() async generator to Executor and streaming: bool to ModuleAnnotations, enabling modules to produce incremental output.
Changes
ModuleAnnotations
- Added
streaming: bool = Falseto frozen dataclass
Executor.stream()
- New
async def stream(module_id, inputs?, context?) -> AsyncIterator[dict] - Steps 1-6 identical to
call_async()(context, safety, lookup, ACL, validate, before-middleware) - Inline async-aware middleware dispatch (matches
call_async()pattern withinspect.iscoroutinefunction) - If module has no
stream(): falls back to_execute_async(), yields single chunk - If module has
stream(): iterates it, yields each chunk, accumulates via{**accumulated, **chunk} - Output validation + after-middleware on accumulated result
- Error recovery via
_execute_on_error_async()
Tests (5 new)
- Fallback single chunk, multiple chunks, ModuleNotFoundError
- Before/after middleware ordering
- Disjoint-key shallow merge accumulation
Files Changed
src/apcore/module.py—streamingfieldsrc/apcore/executor.py—stream()methodtests/test_executor_stream.py— 5 new tests
Test Results
957 tests pass, 0 failures.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request