- What is symfony/ai-bundle used for?
- It is an experimental Symfony integration bundle that wires Symfony AI components into a Symfony application. It provides configuration and service wiring for AI platforms, agents, tools, and vector stores through Symfony's dependency injection and framework configuration. It is part of Symfony AI and is not covered by Symfony's backward compatibility promise.
- How do I install symfony/ai-bundle?
- Install it with Composer using composer require symfony/ai-bundle. You then configure AI features through Symfony framework configuration, such as platform services and agents. Ensure your application meets the Symfony 6.4+ and PHP 8.2+ requirements. The repository is a read-only sub-tree split, so issues and pull requests belong in the main symfony/ai repository.
- Does symfony/ai-bundle work with Laravel?
- No, it is a Symfony bundle built around Symfony dependency injection, Security, and Profiler systems, so it is not a Laravel package. Laravel developers would need a different integration or manual wiring of Symfony AI components, which is not the bundle's intended use. For Laravel applications, evaluate Laravel-specific AI packages instead.
- Which Symfony and PHP versions are required?
- The bundle targets Symfony 6.4+ and 7.x, with PHP 8.2+ needed for attributes and typed properties. Some features depend on Symfony capabilities such as ScopingHttpClient and attributes. Check that your target Symfony version is fully supported and that required features are enabled before adoption.
- How do I configure AI providers like OpenAI or Anthropic?
- Configure platform services through Symfony configuration, for example ai.platform.openai, and the bundle uses Symfony HttpClient for API calls. It abstracts providers behind ModelClientInterface so application code can stay provider-agnostic. You can add custom providers by implementing ModelClientInterface and registering a PlatformBridge. API keys should be managed through Symfony configuration or secrets.
- How are AI agents and tools registered in Symfony?
- Agents are configured as Symfony services, and tools can be declared with attributes such as #[AsTool] or through YAML configuration. A CompilerPass handles automatic service registration, reducing boilerplate. Tool arguments can use Symfony Validator and JSON schema generation. Use #[IsGrantedTool] to apply role-based access to tools.
- Is symfony/ai-bundle stable enough for production?
- It is explicitly experimental and is not covered by Symfony's backward compatibility promise. Core integration points follow Symfony patterns, but AI-specific features and service IDs may change. Production use requires pinning versions, testing upgrades, and isolating the risk. Benchmark vector stores and streaming features for performance in high-throughput applications.
- How does symfony/ai-bundle handle security for AI tools?
- It integrates with Symfony Security via #[IsGrantedTool] to restrict tool access by role. Misconfigured attributes could expose sensitive tools, so review tool permissions carefully. Vector stores may retain raw data, so encryption or access controls may be needed for GDPR or other compliance requirements.
- How can I debug or test AI interactions in Symfony?
- The bundle includes a Profiler DataCollector that tracks AI interactions, token usage, and errors. Testing requires mocking external AI APIs, which may need custom fixtures. Stateful agents with memory need careful test setup to avoid flakiness. Use Symfony test tooling and deterministic fakes where possible.
- What vector stores are supported and how do I add a custom one?
- It supports local stores like SQLite and Redis, cloud stores like Pinecone and Qdrant, and database-backed stores such as MariaDB and MongoDB via StoreFactory. You can extend StoreInterface or use TraceableStore for auditing. Custom stores should be registered as Symfony services. Consider latency for high-throughput applications.