Commit 2a0edf4
committed
feat(langgraph): extract original tool_call_id from runtime for consistency
Add _extract_tool_call_id function to handle MCP tool runtime objects and
prioritize original tool_call_id over run_id for consistent event tracking.
Update converter to use extracted ID or fallback to run_id when not available.
Add comprehensive tests for tool start/end events with runtime tool_call_id.
fixes inconsistent tool call ID tracking when using MCP tools that inject
runtime objects with original LLM-generated tool_call_id
为 runtime 对象添加提取原始 tool_call_id 的功能以确保一致性
添加 _extract_tool_call_id 函数来处理 MCP 工具 runtime 对象,并优先使用原始
tool_call_id 而不是 run_id 来确保事件跟踪的一致性。更新转换器以使用提取的 ID,
当不可用时回退到 run_id。为带有 runtime tool_call_id 的工具开始/结束事件添加
全面的测试。
修复使用注入包含原始 LLM 生成 tool_call_id 的 runtime 对象的 MCP 工具时
工具调用 ID 跟踪不一致的问题
Change-Id: I2838c7b88ea8c01c87b39038d2b92a06bea89167
Signed-off-by: OhYee <oyohyee@oyohyee.com>1 parent 175ec93 commit 2a0edf4
File tree
2 files changed
+133
-6
lines changed- agentrun/integration/langgraph
- tests/unittests/integration
2 files changed
+133
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
117 | 142 | | |
118 | 143 | | |
119 | 144 | | |
| |||
538 | 563 | | |
539 | 564 | | |
540 | 565 | | |
| 566 | + | |
| 567 | + | |
541 | 568 | | |
542 | 569 | | |
543 | 570 | | |
544 | | - | |
| 571 | + | |
545 | 572 | | |
546 | 573 | | |
547 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
548 | 578 | | |
549 | 579 | | |
550 | 580 | | |
| |||
554 | 584 | | |
555 | 585 | | |
556 | 586 | | |
557 | | - | |
| 587 | + | |
558 | 588 | | |
559 | 589 | | |
560 | 590 | | |
561 | 591 | | |
562 | 592 | | |
563 | 593 | | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
564 | 597 | | |
565 | | - | |
| 598 | + | |
566 | 599 | | |
567 | 600 | | |
568 | 601 | | |
569 | | - | |
| 602 | + | |
570 | 603 | | |
571 | 604 | | |
572 | 605 | | |
573 | 606 | | |
574 | 607 | | |
575 | | - | |
| 608 | + | |
576 | 609 | | |
577 | 610 | | |
578 | 611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
310 | 404 | | |
311 | 405 | | |
312 | 406 | | |
| |||
0 commit comments