adachsoft / ai-agent-context-composer
Configuration-driven conversation context strategy composer for adachsoft/ai-agent.
Package info
gitlab.com/a.adach/ai-agent-context-composer
pkg:composer/adachsoft/ai-agent-context-composer
Requires
- php: >=8.3
- adachsoft/ai-agent: ^0.14
- adachsoft/ai-agent-context-message-injector: ^0.1.0
- adachsoft/collection: ^3.0
Requires (Dev)
- adachsoft/php-code-style: ^0.8.0
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^13
- rector/rector: ^2.9
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This package provides a configuration-driven conversation context strategy composer for adachsoft/ai-agent. It allows combining base strategies with multiple message injectors via declarative agent configuration, without requiring changes to the PHP code.
Requirements
- PHP 8.3 or later.
adachsoft/ai-agentand its required packages, installed through Composer.
Installation
composer require adachsoft/ai-agent-context-composer
Note: In the monorepo environment, this package is managed via path repositories.
Usage
To use this composer, the agent configuration should specify conversation_context_strategy_id as adachsoft.composable_conversation_context_strategy. The conversation_context_strategy_params should then define the base_strategy and the list of injectors to be applied.
License
This package is licensed under the MIT License.
Main capabilities
- Compose a registered base conversation context strategy with zero or more message injectors.
- Configure the base strategy and each content provider by alias, without changing application code.
- Validate strategy configuration and report invalid definitions or unknown registered aliases through dedicated exceptions.
Integration
Register ComposableConversationContextStrategy with the adachsoft/ai-agent conversation-context strategy mechanism under the identifier adachsoft.composable_conversation_context_strategy. Supply a BaseStrategyRegistry containing the base strategies available to your application and a ContentProviderRegistry containing the message content providers used by its injectors. The agent configuration then selects this strategy and provides the composition parameters. See the configuration example for a complete parameter shape.