datacircle / symfony-ai-tools
Find the best GTM APIs, in Symfony AI: four agent tools on Datacircle's open API, no key.
Requires
- php: >=8.2
- ext-json: *
- symfony/ai-agent: ^0.13 || ^0.14 || ^0.15 || ^1.0
- symfony/ai-platform: ^0.13 || ^0.14 || ^0.15 || ^1.0
- symfony/http-client: ^7.3 || ^8.0
- symfony/http-client-contracts: ^3.0
Requires (Dev)
- phpunit/phpunit: ^11.5 || ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Find the best GTM APIs. We benchmark all the GTM APIs and we put the results on our website.
This package gives Symfony AI agents four tools that call Datacircle's open API, https://api.datacircle.dev/v1. You need no key and no account.
| Tool | What the tool gives | Call |
|---|---|---|
datacircle_list_apis |
Every GTM API on Datacircle, with the API's slug, number of plans, number of providers and best plan | GET /apis |
datacircle_best_plans |
One API's plans, sorted by score out of 100, best first. Each plan comes with a rank and a price per 1,000 calls | GET /apis/{slug}/best |
datacircle_search_plans |
Plans that match a provider name or plan name. Search all APIs or one API. Sort the plans by score, provider or price | GET /plans |
datacircle_provider |
The APIs a provider sells, and the provider's rank on each API | GET /providers/{slug} |
Install
composer require datacircle/symfony-ai-tools
The package needs PHP 8.2 or later and symfony/ai-agent 0.13 or later, 1.0 included.
Use the tools in a Symfony app
Each tool is a class with #[AsTool]. Register the classes as services in config/services.yaml. Autoconfigure tags each tool for the AI bundle, and autowire gives the client your app's http_client:
services: _defaults: autowire: true autoconfigure: true Datacircle\SymfonyAi\Client: ~ Datacircle\SymfonyAi\Tool\ListApis: ~ Datacircle\SymfonyAi\Tool\BestPlans: ~ Datacircle\SymfonyAi\Tool\SearchPlans: ~ Datacircle\SymfonyAi\Tool\Provider: ~
Then give the tools to an agent in config/packages/ai.yaml. tools: true gives the agent every tool of your app:
ai: agent: default: platform: 'ai.platform.anthropic' model: 'claude-sonnet-5-5' tools: true
Or list only the tools you want:
ai: agent: default: platform: 'ai.platform.anthropic' model: 'claude-sonnet-5-5' tools: - 'Datacircle\SymfonyAi\Tool\BestPlans' - 'Datacircle\SymfonyAi\Tool\Provider'
The agent calls the tools when a question needs them:
php bin/console ai:agent:call default
Use the tools without the bundle
Datacircle::tools() gives the four tools for a Toolbox:
use Datacircle\SymfonyAi\Datacircle; use Symfony\AI\Agent\Agent; use Symfony\AI\Agent\Toolbox\FaultTolerantToolbox; use Symfony\AI\Agent\Toolbox\Toolbox; $toolbox = new FaultTolerantToolbox(new Toolbox(Datacircle::tools())); $agent = new Agent($platform, 'claude-sonnet-5-5', toolbox: $toolbox); echo $agent->call('Who is the best provider for the email-finder API?')->asText();
The tools work the same with the stream option. FaultTolerantToolbox passes a tool's failure to the model as text, so the agent run goes on.
You can also run a tool yourself:
use Datacircle\SymfonyAi\Tool\BestPlans; echo (new BestPlans())('email-finder', 3);
Each tool gives back a JSON object. Each plan comes with a rank, provider, plan, score, price per 1,000 (perThousand, in dollars) and a page on datacircle.dev. That page lists every field. When the API gives no data, the tool returns {"error": "..."} with the API's own message. An unknown slug also returns {"error": "..."}. The model can then call again. A network failure throws an exception.
new Client($httpClient, baseUrl: ..., timeout: ...) sets the HTTP client, the API address and the timeout in seconds. The timeout is 30 seconds by default. Pass the client to Datacircle::tools($client) or to each tool's constructor. A MockHttpClient fakes the calls in your tests.
Network
Each tool call makes one HTTPS GET request to https://api.datacircle.dev/v1 and nothing else. The request holds only the tool's own arguments: no key and nothing from your chats or config. The API takes up to 60 calls a minute from one IP address. The tool waits once, for a minute at most, when the API asks the tool to wait. The package stores nothing.
Links
- Datacircle: https://datacircle.dev
- The API: https://datacircle.dev/api
- The API's spec: https://api.datacircle.dev/v1/openapi.json
- What each key means: https://datacircle.dev/fields
MIT license.