@@ -2127,20 +2127,16 @@ public function testValidMultiAgentConfiguration()
2127
2127
$ this ->assertInstanceOf (Reference::class, $ arguments [0 ]);
2128
2128
$ this ->assertSame ('ai.agent.dispatcher ' , (string ) $ arguments [0 ]);
2129
2129
2130
- // Second argument: handoffs array (now references to handoff services)
2130
+ // Second argument: handoffs array
2131
2131
$ handoffs = $ arguments [1 ];
2132
2132
$ this ->assertIsArray ($ handoffs );
2133
2133
$ this ->assertCount (1 , $ handoffs );
2134
2134
2135
- // Verify handoff reference
2136
- $ handoffRef = $ handoffs [0 ];
2137
- $ this ->assertInstanceOf (Reference::class, $ handoffRef );
2138
- $ this ->assertSame ('ai.multi_agent.support.handoff.technical ' , (string ) $ handoffRef );
2139
-
2140
- // Check the actual handoff service definition
2141
- $ handoffDef = $ container ->getDefinition ('ai.multi_agent.support.handoff.technical ' );
2142
- $ this ->assertSame (Handoff::class, $ handoffDef ->getClass ());
2143
- $ handoffArgs = $ handoffDef ->getArguments ();
2135
+ // Verify handoff structure
2136
+ $ handoff = $ handoffs [0 ];
2137
+ $ this ->assertInstanceOf (Definition::class, $ handoff );
2138
+ $ this ->assertSame (Handoff::class, $ handoff ->getClass ());
2139
+ $ handoffArgs = $ handoff ->getArguments ();
2144
2140
$ this ->assertCount (2 , $ handoffArgs );
2145
2141
$ this ->assertInstanceOf (Reference::class, $ handoffArgs [0 ]);
2146
2142
$ this ->assertSame ('ai.agent.technical ' , (string ) $ handoffArgs [0 ]);
@@ -2201,26 +2197,25 @@ public function testMultiAgentWithMultipleHandoffs()
2201
2197
$ this ->assertIsArray ($ handoffs );
2202
2198
$ this ->assertCount (2 , $ handoffs );
2203
2199
2204
- // Both handoffs should be References to handoff services
2200
+ // Both handoffs should be Definition objects
2205
2201
foreach ($ handoffs as $ handoff ) {
2206
- $ this ->assertInstanceOf (Reference::class, $ handoff );
2202
+ $ this ->assertInstanceOf (Definition::class, $ handoff );
2203
+ $ this ->assertSame (Handoff::class, $ handoff ->getClass ());
2204
+ $ handoffArgs = $ handoff ->getArguments ();
2205
+ $ this ->assertCount (2 , $ handoffArgs );
2206
+ $ this ->assertInstanceOf (Reference::class, $ handoffArgs [0 ]);
2207
+ $ this ->assertIsArray ($ handoffArgs [1 ]);
2207
2208
}
2208
2209
2209
- // Verify first handoff service (code_expert)
2210
- $ codeHandoffRef = $ handoffs [0 ];
2211
- $ this ->assertSame ('ai.multi_agent.customer_service.handoff.code_expert ' , (string ) $ codeHandoffRef );
2212
- $ codeHandoffDef = $ container ->getDefinition ('ai.multi_agent.customer_service.handoff.code_expert ' );
2213
- $ this ->assertSame (Handoff::class, $ codeHandoffDef ->getClass ());
2214
- $ codeHandoffArgs = $ codeHandoffDef ->getArguments ();
2210
+ // Verify first handoff (code_expert)
2211
+ $ codeHandoff = $ handoffs [0 ];
2212
+ $ codeHandoffArgs = $ codeHandoff ->getArguments ();
2215
2213
$ this ->assertSame ('ai.agent.code_expert ' , (string ) $ codeHandoffArgs [0 ]);
2216
2214
$ this ->assertSame (['bug ' , 'code ' , 'programming ' , 'technical ' ], $ codeHandoffArgs [1 ]);
2217
2215
2218
- // Verify second handoff service (billing_expert)
2219
- $ billingHandoffRef = $ handoffs [1 ];
2220
- $ this ->assertSame ('ai.multi_agent.customer_service.handoff.billing_expert ' , (string ) $ billingHandoffRef );
2221
- $ billingHandoffDef = $ container ->getDefinition ('ai.multi_agent.customer_service.handoff.billing_expert ' );
2222
- $ this ->assertSame (Handoff::class, $ billingHandoffDef ->getClass ());
2223
- $ billingHandoffArgs = $ billingHandoffDef ->getArguments ();
2216
+ // Verify second handoff (billing_expert)
2217
+ $ billingHandoff = $ handoffs [1 ];
2218
+ $ billingHandoffArgs = $ billingHandoff ->getArguments ();
2224
2219
$ this ->assertSame ('ai.agent.billing_expert ' , (string ) $ billingHandoffArgs [0 ]);
2225
2220
$ this ->assertSame (['payment ' , 'invoice ' , 'subscription ' , 'refund ' ], $ billingHandoffArgs [1 ]);
2226
2221
}
@@ -2310,7 +2305,7 @@ public function testMultiAgentReferenceToNonExistingAgentThrowsException()
2310
2305
public function testAgentAndMultiAgentNameConflictThrowsException ()
2311
2306
{
2312
2307
$ this ->expectException (InvalidConfigurationException::class);
2313
- $ this ->expectExceptionMessage ('Agent names and multi-agent names must be unique. Duplicate name(s) found: support ' );
2308
+ $ this ->expectExceptionMessage ('Agent names and multi-agent names must be unique. Duplicate name(s) found: " support" ' );
2314
2309
2315
2310
$ this ->buildContainer ([
2316
2311
'ai ' => [
@@ -2335,7 +2330,7 @@ public function testAgentAndMultiAgentNameConflictThrowsException()
2335
2330
public function testMultipleAgentAndMultiAgentNameConflictsThrowsException ()
2336
2331
{
2337
2332
$ this ->expectException (InvalidConfigurationException::class);
2338
- $ this ->expectExceptionMessage ('Agent names and multi-agent names must be unique. Duplicate name(s) found: support, billing ' );
2333
+ $ this ->expectExceptionMessage ('Agent names and multi-agent names must be unique. Duplicate name(s) found: " support, billing" ' );
2339
2334
2340
2335
$ this ->buildContainer ([
2341
2336
'ai ' => [
@@ -2466,21 +2461,17 @@ public function testComprehensiveMultiAgentHappyPath()
2466
2461
$ this ->assertIsArray ($ csHandoffs );
2467
2462
$ this ->assertCount (2 , $ csHandoffs );
2468
2463
2469
- // Code expert handoff reference
2470
- $ codeHandoffRef = $ csHandoffs [0 ];
2471
- $ this ->assertInstanceOf (Reference::class, $ codeHandoffRef );
2472
- $ this ->assertSame ('ai.multi_agent.customer_support.handoff.code_expert ' , (string ) $ codeHandoffRef );
2473
- $ codeHandoffDef = $ container ->getDefinition ('ai.multi_agent.customer_support.handoff.code_expert ' );
2474
- $ codeHandoffArgs = $ codeHandoffDef ->getArguments ();
2464
+ // Code expert handoff
2465
+ $ codeHandoff = $ csHandoffs [0 ];
2466
+ $ this ->assertInstanceOf (Definition::class, $ codeHandoff );
2467
+ $ codeHandoffArgs = $ codeHandoff ->getArguments ();
2475
2468
$ this ->assertSame ('ai.agent.code_expert ' , (string ) $ codeHandoffArgs [0 ]);
2476
2469
$ this ->assertSame (['bug ' , 'error ' , 'code ' , 'debug ' , 'performance ' , 'optimization ' ], $ codeHandoffArgs [1 ]);
2477
2470
2478
- // Docs expert handoff reference
2479
- $ docsHandoffRef = $ csHandoffs [1 ];
2480
- $ this ->assertInstanceOf (Reference::class, $ docsHandoffRef );
2481
- $ this ->assertSame ('ai.multi_agent.customer_support.handoff.docs_expert ' , (string ) $ docsHandoffRef );
2482
- $ docsHandoffDef = $ container ->getDefinition ('ai.multi_agent.customer_support.handoff.docs_expert ' );
2483
- $ docsHandoffArgs = $ docsHandoffDef ->getArguments ();
2471
+ // Docs expert handoff
2472
+ $ docsHandoff = $ csHandoffs [1 ];
2473
+ $ this ->assertInstanceOf (Definition::class, $ docsHandoff );
2474
+ $ docsHandoffArgs = $ docsHandoff ->getArguments ();
2484
2475
$ this ->assertSame ('ai.agent.docs_expert ' , (string ) $ docsHandoffArgs [0 ]);
2485
2476
$ this ->assertSame (['documentation ' , 'docs ' , 'readme ' , 'api ' , 'guide ' , 'tutorial ' ], $ docsHandoffArgs [1 ]);
2486
2477
0 commit comments