agentpay / symfony-bridge
Symfony bundle for AgentPay PHP SDK integration.
Package info
bitbucket.org/agentpay/symfony-bridge
Type:symfony-bundle
pkg:composer/agentpay/symfony-bridge
Requires
- php: >=8.3
- agentpay/php-sdk: ^0.1
- symfony/config: ^6.4 || ^7.0 || ^8.0
- symfony/console: ^6.4 || ^7.0 || ^8.0
- symfony/dependency-injection: ^6.4 || ^7.0 || ^8.0
- symfony/framework-bundle: ^6.4 || ^7.0 || ^8.0
- symfony/http-client: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0
- squizlabs/php_codesniffer: ^3.10
- symfony/ai-agent: ^0.12
- symfony/ai-bundle: ^0.12
- symfony/ai-platform: ^0.12
Suggests
- symfony/ai-agent: Allows decorating Symfony AI AgentInterface calls with AgentPay telemetry.
- symfony/ai-bundle: Enables optional AgentPay telemetry integration for Symfony AI agents.
This package is not auto-updated.
Last update: 2026-09-02 05:26:33 UTC
README
Symfony bundle for wiring agentpay/php-sdk into Symfony applications.
Configuration
Copy config/packages/agentpay.yaml into your Symfony application and adjust the env vars.
agentpay:
enabled: '%env(bool:AGENTPAY_ENABLED)%'
base_url: '%env(AGENTPAY_BASE_URL)%'
api_key: '%env(AGENTPAY_API_KEY)%'
organization_id: '%env(AGENTPAY_ORGANIZATION_ID)%'
default_agent:
external_id: 'symfony-app'
name: 'Symfony Application'
privacy:
allow_only_safe_metadata: true
retry:
max_attempts: 3
buffer:
enabled: true
path: '%kernel.cache_dir%/agentpay/events.jsonl'
integrations:
symfony_ai:
enabled: true
authorize_spend: true
send_token_usage: true
send_prompts: false
send_responses: false
Commands
bin/console agentpay:ping
bin/console agentpay:test-event
Telemetry Helper
Inject AgentPay\Symfony\Telemetry\AgentPayTelemetry when application code only needs common session/task events:
use AgentPay\Enum\TaskType;
use AgentPay\Enum\TaskTypeSource;
use AgentPay\Symfony\Telemetry\AgentPayTelemetry;
final readonly class AiWorkflow
{
public function __construct(private AgentPayTelemetry $agentPayTelemetry)
{
}
public function run(): void
{
$this->agentPayTelemetry->sessionStarted('ses_123', 'Demo session');
$this->agentPayTelemetry->taskStarted(
sessionExternalId: 'ses_123',
taskExternalId: 'task_123',
taskType: TaskType::Feature,
taskTypeSource: TaskTypeSource::Explicit,
taskTypeConfidence: 1.0,
);
$this->agentPayTelemetry->taskCompleted(
sessionExternalId: 'ses_123',
taskExternalId: 'task_123',
taskType: TaskType::Feature,
taskTypeSource: TaskTypeSource::Explicit,
taskTypeConfidence: 1.0,
);
}
}
Symfony AI
When symfony/ai-bundle is installed, services tagged as ai.agent are decorated with AgentPay telemetry. The decorator records safe operational metadata and token usage from Symfony AI result metadata. It does not send prompts or model responses.
Per-call AgentPay context can be passed through Symfony AI options:
$agent->call('user prompt', [
'agentpay_session_id' => 'ses_123',
'agentpay_task_id' => 'task_123',
'agentpay_provider' => 'openai',
'agentpay_model' => 'gpt-4o-mini',
'agentpay_task_type' => 'feature',
'agentpay_task_type_source' => 'explicit',
'agentpay_task_type_confidence' => 1.0,
'agentpay_metadata' => [
'repository' => 'agentpay/app',
'branch' => 'feature/demo',
],
]);
If agentpay_estimated_cost_usd is provided and authorize_spend is enabled, the bridge calls AgentPay AuthorizeSpend before executing the Symfony AI call. BLOCK and REQUIRE_APPROVAL stop the call by throwing AgentPaySymfonyAiException.