adachsoft / ai-agent-factory
Build AI agents from configuration and provider credentials.
Requires
- php: ^8.3
- adachsoft/ai-agent: ^0.12
- adachsoft/ai-agent-config-repository: ^0.6
- adachsoft/ai-agent-context-window: ^0.3
- adachsoft/ai-integration: ^0.8
- adachsoft/ai-integration-open-ai-responses: ^0.1
- adachsoft/ai-tool-call: ^2.0
- adachsoft/collection: ^3.0
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- adachsoft/php-code-style: ^0.7
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^12.5
- rector/rector: ^2.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-10-01 07:41:50 UTC
README
adachsoft/ai-agent-factory builds running ai-agent facades from agent configuration definitions or configuration repositories.
Tool integration
use AdachSoft\AiAgentFactory\PublicApi\Builder\AiAgentFactoryBuilder;
use AdachSoft\AiAgentFactory\PublicApi\Runner\EphemeralAgentRunnerFactory;
use AdachSoft\AiToolCall\PublicApi\Builder\AiToolCallFacadeBuilder;
$factory = AiAgentFactoryBuilder::create()
->withProviderCredentials('openai/responses', $apiKey)
->build();
$agent = $factory->create($agentDefinition, AiToolCallFacadeBuilder::new()->build());
$response = EphemeralAgentRunnerFactory::create($agent)->run('Summarize this file.');
Application integration
Applications can provide an existing chat facade, context strategies, a conversation repository, and configuration repositories:
$factory = AiAgentFactoryBuilder::create()
->withToolCallingChatFacade($toolCallingChatFacade)
->withConversationContextStrategy($contextStrategy)
->withConversationRepository($conversationRepository)
->withAgentConfigRepository($agentConfigRepository)
->withSystemPromptRepository($systemPromptRepository)
->buildFromConfig();
$agent = $factory->createById($agentId, $aiToolCallFacade);
The library does not read environment variables or configuration files. Provider credentials are passed explicitly. To add a provider, implement ChatProviderFactoryInterface and register it with withChatProviderFactory().
End-to-end test
Copy .env.example to .env, set OPENAI_API_KEY, and run:
composer test:e2e
Unit tests and static analysis are available through composer test and composer stan.