Releases: aipartnerup/apflow
Release 0.12.1
Added
- Implemented dependency validation and resolution utilities with corresponding unit tests
- Implemented user ownership validation for task linking and copying
- Added assertions for task_tree_id in TaskCreator tests
- Add project URLs for homepage and source in pyproject.toml
Changed
- Standardized parameter names in dependency validation functions and enhanced tests for task inclusion validation
- Updated circular dependency detection function signature and tests for consistency
- Refactored dependency validation and resolution logic for clarity and maintainability
- Remove unused imports from test files
- Update directory structure documentation for clarity and organization
- Simplified 'apflow serve' command usage in documentation
Fixed
- Improved dependency cycle and edge case handling in task linking/copying
Release 0.12.0
Added
-
Task Model Enhancements
-
Added
task_tree_idfield to TaskModel for managing task hierarchy and relationships -
Introduced
origin_typefield to track task origin (own, link, copy, reference, archive) -
Implemented
SchemaMigrationmodel to track migration history for schema evolution -
Added
has_referencesflag validation in task creation tests -
Executor Access Control System
-
Implemented executor access control via
APFLOW_EXTENSIONSenvironment variable -
Added functions to retrieve allowed executor IDs and filter available executors
-
Created new API endpoint (
/system/executors) to list available executors with restriction support -
Introduced CLI commands to list executors with various output formats (table, json, yaml)
-
Added permission checks in TaskManager to enforce executor access control during task execution
-
Comprehensive test coverage for executor permissions and API functionality
-
CLI Extension System Enhancements
-
Automatic Root Command Detection: All single functions registered via
@cli_registerare now automatically treated as root commands (e.g.,apflow version,apflow server --port 8000) -
Removed
root_commandparameter - no longer needed -
Functions are always root commands, classes are always groups
-
Simplified API:
@cli_register(name="hello")creates a root command automatically -
Group Extension Support: Added
groupparameter to@cli_registerdecorator for extending existing CLI groups -
Extend custom groups:
@cli_register(group="my-group", name="new-command") -
Extend built-in groups:
@cli_register(group="tasks", name="custom-action") -
Override subcommands:
@cli_register(group="my-group", name="existing", override=True) -
New
get_cli_group()Function: Convenient API for accessing and extending CLI groups -
Supports both registered extensions and built-in groups (tasks, config, etc.)
-
Usage:
group = get_cli_group("my-group"); @group.command() def new_cmd(): ... -
Clear error messages when group doesn't exist
-
Improved Override Behavior: Clear distinction between different override scenarios
-
name="my-group", override=True- Override entire group -
group="my-group", name="cmd", override=True- Override subcommand in group -
name="my-cmd", override=True- Override root command -
Comprehensive test coverage (8 tests) for all extension scenarios
-
CLI Documentation
-
Added comprehensive CLI documentation with configuration management guide (
cli/configuration.md) -
Created practical usage examples (
cli/examples.md) -
Developed detailed CLI usage guide covering installation, modes, and best practices (
cli.md) -
Introduced CLI documentation index for improved navigation
-
TaskCreator hanldeing different origin types
-
Added comprehensive tests for
TaskCreatormethods handling different origin types:
from_link,from_copy,from_archive, andfrom_mixedmethods. -
Removed create_task_copy* moethods
-
Includes test cases for single tasks, recursive trees, field overrides, dependency handling, and edge cases (error conditions, immutability).
Changed
-
TaskCreator Logic Refactoring
-
Refactored and clarified the logic for
from_link,from_copy,from_archive, andfrom_mixedmethods inTaskCreator. -
Improved type annotations, docstrings, and error handling for all task creation methods.
-
Enhanced dependency and subtree validation logic for recursive copy/link/archive operations.
-
Improved handling of parent/child relationships and task tree construction.
-
Updated internal helper methods for better maintainability and testability.
-
Extension Management Refactoring
-
Moved executor-related functions from
apflow.api.extensionstoapflow.core.extensions.managerfor better code organization -
Updated import paths across the entire codebase to reflect new structure
-
Enhanced TaskManager to load executors dynamically with permission checks
-
Improved on-demand extension loading for better performance and security
-
Decorator Override Logic
-
All
decorators.pyoverridelogic has been changed toforcelogic for consistency and clarity across the codebase. -
Task Execution Improvements
-
Enhanced task execution logic with improved error handling
-
Implemented priority grouping for better task scheduling
-
Optimized task tree retrieval using
task_tree_idwith fallback mechanism -
TaskRepository Refactored
-
Refactored task update methods in
TaskRepositoryfor improved maintainability and clarity. -
Use the method
task_update(self, task_id: str, **kwargs)instead of allupdate_task_*series functions. -
Refactored
TaskModeltoTaskModelTypeand enhanced task creation methods for better type safety and extensibility.
Fixed
- Database Schema Management
- Simplified TaskRepository initialization by removing custom column checks
- Added migration tests to ensure proper schema evolution and idempotent execution
- Improved database schema handling for more reliable operations
- Fixed edge cases in recursive copy/link/archive logic where tasks with external dependencies or disconnected subtrees could cause errors.
- Improved error messages for invalid task trees and dependency cycles.
Release 0.11.2
Added
- Fluent API (TaskBuilder) for streamlined task creation and execution documents
Changed
- Removed tasks command aliases from CLI documentation and implementation
Release 0.11.1
Added
- Distributed core enablement for multi-node orchestration (experimental)
- CLI: implement
task historycommand and add short aliases for all major tasks subcommands: list→ls,status→st,cancel→c,watch→w,history→hi- All aliases are documented and tested
- gRPC executor: support multiple backends and improved channel management
Changed
- Updated gRPC dependencies and test references from grpcio to grpclib
Release 0.11.0
Added
- Standard Installation Profile - New
[standard]extra providing recommended feature set - Combines A2A server, CLI tools, CrewAI, and LLM support in single installation command
- Installation:
pip install apflow[standard]orpip install -e ".[standard,dev]"for development - Simplifies setup for most common use cases without requiring manual feature selection
- Test Infrastructure Improvements
- Fixed event loop conflicts in pytest-asyncio test environment via ThreadPoolExecutor-based async isolation
- New test fixtures:
disable_api_for_testsfor API gateway testing,run_asynchelper for sync test context - All 59 CLI tests now passing without hangs (fixed exit code 130 issues)
- A2A tests excluded by default (added to pytest.ini ignore list since a2a is optional dependency)
- Full test suite stable: 861 tests passing
- Security Enhancement: Token Masking
- Improved token masking in CLI config display from 8-character preview to 3-character preview
- Prevents sensitive words from leaking in masked token display
- Example: "very-secret-token-12345" now masked as "ver..." instead of "very-sec..."
Changed
- Documentation Updates
- Updated README.md to highlight
[standard]as recommended installation option - Updated docs/development/setup.md to recommend
[standard,dev]for development environment - Enhanced installation documentation to explain standard profile benefits
- Improved test documentation with note about A2A tests being optional
- Added detailed [standard] configuration documentation in setup.md
- API Client Enhancement
- APIClient.list_tasks() now supports
offsetparameter for pagination beyond initial limit
Fixed
- Event Loop Conflict Resolution
- Fixed hangs in async CLI tests by implementing ThreadPoolExecutor-based event loop isolation in conftest.py
- Root cause: run_async_safe() was attempting nested event loop execution in pytest-asyncio context
- Solution: Patched run_async_safe() to use separate thread with independent event loop
- Resolves issue where @pytest.mark.asyncio + runner.invoke() caused tests to hang with exit code 130
TaskBuilder dependency coverage**
- Added tests for TaskBuilder handling multiple dependencies and multi-level dependency chains to prevent regressions when wiring dependent tasks.
- ConfigManager integration validation
- New integration test verifies
.envloading and dynamic hook registration work end-to-end viadistribute_task_tree. - CLI → API Gateway Architecture (Priority 2)
- New
APIClientclass (src/apflow/cli/api_client.py) for CLI to communicate with API server via HTTP - ConfigManager extended with API configuration:
api_server_url,api_auth_token,use_local_db,api_timeout,api_retry_attempts,api_retry_backoff - APIClient supports exponential backoff retry (configurable attempts and initial backoff)
- APIClient supports auth token injection via Bearer header
- Comprehensive error handling for connection failures, timeouts, and API errors with custom exception types
- Added
httpx>=0.27.0to CLI optional dependencies for HTTP communication - Integration tests for APIClient initialization, context manager, and ConfigManager API methods (8 tests)
- Enables single source of truth (API) for task data when both CLI and API are running
- Solves DuckDB concurrent write limitation (all writes go through API)
- Foundation for future protocol adapters (GraphQL, MQTT, WebSocket)
- CLI Command Layer Refactoring for API Gateway Integration
- Created
api_gateway_helper.pywith helper functions for transparent API usage and fallback to local database should_use_api(): Check if API is configuredget_api_client_if_configured(): Async context manager yielding APIClient when configured, None otherwiseapi_with_fallback_decorator(): Try API first, fall back to local database if unavailablelog_api_usage(): Log whether command is using API or local database- Refactored CLI task commands to use API gateway when configured:
tasks list: Supports API viaclient.list_tasks()with status and user filterstasks get: Supports API viaclient.get_task()tasks status: Supports API viaclient.get_task_status()tasks cancel: Supports API viaclient.cancel_task()- All commands automatically fall back to local database if API is not configured
- Graceful error handling with warning logs when API unavailable but fallback enabled
- Added property accessors to ConfigManager for convenience:
api_server_url,api_auth_token,use_local_db,api_timeout,api_retry_attempts,api_retry_backoff - Integration tests for CLI API gateway with fallback scenarios (13 tests)
- All existing CLI tests pass without modification (59 tests, backward compatible)
- CLI Configuration Management System with Multi-Location & Separated Secrets
- New
apflow configcommand with 13 subcommands for comprehensive configuration management - Basic Config:
set,get,unset,list,reset- Full CRUD operations with alias support - Token Management:
gen-token,verify-token- Generate and verify JWT tokens with role-based claims - Quick Setup:
init,init-server- Interactive wizard and one-command server setup - Utilities:
path,show-path,edit,validate- Config file management and validation - Multi-location configuration support:
- Priority 1 (highest):
APFLOW_CONFIG_DIRenvironment variable - Priority 2: Project-local
.data/directory (if in project with pyproject.toml/.git) - Priority 3: User-global
~/.aipartnerup/apflow/(default fallback) - Separated secrets architecture:
config.cli.yaml(600 permissions) - Unified configuration (all settings: api_server_url, timeouts, tokens, jwt_secret, etc.)- Single file with multi-location priority system (project-local and user-global)
- API server can also read from same multi-location config structure
gen-token --saveparameter to save tokens to config.cli.yaml- Token security: Automatic masking in all outputs, expiry validation, signature verification
- Alias support for convenience:
api-server/api-url→api_server_url,api-token/token→admin_auth_token apflow config validatechecks YAML syntax, API server connectivity, and token validityapflow config verify-tokendisplays token details (subject, issuer, expiry, role) with status indicatorsapflow config initprovides interactive wizard for first-time setup- Added
PyJWT>=2.8.0to CLI dependencies for JWT token support - 19 new tests for config persistence and CLI commands (all passing)
Release 0.10.0
Changed
- Refactor import paths from aipartnerupflow to apflow across test files
- Updated import statements in various test files to reflect the new module structure under apflow.
- Ensured all references to aipartnerupflow are replaced with apflow in test modules related to extensions, including but not limited to:
- crewai
- docker
- generate
- grpc
- http
- llm
- mcp
- ssh
- stdio
- websocket
- Adjusted integration tests to align with the new import paths.
Release 0.9.0
Added
-
Hook Execution Context for Database Access
-
New
get_hook_repository()function allows hooks to access database within task execution context -
New
get_hook_session()function provides direct access to database session in hooks -
Hooks now share the same database session/transaction as TaskManager (no need for separate sessions)
-
Auto-persistence for
task.inputsmodifications in pre-hooks (detected and saved automatically) -
Explicit repository methods available for other field modifications (name, priority, status, etc.)
-
Thread-safe context isolation using Python's
ContextVar(similar to Flask/Celery patterns) -
Added
set_hook_context()andclear_hook_context()internal functions for context management -
Exported to public API:
aipartnerupflow.get_hook_repositoryandaipartnerupflow.get_hook_session -
Added comprehensive test coverage (16 tests):
-
Hook context basic operations and lifecycle
-
Multiple hooks sharing same session instance
-
Hooks sharing transaction context and seeing uncommitted changes
-
Hooks cooperating via shared session
-
Auto-persistence of task.inputs modifications
-
Explicit field updates via repository methods
-
Database Session Safety Enhancements
-
Added
flag_modified()calls for all JSON fields (result, inputs, dependencies, params, schemas) to ensure SQLAlchemy detects in-place modifications -
Added
db.refresh()after critical status updates to ensure fresh data from database -
Added concurrent execution protection: same task_tree cannot run multiple times simultaneously
-
Returns
{"status": "already_running"}when attempting concurrent execution of same task tree -
Added 12 new tests for concurrent protection and JSON field persistence
-
CLI Extension Decorator (
cli_register) -
New
@cli_register()decorator for registering CLI extensions, similar to@executor_register() -
Decorator supports
name,help, andoverrideparameters -
Auto-derives command name from class name (converts
_to-) -
New
get_cli_registry()function to access registered CLI extensions -
CLI extensions are loaded from decorator registry before entry_points discovery
-
Added comprehensive test coverage (18 tests) for CLI extension decorators
-
Exception Handling Architecture
-
New exception hierarchy based on FastAPI/production framework best practices
-
ApflowErrorbase exception for all framework-specific errors -
BusinessErrorfor expected user/configuration errors (logged without stack traces) -
ValidationErrorfor input validation failures -
ConfigurationErrorfor missing configuration/dependencies -
SystemErrorfor unexpected system-level errors (logged with stack traces) -
ExecutorErrorfor executor runtime failures -
StorageErrorfor database/storage failures -
Created
core/execution/errors.pywith comprehensive exception documentation -
Created
docs/development/exception-handling-standards.mdwith implementation guidelines
Changed
-
Executor Error Handling Refactoring
-
All executors now raise exceptions instead of returning error dictionaries
-
Technical exceptions (TimeoutError, ConnectionError, etc.) now propagate naturally to TaskManager
-
Executors validate inputs and raise
ValidationErrororConfigurationErrorfor expected failures -
Updated executors:
DockerExecutor,GrpcExecutor,RestExecutor,SshExecutor,CommandExecutor,LLMExecutor -
TaskManager now catches all exceptions, marks tasks as failed, and logs appropriately based on exception type
-
BusinessErrorlogged without stack trace (clean logs), other exceptions logged with full stack trace -
CrewAI Executor/Batch Executor Renaming and Test Fixes
-
crewai/crew_manager.py→crewai/crewai_executor.py, with the class name updated toCrewaiExecutor -
crewai/batch_manager.py→crewai/batch_crewai_executor.py, with the class name updated toBatchCrewaiExecutor -
All related test cases (test_crewai_executor.py, test_batch_crewai_executor.py, etc.) have been batch-updated with corrected patch paths, mocks, imports, and class names to align with the new naming
-
Resolved AttributeError: module 'aipartnerupflow.extensions.crewai' has no attribute 'crew_manager' and similar test failures caused by the renaming
Release 0.8.0
Added
-
LLM Executor Integration
-
Added
LLMExecutor(llm_executor) for direct LLM interaction via LiteLLM -
Supports unified
modelparameter for 100+ providers (OpenAI, Anthropic, Gemini, etc.) -
Support for
stream=Truein inputs or context metadata for Server-Sent Events (SSE) -
Automatic API key handling via
LLMKeyConfigManageror environment variables -
Auto-registration via extensions mechanism
-
Added
[llm]optional dependency includinglitellm -
CLI: Plugin Mechanism for Extensions
-
Added
CLIExtensionclass to facilitate creating CLI subcommands in external projects. -
Implemented dynamic subcommands discovery using Python
entry_points(aipartnerupflow.cli_plugins). -
Allows projects like
aipartnerupflow-demoto register commands (e.g.,apflow users stat) without modifying the core library. -
Supports both full
typer.Typerapps and single-command callables as plugins. -
CLI: Improved Task Count Output
- Changed default output format of
apflow tasks countfromjsontotablefor better terminal readability.
Changed
- CLI: Simplified
apflow taskscommands apflow tasks countnow defaults to providing comprehensive database statistics grouped by status.- Removed redundant
--alland--statusflags fromcountcommand (database statistics are now the default). - Renamed
apflow tasks allcommand toapflow tasks listfor better alignment with API naming conventions. - Removed the legacy
apflow tasks listcommand (which only showed running tasks). - The new
apflow tasks listcommand now lists all tasks from the database with support for filtering and pagination.
Fixed
- Tests: Infrastructure and LLM Integration
- Updated
tests/conftest.pyto automatically load.envfile environment variables at the start of the test session. - Added auto-registration for
LLMExecutorin the testconftest.pyfixture. - Fixed
LLMExecutorintegration tests to correctly use real API keys from.envwhen available.
Release 0.7.3
Fixed
-
CLI: event-loop handling for async database operations
-
Ensured async database sessions and repositories are created and closed inside
the same event loop to avoid "no running event loop" and "Event loop is closed" errors -
Updated
apflow taskscommands to run async work in a safe context -
Added
nest_asynciosupport for nested event loops in test environments -
Logging: clean CLI output by default
-
Default log level for the library is now
ERRORto keep CLI output clean -
Support
LOG_LEVELandDEBUGenvironment variables to override logging when needed -
Debug logs can be enabled with
LOG_LEVEL=DEBUG apflow ... -
Extensions registration noise reduced
-
Demoted expected registration instantiation messages to
DEBUG(no longer printed by default) -
This prevents benign initialization messages from appearing during normal CLI runs
-
Miscellaneous
-
Added
nest_asyncioto CLI optional dependencies to improve compatibility in nested-loop contexts
Release 0.7.2
Fixed
-
Documentation Corrections for
schemas.methodField -
Clarified that
schemas.methodis a required field whenschemasis provided -
Updated documentation to explicitly state that
schemas.methodmust match an executor ID from the extensions registry -
Fixed all documentation examples to use real executor IDs instead of placeholder values
-
Updated examples across all documentation files:
-
docs/api/http.md: Replaced generic"executor_id"with concrete IDs like"system_info_executor","rest_executor","command_executor" -
docs/getting-started/quick-start.md: Updated all task examples to use valid executor IDs -
docs/guides/cli.md: Fixed CLI command examples with correct executor IDs -
docs/development/design/cli-design.md: Updated design documentation examples -
docs/development/setup.md: Fixed setup guide examples -
Fixed
generate_executor.pyLLM prompt to correctly instruct LLM to useschemas.method(notname) as executor ID -
Updated task structure examples in LLM prompt to reflect correct usage
-
API Endpoint Test Coverage
-
Added missing test cases for API endpoints:
-
test_jsonrpc_tasks_list: Teststasks.listendpoint with pagination -
test_jsonrpc_tasks_running_status: Teststasks.running.statusendpoint with array format -
test_jsonrpc_tasks_running_count: Teststasks.running.countendpoint -
test_jsonrpc_tasks_cancel: Teststasks.cancelendpoint with array format -
test_jsonrpc_tasks_generate: Teststasks.generateendpoint for task tree generation -
Fixed test parameter format issues:
-
tasks.running.statusandtasks.cancelnow correctly usetask_idsarray parameter instead of singletask_id -
Tests now expect array responses instead of single object responses
-
All API endpoints now have comprehensive test coverage
-
CLI Command Test Coverage
-
Added
test_tasks_watchtest cases fortasks watchCLI command -
Uses mock to avoid interactive
Livedisplay component issues in automated tests -
Tests parameter validation and basic functionality
-
Properly handles error messages in stderr
-
API Documentation Completeness
-
Added missing response example for
tasks.running.statusendpoint -
Includes complete response format with all fields (task_id, context_id, status, progress, error, is_running, timestamps)
-
Documents error cases (not_found, permission_denied)
-
Clarifies that method returns array format even for single task queries
Added
- Comprehensive Documentation Review
- Verified all documentation examples use valid executor IDs
- Ensured all examples are functional and can be parsed correctly
- Validated that all CLI commands have corresponding test cases
- Confirmed API endpoint documentation matches actual implementation