Skip to content

Commit 6cca01a

Browse files
committed
Create new AI Toolbox package for third-party tools
- Move Brave and Wikipedia tools from Agent to new Toolbox package - Create new symfony/ai-toolbox package with proper structure - Update namespaces from Symfony\AI\Agent\Toolbox\Tool to Symfony\AI\Toolbox\Tool - Add composer.json, PHPUnit, PHPStan configurations - Include documentation files (README, CHANGELOG, AGENTS.md, etc.) - Update examples and demo dependencies - Update demo configuration to use new namespaces - Add package to main README.md
1 parent c9f023e commit 6cca01a

23 files changed

+713
-12
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Symfony AI consists of several lower and higher level **components** and the res
1717
* **[Agent](src/agent/README.md)**: Framework for building AI agents that can interact with users and perform tasks.
1818
* **[Store](src/store/README.md)**: Data storage abstraction with indexing and retrieval for AI applications.
1919
* **[MCP SDK](src/mcp-sdk/README.md)**: SDK for [Model Context Protocol](https://modelcontextprotocol.io) enabling communication between AI agents and tools.
20+
* **[Toolbox](src/toolbox/README.md)**: Collection of third-party tools for AI agents including Brave Search and Wikipedia.
2021
* **Bundles**
2122
* **[AI Bundle](src/ai-bundle/README.md)**: Symfony integration for AI Platform, Store and Agent components.
2223
* **[MCP Bundle](src/mcp-bundle/README.md)**: Symfony integration for MCP SDK, allowing them to act as MCP servers or clients.

demo/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"php-http/discovery": "^1.20",
1414
"runtime/frankenphp-symfony": "^0.2.0",
1515
"symfony/ai-bundle": "@dev",
16+
"symfony/ai-toolbox": "@dev",
1617
"symfony/asset": "~7.3.0",
1718
"symfony/asset-mapper": "~7.3.0",
1819
"symfony/clock": "~7.3.0",

demo/config/packages/ai.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ai:
3838
text: 'Please answer the users question based on Wikipedia and provide a link to the article.'
3939
include_tools: true
4040
tools:
41-
- 'Symfony\AI\Agent\Toolbox\Tool\Wikipedia'
41+
- 'Symfony\AI\Toolbox\Tool\Wikipedia'
4242
audio:
4343
model:
4444
class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'
@@ -76,7 +76,7 @@ services:
7676
# Symfony\AI\Agent\Toolbox\Tool\OpenMeteo: ~
7777
# Symfony\AI\Agent\Toolbox\Tool\SerpApi:
7878
# $apiKey: '%env(SERP_API_KEY)%'
79-
Symfony\AI\Agent\Toolbox\Tool\Wikipedia: ~
79+
Symfony\AI\Toolbox\Tool\Wikipedia: ~
8080
Symfony\AI\Agent\Toolbox\Tool\SimilaritySearch:
8181
$vectorizer: '@ai.vectorizer.openai'
8282
$store: '@ai.store.chroma_db.symfonycon'

examples/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"symfony/ai-agent": "@dev",
2020
"symfony/ai-platform": "@dev",
2121
"symfony/ai-store": "@dev",
22+
"symfony/ai-toolbox": "@dev",
2223
"symfony/cache": "^7.3|^8.0",
2324
"symfony/console": "^7.3|^8.0",
2425
"symfony/css-selector": "^7.3|^8.0",

src/toolbox/.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/.gitattributes export-ignore
2+
/.gitignore export-ignore
3+
/phpunit.xml.dist export-ignore
4+
/phpstan.dist.neon export-ignore
5+
/tests export-ignore

src/toolbox/AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# AGENTS.md
2+
3+
## AI Agent Tools Package
4+
5+
This package provides third-party tools for AI agents including:
6+
7+
- **Brave Search**: Web search functionality using the Brave Search API
8+
- **Wikipedia**: Search and article retrieval from Wikipedia
9+
10+
### Usage
11+
12+
These tools can be registered with AI agents to provide external data access capabilities.
13+
14+
### Requirements
15+
16+
- PHP 8.2+
17+
- Brave Search API key (for Brave tool)
18+
- HTTP client implementation

src/toolbox/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# CHANGELOG
2+
3+
## [Unreleased]
4+
5+
### Added
6+
- Initial release of AI Toolbox package
7+
- Brave Search tool for web search functionality
8+
- Wikipedia tool for article search and retrieval
9+
- Test coverage for all tools
10+
- PHPStan static analysis configuration

src/toolbox/CLAUDE.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# CLAUDE.md
2+
3+
This package provides third-party tools for Symfony AI agents.
4+
5+
## Available Tools
6+
7+
### Brave Search Tool
8+
- Provides web search functionality via Brave Search API
9+
- Requires API key configuration
10+
- Returns formatted search results
11+
12+
### Wikipedia Tool
13+
- Searches Wikipedia articles
14+
- Retrieves full article content
15+
- Supports multiple languages
16+
17+
## Development
18+
19+
Run tests:
20+
```bash
21+
vendor/bin/phpunit
22+
```
23+
24+
Run static analysis:
25+
```bash
26+
vendor/bin/phpstan analyse
27+
```

src/toolbox/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2025-present Fabien Potencier
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

src/toolbox/README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Symfony AI Toolbox
2+
3+
A collection of third-party tools for Symfony AI agents.
4+
5+
## Features
6+
7+
- **Brave Search**: Web search functionality using the Brave Search API
8+
- **Wikipedia**: Search and retrieve Wikipedia articles
9+
10+
## Installation
11+
12+
```bash
13+
composer require symfony/ai-toolbox
14+
```
15+
16+
## Usage
17+
18+
### Brave Search Tool
19+
20+
```php
21+
use Symfony\AI\Toolbox\Tool\Brave;
22+
use Symfony\Component\HttpClient\HttpClient;
23+
24+
$httpClient = HttpClient::create();
25+
$brave = new Brave($httpClient, 'your-api-key');
26+
27+
$results = $brave('search query');
28+
```
29+
30+
### Wikipedia Tool
31+
32+
```php
33+
use Symfony\AI\Toolbox\Tool\Wikipedia;
34+
use Symfony\Component\HttpClient\HttpClient;
35+
36+
$httpClient = HttpClient::create();
37+
$wikipedia = new Wikipedia($httpClient);
38+
39+
// Search for articles
40+
$searchResults = $wikipedia->search('artificial intelligence');
41+
42+
// Get article content
43+
$article = $wikipedia->article('Artificial intelligence');
44+
```
45+
46+
## Requirements
47+
48+
- PHP 8.2 or higher
49+
- Symfony HTTP Client
50+
- Brave Search API key (for Brave tool)
51+
52+
## Testing
53+
54+
```bash
55+
vendor/bin/phpunit
56+
```
57+
58+
## Static Analysis
59+
60+
```bash
61+
vendor/bin/phpstan analyse
62+
```

0 commit comments

Comments
 (0)