adachsoft / agent-manager-lib
Manage AI agent definitions with CRUD, partial updates, cloning, and per-agent tool configurations
Requires
- php: ^8.3
- adachsoft/ai-agent-config-repository: ^0.6
- adachsoft/collection: ^3.0
Requires (Dev)
- adachsoft/php-code-style: ^0.7.4
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^12.5
- rector/rector: ^2.9
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A framework-independent PHP library for managing AI agent definitions stored by an adachsoft/ai-agent-config-repository implementation. It provides a small public API for application code to create, inspect, search, update, delete, and clone agents, including each agent's tool configuration directory.
Main capabilities
- Create and retrieve agent definitions.
- List or search agents by identifier, name, and description.
- Apply partial updates to existing definitions.
- Delete an agent definition without deleting its tool configuration directory.
- Clone an agent definition together with its per-agent tool configuration directory.
- Use the manager through an interface and construct it with a factory.
Requirements
- PHP 8.3 or later.
- An
AgentConfigRepositoryInterfaceimplementation fromadachsoft/ai-agent-config-repository. - A base directory for per-agent tool configuration directories.
Installation
Install the library with Composer:
composer require adachsoft/agent-manager-lib
Your application must also provide an implementation of AgentConfigRepositoryInterface from adachsoft/ai-agent-config-repository and a base directory for per-agent tool configuration directories.
Usage
Create the manager with AgentManagerFactory, then use the returned AgentManagerInterface in your application services. The repository implementation is responsible for storing agent definitions; the supplied base directory is used when cloning per-agent tool configuration.
Integration
use AdachSoft\AgentManagerLib\PublicApi\Factory\AgentManagerFactory;
use AdachSoft\AiAgentConfigRepository\PublicApi\Vo\AgentIdVo;
// $repository is an application-configured AgentConfigRepositoryInterface implementation.
$manager = AgentManagerFactory::create(
agentConfigRepository: $repository,
agentToolConfigsBaseDirectory: '/var/lib/my-app/agent-tool-configs',
);
$id = new AgentIdVo('assistant');
$manager->createAgent($id, [
'name' => 'Assistant',
'description' => 'Helps users with general questions.',
// Add the remaining fields required by your repository's agent definition schema.
]);
$agent = $manager->getAgent($id);
See the examples for additional operations and integration notes.