Skip to content

Commit 6e832e8

Browse files
feat(Profiler): Trace and display AgentInterface calls
1 parent bc7036a commit 6e832e8

File tree

6 files changed

+532
-149
lines changed

6 files changed

+532
-149
lines changed

.idea/workspace.xml

Lines changed: 256 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ai-bundle/config/services.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

14+
use Symfony\AI\Agent\AgentInterface;
1415
use Symfony\AI\Agent\StructuredOutput\AgentProcessor as StructureOutputProcessor;
1516
use Symfony\AI\Agent\StructuredOutput\ResponseFormatFactory;
1617
use Symfony\AI\Agent\StructuredOutput\ResponseFormatFactoryInterface;
@@ -23,6 +24,8 @@
2324
use Symfony\AI\AiBundle\Command\AgentCallCommand;
2425
use Symfony\AI\AiBundle\Command\PlatformInvokeCommand;
2526
use Symfony\AI\AiBundle\Profiler\DataCollector;
27+
use Symfony\AI\AiBundle\Profiler\TraceableAgent;
28+
use Symfony\AI\AiBundle\Profiler\TraceableToolbox;
2629
use Symfony\AI\AiBundle\Security\EventListener\IsGrantedToolAttributeListener;
2730
use Symfony\AI\Chat\Command\DropStoreCommand as DropMessageStoreCommand;
2831
use Symfony\AI\Chat\Command\SetupStoreCommand as SetupMessageStoreCommand;
@@ -165,6 +168,12 @@
165168
->tag('kernel.event_listener')
166169

167170
// profiler
171+
->set('ai.traceable_agent', TraceableAgent::class)
172+
->decorate(AgentInterface::class, priority: 5)
173+
->args([
174+
service('.inner'),
175+
service('ai.data_collector'),
176+
])
168177
->set('ai.data_collector', DataCollector::class)
169178
->args([
170179
tagged_iterator('ai.traceable_platform'),

0 commit comments

Comments
 (0)