@@ -456,6 +456,7 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
456
456
$ container ->setDefinition ('ai.agent. ' .$ name .'.model ' , $ modelDefinition );
457
457
458
458
// AGENT
459
+ $ agentId = 'ai.agent. ' .$ name ;
459
460
$ agentDefinition = (new Definition (Agent::class))
460
461
->addTag ('ai.agent ' , ['name ' => $ name ])
461
462
->setArgument (0 , new Reference ($ config ['platform ' ]))
@@ -516,8 +517,8 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
516
517
->replaceArgument (0 , new Reference ('ai.toolbox. ' .$ name ));
517
518
518
519
$ container ->setDefinition ('ai.tool.agent_processor. ' .$ name , $ toolProcessorDefinition )
519
- ->addTag ('ai.agent.input_processor ' , ['agent ' => $ name , 'priority ' => -10 ])
520
- ->addTag ('ai.agent.output_processor ' , ['agent ' => $ name , 'priority ' => -10 ]);
520
+ ->addTag ('ai.agent.input_processor ' , ['agent ' => $ agentId , 'priority ' => -10 ])
521
+ ->addTag ('ai.agent.output_processor ' , ['agent ' => $ agentId , 'priority ' => -10 ]);
521
522
} else {
522
523
if ($ config ['fault_tolerant_toolbox ' ] && !$ container ->hasDefinition ('ai.fault_tolerant_toolbox ' )) {
523
524
$ container ->setDefinition ('ai.fault_tolerant_toolbox ' , new Definition (FaultTolerantToolbox::class))
@@ -526,16 +527,16 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
526
527
}
527
528
528
529
$ container ->getDefinition ('ai.tool.agent_processor ' )
529
- ->addTag ('ai.agent.input_processor ' , ['agent ' => $ name , 'priority ' => -10 ])
530
- ->addTag ('ai.agent.output_processor ' , ['agent ' => $ name , 'priority ' => -10 ]);
530
+ ->addTag ('ai.agent.input_processor ' , ['agent ' => $ agentId , 'priority ' => -10 ])
531
+ ->addTag ('ai.agent.output_processor ' , ['agent ' => $ agentId , 'priority ' => -10 ]);
531
532
}
532
533
}
533
534
534
535
// STRUCTURED OUTPUT
535
536
if ($ config ['structured_output ' ]) {
536
537
$ container ->getDefinition ('ai.agent.structured_output_processor ' )
537
- ->addTag ('ai.agent.input_processor ' , ['agent ' => $ name , 'priority ' => -20 ])
538
- ->addTag ('ai.agent.output_processor ' , ['agent ' => $ name , 'priority ' => -20 ]);
538
+ ->addTag ('ai.agent.input_processor ' , ['agent ' => $ agentId , 'priority ' => -20 ])
539
+ ->addTag ('ai.agent.output_processor ' , ['agent ' => $ agentId , 'priority ' => -20 ]);
539
540
}
540
541
541
542
// TOKEN USAGE TRACKING
@@ -555,7 +556,7 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
555
556
556
557
if ($ container ->hasDefinition ('ai.platform.token_usage_processor. ' .$ platform )) {
557
558
$ container ->getDefinition ('ai.platform.token_usage_processor. ' .$ platform )
558
- ->addTag ('ai.agent.output_processor ' , ['agent ' => $ name , 'priority ' => -30 ]);
559
+ ->addTag ('ai.agent.output_processor ' , ['agent ' => $ agentId , 'priority ' => -30 ]);
559
560
}
560
561
}
561
562
}
@@ -568,7 +569,7 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
568
569
$ config ['include_tools ' ] ? new Reference ('ai.toolbox. ' .$ name ) : null ,
569
570
new Reference ('logger ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE ),
570
571
])
571
- ->addTag ('ai.agent.input_processor ' , ['agent ' => $ name , 'priority ' => -30 ]);
572
+ ->addTag ('ai.agent.input_processor ' , ['agent ' => $ agentId , 'priority ' => -30 ]);
572
573
573
574
$ container ->setDefinition ('ai.agent. ' .$ name .'.system_prompt_processor ' , $ systemPromptInputProcessorDefinition );
574
575
}
@@ -579,8 +580,8 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
579
580
->setArgument (4 , new Reference ('logger ' , ContainerInterface::IGNORE_ON_INVALID_REFERENCE ))
580
581
;
581
582
582
- $ container ->setDefinition (' ai.agent. ' . $ name , $ agentDefinition );
583
- $ container ->registerAliasForArgument (' ai.agent. ' . $ name , AgentInterface::class, (new Target ($ name .'Agent ' ))->getParsedName ());
583
+ $ container ->setDefinition ($ agentId , $ agentDefinition );
584
+ $ container ->registerAliasForArgument ($ agentId , AgentInterface::class, (new Target ($ name .'Agent ' ))->getParsedName ());
584
585
}
585
586
586
587
/**
0 commit comments