webmamba / ag-ui-symfony-ai-bridge
Provides integration for AG-UI with Symfony AI: any Symfony AI agent runs over the AG-UI protocol.
Package info
github.com/WebMamba/ag-ui-symfony-ai-bridge
pkg:composer/webmamba/ag-ui-symfony-ai-bridge
Requires
- php: >=8.4
- phpstan/phpdoc-parser: ^2.0
- symfony/ai-agent: ^1.0@beta
- symfony/ai-platform: ^1.0@beta
- symfony/property-access: ^8.0
- symfony/property-info: ^8.0
- symfony/serializer: ^8.0
- symfony/service-contracts: ^3.5
- symfony/uid: ^8.0
- webmamba/ag-ui: dev-main
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-16 16:18:39 UTC
README
Provides integration for AG-UI with Symfony AI: any Symfony AI agent runs over the AG-UI protocol — text, reasoning, tool calls, frontend tools, interrupts, typed shared state and generative UI (activities).
The bridge needs no framework. In a Symfony application, install
webmamba/ag-ui-bundle instead: it wires all of this into every agent.
Installation
composer require webmamba/ag-ui-symfony-ai-bridge
Symfony AI is in beta: Composer installs it only if your composer.json allows it,
with "minimum-stability": "beta" or with each symfony/ai-* package it needs
required as ^1.0@beta, as when you installed Symfony AI.
Usage
An agent takes the bridge's toolbox, tool executor and input processor; they stay out of the way until a run is opened for that agent:
use AgUi\Bridge\SymfonyAi\AgUi; use AgUi\Encoder\SseEncoder; use AgUi\Run\RunAgentInput; use Symfony\AI\Agent\Agent; use Symfony\AI\Agent\Toolbox\Toolbox; $agUi = new AgUi(secret: $_ENV['APP_SECRET']); // signs the interrupts: the same on every server $toolbox = $agUi->toolbox(new Toolbox([new GetForecast()])); $agent = new Agent($platform, 'claude-sonnet-5-5', inputProcessors: [$agUi->inputProcessor()], toolbox: $toolbox, toolExecutor: $agUi->toolExecutor($toolbox), ); $input = RunAgentInput::fromArray(json_decode($body, true)); $encoder = new SseEncoder(); foreach ($agUi->run($input, $agent) as $event) { echo $encoder->encode($event); flush(); }
AgUi takes a secret: it signs the interrupts' ids, so a resume is trusted without
server state. Every server that may run a thread needs the same one.
What a run does, beyond the model's text and reasoning:
- Shared state:
$agUi->run($input, $agent, state: $plan)fills$planfrom the run agent input, and sends each change a tool makes to it as a state delta. A state class implementingDescribesItselfwrites what the model reads about it. - Frontend tools: the tools the client declares are offered to the model; the run stops when it calls one, and the result comes back in the next run.
- Interrupts: a
ResumableToolreturns anInterruptwhen it needs a human; itsresume()turns the answer into its result in the next run. - Generative UI: a tool returning an
Activitygives the model a sentence and the client something to render. - Run context:
RunContexttells a tool the thread, the run and the forwarded props. - Tool result mappings: a
ToolResultMappingadds events after a tool result.
Resources
- AG-UI protocol
- Glossary and design decisions
- Report issues and send pull requests in the main repository