Commit b4c4f50
authored
Python: Emit tool call events in GitHubCopilotAgent streaming (microsoft#4711)
* Emit tool call events in GitHubCopilotAgent streaming
_stream_updates now yields FunctionCallContent for TOOL_EXECUTION_START
and FunctionResultContent for TOOL_EXECUTION_COMPLETE events from the
Copilot SDK session. This enables DevUI and other consumers to display
tool calls during streaming agent execution. Previously only ASSISTANT_MESSAGE_DELTA, SESSION_IDLE, and SESSION_ERROR
were handled — tool execution events were silently dropped.
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
* Add some tests
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
* Respond to feedback
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
* Fix TOOL_EXECUTION_COMPLETE to use correct SDK types
- Read result text from session_events.Result.content (not ToolResult.text_result_for_llm)
- Read failure state from event.data.success/error (not result_obj.result_type/error)
- Handle ErrorClass.message and plain string errors
- Update tests to use session_events.Result and ErrorClass
- Add tests for string errors, success-with-error, and COMPLETE missing fields
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
---------
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>1 parent 0cd40f8 commit b4c4f50
2 files changed
Lines changed: 408 additions & 1 deletion
File tree
- python/packages/github_copilot
- agent_framework_github_copilot
- tests
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
461 | 498 | | |
462 | 499 | | |
463 | 500 | | |
| |||
0 commit comments