lite-agent 0.2.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lite-agent might be problematic. Click here for more details.

Files changed (94) hide show
  1. lite_agent-0.4.0/.claude/settings.local.json +21 -0
  2. {lite_agent-0.2.0 → lite_agent-0.4.0}/.vscode/launch.json +1 -1
  3. lite_agent-0.4.0/CHANGELOG.md +184 -0
  4. lite_agent-0.4.0/CLAUDE.md +100 -0
  5. {lite_agent-0.2.0 → lite_agent-0.4.0}/PKG-INFO +2 -2
  6. {lite_agent-0.2.0 → lite_agent-0.4.0}/examples/basic.py +4 -3
  7. lite_agent-0.4.0/examples/basic_agent.py +54 -0
  8. {lite_agent-0.2.0 → lite_agent-0.4.0}/examples/channels/rich_channel.py +16 -17
  9. lite_agent-0.4.0/examples/chat_display_demo.py +113 -0
  10. {lite_agent-0.2.0 → lite_agent-0.4.0}/examples/confirm_and_continue.py +2 -2
  11. lite_agent-0.2.0/examples/test_consolidate_history.py → lite_agent-0.4.0/examples/consolidate_history.py +2 -2
  12. {lite_agent-0.2.0 → lite_agent-0.4.0}/examples/context.py +3 -2
  13. {lite_agent-0.2.0 → lite_agent-0.4.0}/examples/handoffs.py +6 -2
  14. lite_agent-0.4.0/examples/image.py +59 -0
  15. {lite_agent-0.2.0 → lite_agent-0.4.0}/examples/message_transfer_example.py +39 -19
  16. {lite_agent-0.2.0 → lite_agent-0.4.0}/examples/message_transfer_example_new.py +34 -17
  17. lite_agent-0.4.0/examples/new_message_structure_demo.py +182 -0
  18. lite_agent-0.4.0/examples/response_api_example.py +129 -0
  19. lite_agent-0.4.0/examples/responses.py +58 -0
  20. lite_agent-0.4.0/examples/set_chat_history_example.py +104 -0
  21. lite_agent-0.4.0/examples/stop_with_tool_call.py +47 -0
  22. {lite_agent-0.2.0 → lite_agent-0.4.0}/examples/terminal.py +16 -3
  23. lite_agent-0.4.0/examples/translate/main.py +49 -0
  24. lite_agent-0.4.0/examples/translate/prompts/translation_system.md.j2 +1 -0
  25. lite_agent-0.4.0/examples/type_system_example.py +103 -0
  26. {lite_agent-0.2.0 → lite_agent-0.4.0}/pyproject.toml +15 -4
  27. lite_agent-0.4.0/src/lite_agent/__init__.py +8 -0
  28. lite_agent-0.4.0/src/lite_agent/agent.py +521 -0
  29. lite_agent-0.4.0/src/lite_agent/chat_display.py +779 -0
  30. lite_agent-0.4.0/src/lite_agent/client.py +69 -0
  31. {lite_agent-0.2.0 → lite_agent-0.4.0}/src/lite_agent/message_transfers.py +9 -1
  32. lite_agent-0.4.0/src/lite_agent/processors/__init__.py +4 -0
  33. lite_agent-0.4.0/src/lite_agent/processors/completion_event_processor.py +306 -0
  34. lite_agent-0.4.0/src/lite_agent/processors/response_event_processor.py +205 -0
  35. lite_agent-0.4.0/src/lite_agent/runner.py +815 -0
  36. lite_agent-0.4.0/src/lite_agent/stream_handlers/__init__.py +6 -0
  37. lite_agent-0.4.0/src/lite_agent/stream_handlers/litellm.py +75 -0
  38. lite_agent-0.4.0/src/lite_agent/templates/handoffs_source_instructions.xml.j2 +10 -0
  39. lite_agent-0.4.0/src/lite_agent/templates/handoffs_target_instructions.xml.j2 +9 -0
  40. lite_agent-0.4.0/src/lite_agent/templates/wait_for_user_instructions.xml.j2 +6 -0
  41. lite_agent-0.4.0/src/lite_agent/types/__init__.py +129 -0
  42. lite_agent-0.4.0/src/lite_agent/types/events.py +119 -0
  43. lite_agent-0.4.0/src/lite_agent/types/messages.py +343 -0
  44. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/integration/test_agent_with_mocks.py +9 -9
  45. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/integration/test_basic.py +2 -2
  46. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/integration/test_mock_litellm.py +1 -1
  47. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/mocks/basic/1.jsonl +32 -28
  48. lite_agent-0.4.0/tests/mocks/confirm_and_continue/1.jsonl +21 -0
  49. lite_agent-0.4.0/tests/mocks/confirm_and_continue/2.jsonl +37 -0
  50. lite_agent-0.4.0/tests/mocks/context/1.jsonl +19 -0
  51. lite_agent-0.4.0/tests/mocks/handoffs/1.jsonl +36 -0
  52. lite_agent-0.4.0/tests/performance/test_set_chat_history_performance.py +130 -0
  53. lite_agent-0.4.0/tests/test_new_messages.py +157 -0
  54. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/unit/test_agent.py +20 -17
  55. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/unit/test_agent_handoffs.py +62 -45
  56. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/unit/test_append_message.py +76 -39
  57. lite_agent-0.4.0/tests/unit/test_chat_display.py +38 -0
  58. lite_agent-0.4.0/tests/unit/test_completion_condition.py +88 -0
  59. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/unit/test_file_recording.py +24 -24
  60. lite_agent-0.4.0/tests/unit/test_litellm_stream_handler.py +82 -0
  61. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/unit/test_message_transfer.py +5 -5
  62. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/unit/test_message_transfers.py +9 -9
  63. lite_agent-0.4.0/tests/unit/test_response_api_format.py +290 -0
  64. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/unit/test_runner.py +40 -35
  65. lite_agent-0.4.0/tests/unit/test_set_chat_history.py +354 -0
  66. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/unit/test_stream_chunk_processor.py +2 -14
  67. {lite_agent-0.2.0 → lite_agent-0.4.0}/tests/utils/mock_litellm.py +58 -3
  68. {lite_agent-0.2.0 → lite_agent-0.4.0}/uv.lock +554 -464
  69. lite_agent-0.2.0/CHANGELOG.md +0 -85
  70. lite_agent-0.2.0/examples/responses.py +0 -42
  71. lite_agent-0.2.0/pyrightconfig.json +0 -5
  72. lite_agent-0.2.0/src/lite_agent/__init__.py +0 -7
  73. lite_agent-0.2.0/src/lite_agent/agent.py +0 -330
  74. lite_agent-0.2.0/src/lite_agent/processors/__init__.py +0 -3
  75. lite_agent-0.2.0/src/lite_agent/processors/stream_chunk_processor.py +0 -106
  76. lite_agent-0.2.0/src/lite_agent/runner.py +0 -487
  77. lite_agent-0.2.0/src/lite_agent/stream_handlers/__init__.py +0 -5
  78. lite_agent-0.2.0/src/lite_agent/stream_handlers/litellm.py +0 -106
  79. lite_agent-0.2.0/src/lite_agent/types/__init__.py +0 -55
  80. lite_agent-0.2.0/src/lite_agent/types/chunks.py +0 -89
  81. lite_agent-0.2.0/src/lite_agent/types/messages.py +0 -68
  82. lite_agent-0.2.0/tests/mocks/confirm_and_continue/1.jsonl +0 -32
  83. lite_agent-0.2.0/tests/mocks/confirm_and_continue/2.jsonl +0 -36
  84. lite_agent-0.2.0/tests/mocks/context/1.jsonl +0 -14
  85. lite_agent-0.2.0/tests/unit/test_litellm_stream_handler.py +0 -162
  86. {lite_agent-0.2.0 → lite_agent-0.4.0}/.github/workflows/ci.yml +0 -0
  87. {lite_agent-0.2.0 → lite_agent-0.4.0}/.gitignore +0 -0
  88. {lite_agent-0.2.0 → lite_agent-0.4.0}/.python-version +0 -0
  89. {lite_agent-0.2.0 → lite_agent-0.4.0}/README.md +0 -0
  90. /lite_agent-0.2.0/examples/handoff_workflow_demo.py → /lite_agent-0.4.0/examples/translate.py +0 -0
  91. {lite_agent-0.2.0 → lite_agent-0.4.0}/scripts/record_chat_messages.py +0 -0
  92. {lite_agent-0.2.0 → lite_agent-0.4.0}/src/lite_agent/loggers.py +0 -0
  93. {lite_agent-0.2.0 → lite_agent-0.4.0}/src/lite_agent/py.typed +0 -0
  94. {lite_agent-0.2.0 → lite_agent-0.4.0}/src/lite_agent/types/tool_calls.py +0 -0
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
+ "permissions": {
4
+ "allow": [
5
+ "Bash(pytest:*)",
6
+ "mcp__context7__resolve-library-id",
7
+ "mcp__context7__get-library-docs",
8
+ "Bash(ruff check:*)",
9
+ "Bash(python:*)",
10
+ "Bash(ruff format:*)",
11
+ "Bash(rm:*)",
12
+ "Bash(grep:*)",
13
+ "mcp__ide__getDiagnostics",
14
+ "Bash(uv run pytest:*)",
15
+ "Bash(timeout:*)",
16
+ "Bash(pyright:*)",
17
+ "Bash(rg:*)"
18
+ ],
19
+ "deny": []
20
+ }
21
+ }
@@ -8,7 +8,7 @@
8
8
  "name": "Python main",
9
9
  "type": "debugpy",
10
10
  "request": "launch",
11
- "program": "${workspaceFolder}/src/easy_agent/__main__.py",
11
+ "program": "${file}",
12
12
  "console": "integratedTerminal",
13
13
  "justMyCode": false
14
14
  }
@@ -0,0 +1,184 @@
1
+ ## v0.4.0
2
+
3
+ [v0.3.0...v0.4.0](https://github.com/Jannchie/lite-agent/compare/v0.3.0...v0.4.0)
4
+
5
+ ### :rocket: Breaking Changes
6
+
7
+ - **agent**: unify message handling using new messages format - By [Jannchie](mailto:jannchie@gmail.com) in [f31769a](https://github.com/Jannchie/lite-agent/commit/f31769a)
8
+ - **chat-display**: remove display_chat_history usage and exports - By [Jannchie](mailto:jannchie@gmail.com) in [fca6ff7](https://github.com/Jannchie/lite-agent/commit/fca6ff7)
9
+ - **chat-display**: rename rich_helpers to chat_display and update related imports - By [Jannchie](mailto:panjianqi@preferred.jp) in [8bbd83b](https://github.com/Jannchie/lite-agent/commit/8bbd83b)
10
+ - **chunks**: rename tool_call and tool_call_result to function_call and function_call_output - By [Jannchie](mailto:jannchie@gmail.com) in [2821478](https://github.com/Jannchie/lite-agent/commit/2821478)
11
+ - **function-call**: rename function_call_id to call_id - By [Jannchie](mailto:jannchie@gmail.com) in [d415fce](https://github.com/Jannchie/lite-agent/commit/d415fce)
12
+ - **messages**: remove legacy function call messages and migrate to new assistant message structure - By [Jannchie](mailto:jannchie@gmail.com) in [c632629](https://github.com/Jannchie/lite-agent/commit/c632629)
13
+ - **messages**: remove conversion helpers and fully switch to new message format - By [Jannchie](mailto:jannchie@gmail.com) in [75e47bf](https://github.com/Jannchie/lite-agent/commit/75e47bf)
14
+ - **messages**: introduce new structured message types and unified message format - By [Jannchie](mailto:jannchie@gmail.com) in [cb8c091](https://github.com/Jannchie/lite-agent/commit/cb8c091)
15
+ - **processors**: rename stream_chunk_processor to completion_event_processor - By [Jannchie](mailto:jannchie@gmail.com) in [80dedb9](https://github.com/Jannchie/lite-agent/commit/80dedb9)
16
+ - **runner**: remove final_message type and streamline tool call handling - By [Jannchie](mailto:jannchie@gmail.com) in [ba91c29](https://github.com/Jannchie/lite-agent/commit/ba91c29)
17
+ - **types**: rename chunk types to event types and update references - By [Jannchie](mailto:jannchie@gmail.com) in [d1354b3](https://github.com/Jannchie/lite-agent/commit/d1354b3)
18
+ - **types**: remove finalmessagechunk type and usage - By [Jannchie](mailto:jannchie@gmail.com) in [6b3281e](https://github.com/Jannchie/lite-agent/commit/6b3281e)
19
+
20
+ ### :sparkles: Features
21
+
22
+ - **chat-display**: add support for new message format - By [Jannchie](mailto:jannchie@gmail.com) in [a3fd1c6](https://github.com/Jannchie/lite-agent/commit/a3fd1c6)
23
+ - **chat-display**: add meta stats, local time, and message performance info to chat display and message types - By [Jannchie](mailto:jannchie@gmail.com) in [bda3346](https://github.com/Jannchie/lite-agent/commit/bda3346)
24
+ - **responses**: support new message format for response api - By [Jannchie](mailto:jannchie@gmail.com) in [e34a2ef](https://github.com/Jannchie/lite-agent/commit/e34a2ef)
25
+ - **responses**: add response streaming support and client methods - By [Jannchie](mailto:jannchie@gmail.com) in [f484530](https://github.com/Jannchie/lite-agent/commit/f484530)
26
+ - **rich-helpers**: add print_messages for compact output - By [Jannchie](mailto:panjianqi@preferred.jp) in [5a49203](https://github.com/Jannchie/lite-agent/commit/5a49203)
27
+ - **runner**: support interactive tool call confirmation in terminal && improve chunk handling - By [Jannchie](mailto:jannchie@gmail.com) in [7164284](https://github.com/Jannchie/lite-agent/commit/7164284)
28
+
29
+ ### :adhesive_bandage: Fixes
30
+
31
+ - **agent**: use isinstance for to_llm_dict checks - By [Jannchie](mailto:jannchie@gmail.com) in [e996785](https://github.com/Jannchie/lite-agent/commit/e996785)
32
+ - **examples**: add content checks for dict messages - By [Jannchie](mailto:panjianqi@preferred.jp) in [94afcae](https://github.com/Jannchie/lite-agent/commit/94afcae)
33
+ - **import**: update stream_handler imports && fix response api logic - By [Jannchie](mailto:jannchie@gmail.com) in [be192da](https://github.com/Jannchie/lite-agent/commit/be192da)
34
+ - **input-image**: ensure file_id or image_url present and improve conversion handling - By [Jannchie](mailto:jannchie@gmail.com) in [d0bcdd5](https://github.com/Jannchie/lite-agent/commit/d0bcdd5)
35
+ - **runner**: improve wait_for_user finish detection - By [Jannchie](mailto:jannchie@gmail.com) in [98435b0](https://github.com/Jannchie/lite-agent/commit/98435b0)
36
+ - **runner**: fix final message processing to return responses - By [Jannchie](mailto:jannchie@gmail.com) in [e813f4a](https://github.com/Jannchie/lite-agent/commit/e813f4a)
37
+ - **stream-chunk-processor**: construct usage event with correct usage type - By [Jannchie](mailto:jannchie@gmail.com) in [89b2cbe](https://github.com/Jannchie/lite-agent/commit/89b2cbe)
38
+ - **tests**: improve type hints and patching mocks - By [Jannchie](mailto:jannchie@gmail.com) in [e4dfd64](https://github.com/Jannchie/lite-agent/commit/e4dfd64)
39
+ - **tests**: update patch paths for litellm.acompletion - By [Jannchie](mailto:jannchie@gmail.com) in [897a284](https://github.com/Jannchie/lite-agent/commit/897a284)
40
+
41
+ ### :art: Refactors
42
+
43
+ - **examples**: replace final_message with assistant_message in includes - By [Jannchie](mailto:jannchie@gmail.com) in [c5431ab](https://github.com/Jannchie/lite-agent/commit/c5431ab)
44
+ - **runner**: simplify message appending logic && tidy code style - By [Jannchie](mailto:jannchie@gmail.com) in [412a8ec](https://github.com/Jannchie/lite-agent/commit/412a8ec)
45
+ - **runner**: replace api handling with match statement && set default api to responses - By [Jannchie](mailto:jannchie@gmail.com) in [75c823a](https://github.com/Jannchie/lite-agent/commit/75c823a)
46
+ - **stream-handlers**: rename litellm_stream_handler to litellm_completion_stream_handler && update imports and tests - By [Jannchie](mailto:jannchie@gmail.com) in [5b7ac92](https://github.com/Jannchie/lite-agent/commit/5b7ac92)
47
+ - **tests**: rename tool_call types to function_call && remove unused usage tests - By [Jannchie](mailto:jannchie@gmail.com) in [1e0992f](https://github.com/Jannchie/lite-agent/commit/1e0992f)
48
+
49
+ ### :memo: Documentation
50
+
51
+ - add claude guidance documentation - By [Jannchie](mailto:panjianqi@preferred.jp) in [a741494](https://github.com/Jannchie/lite-agent/commit/a741494)
52
+
53
+ ### :wrench: Chores
54
+
55
+ - **dependencies**: update lock file - By [Jannchie](mailto:jannchie@gmail.com) in [042f6f3](https://github.com/Jannchie/lite-agent/commit/042f6f3)
56
+ - **dev-deps**: add pytest-asyncio to dev dependencies - By [Jannchie](mailto:jannchie@gmail.com) in [57543cd](https://github.com/Jannchie/lite-agent/commit/57543cd)
57
+ - **lint**: remove commented ruff exclude config - By [Jannchie](mailto:jannchie@gmail.com) in [25635dd](https://github.com/Jannchie/lite-agent/commit/25635dd)
58
+
59
+ ## v0.3.0
60
+
61
+ [v0.2.0...v0.3.0](https://github.com/Jannchie/lite-agent/compare/v0.2.0...v0.3.0)
62
+
63
+ ### :rocket: Breaking Changes
64
+
65
+ - **rich-helpers**: rename render_chat_history to print_chat_history and update imports - By [Jannchie](mailto:jannchie@gmail.com) in [3db6721](https://github.com/Jannchie/lite-agent/commit/3db6721)
66
+
67
+ ### :sparkles: Features
68
+
69
+ - **agent**: use jinja2 templates for instruction messages - By [Jannchie](mailto:jannchie@gmail.com) in [f5ccbd5](https://github.com/Jannchie/lite-agent/commit/f5ccbd5)
70
+ - **agent**: add completion_condition and task_done tool support - By [Jannchie](mailto:jannchie@gmail.com) in [28126b1](https://github.com/Jannchie/lite-agent/commit/28126b1)
71
+ - **response-api**: add response api format for text and image input - By [Jannchie](mailto:jannchie@gmail.com) in [4b44f91](https://github.com/Jannchie/lite-agent/commit/4b44f91)
72
+ - **rich-helpers**: add rich chat history renderer and chat summary utils - By [Jannchie](mailto:jannchie@gmail.com) in [5a570ce](https://github.com/Jannchie/lite-agent/commit/5a570ce)
73
+ - **runner**: add set_chat_history to support full chat history replay and agent tracking - By [Jannchie](mailto:jannchie@gmail.com) in [fd2ecdc](https://github.com/Jannchie/lite-agent/commit/fd2ecdc)
74
+ - **types**: enhance runner type system for flexible user_input - By [Jannchie](mailto:jannchie@gmail.com) in [3a2e9c5](https://github.com/Jannchie/lite-agent/commit/3a2e9c5)
75
+
76
+ ### :adhesive_bandage: Fixes
77
+
78
+ - **examples**: check content key before modifying messages - By [Jannchie](mailto:jannchie@gmail.com) in [94b85a6](https://github.com/Jannchie/lite-agent/commit/94b85a6)
79
+
80
+ ### :art: Refactors
81
+
82
+ - **agent**: abstract llm client and refactor model usage - By [Jannchie](mailto:jannchie@gmail.com) in [09c52c8](https://github.com/Jannchie/lite-agent/commit/09c52c8)
83
+ - **client**: move llm client classes to separate module - By [Jannchie](mailto:jannchie@gmail.com) in [a70d163](https://github.com/Jannchie/lite-agent/commit/a70d163)
84
+ - **rich-helpers-test**: rename render_chat_history to print_chat_history - By [Jannchie](mailto:jannchie@gmail.com) in [bf1ca8f](https://github.com/Jannchie/lite-agent/commit/bf1ca8f)
85
+
86
+ ### :lipstick: Styles
87
+
88
+ - **agent**: inline error message formatting - By [Jannchie](mailto:jannchie@gmail.com) in [1453cc5](https://github.com/Jannchie/lite-agent/commit/1453cc5)
89
+ - **tests**: add type ignore hints to assertions - By [Jannchie](mailto:jannchie@gmail.com) in [8d2a19d](https://github.com/Jannchie/lite-agent/commit/8d2a19d)
90
+
91
+ ### :memo: Documentation
92
+
93
+ - **set-chat-history**: remove set_chat_history feature documentation - By [Jannchie](mailto:jannchie@gmail.com) in [2413351](https://github.com/Jannchie/lite-agent/commit/2413351)
94
+
95
+ ### :wrench: Chores
96
+
97
+ - **examples**: rename test_consolidate_history to consolidate_history - By [Jannchie](mailto:jannchie@gmail.com) in [0f5b39a](https://github.com/Jannchie/lite-agent/commit/0f5b39a)
98
+ - **tests**: remove legacy chat bubble and alignment tests - By [Jannchie](mailto:jannchie@gmail.com) in [46b23bc](https://github.com/Jannchie/lite-agent/commit/46b23bc)
99
+
100
+ ## v0.2.0
101
+
102
+ [v0.1.0...v0.2.0](https://github.com/Jannchie/lite-agent/compare/v0.1.0...v0.2.0)
103
+
104
+ ### :rocket: Breaking Changes
105
+
106
+ - **agent**: rename stream_async to completion - By [Jannchie](mailto:jannchie@gmail.com) in [dae25cc](https://github.com/Jannchie/lite-agent/commit/dae25cc)
107
+ - **messages**: add support for function call message types and responses format conversion - By [Jannchie](mailto:jannchie@gmail.com) in [9e71ccc](https://github.com/Jannchie/lite-agent/commit/9e71ccc)
108
+ - **project-structure**: rename package to lite-agent && update processor imports - By [Jannchie](mailto:jannchie@gmail.com) in [6e0747a](https://github.com/Jannchie/lite-agent/commit/6e0747a)
109
+ - **runner**: rename run_stream to run throughout codebase - By [Jannchie](mailto:jannchie@gmail.com) in [525865f](https://github.com/Jannchie/lite-agent/commit/525865f)
110
+ - **stream-handler**: rename litellm_raw to completion_raw - By [Jannchie](mailto:jannchie@gmail.com) in [9001f19](https://github.com/Jannchie/lite-agent/commit/9001f19)
111
+ - **types**: remove AgentToolCallMessage usage and definition - By [Jannchie](mailto:jannchie@gmail.com) in [fb3592e](https://github.com/Jannchie/lite-agent/commit/fb3592e)
112
+ - migrate chunk and message types to pydantic models && update runner and processors for model usage - By [Jannchie](mailto:jannchie@gmail.com) in [da0d6fc](https://github.com/Jannchie/lite-agent/commit/da0d6fc)
113
+
114
+ ### :sparkles: Features
115
+
116
+ - **agent**: support dynamic handoff and parent transfer - By [Jannchie](mailto:jannchie@gmail.com) in [5019018](https://github.com/Jannchie/lite-agent/commit/5019018)
117
+ - **agent**: add async tool call handling - By [Jannchie](mailto:jannchie@gmail.com) in [7de9103](https://github.com/Jannchie/lite-agent/commit/7de9103)
118
+ - **context**: add context support for agent and runner - By [Jannchie](mailto:jannchie@gmail.com) in [e4885ee](https://github.com/Jannchie/lite-agent/commit/e4885ee)
119
+ - **handoffs**: support multiple agents and add weather tools - By [Jannchie](mailto:jannchie@gmail.com) in [b9440ea](https://github.com/Jannchie/lite-agent/commit/b9440ea)
120
+ - **handoffs**: add agent handoff and transfer functionality - By [Jannchie](mailto:jannchie@gmail.com) in [7655029](https://github.com/Jannchie/lite-agent/commit/7655029)
121
+ - **message-transfer**: add message_transfer callback support to agent and runner && provide consolidate_history_transfer utility && add tests and usage examples - By [Jannchie](mailto:jannchie@gmail.com) in [16d4788](https://github.com/Jannchie/lite-agent/commit/16d4788)
122
+ - **runner**: add record_to param to run_until_complete - By [Jannchie](mailto:jannchie@gmail.com) in [597bff6](https://github.com/Jannchie/lite-agent/commit/597bff6)
123
+ - **runner**: support chat stream recording and improve sequence typing - By [Jannchie](mailto:jannchie@gmail.com) in [5c1d609](https://github.com/Jannchie/lite-agent/commit/5c1d609)
124
+ - **runner**: add run_continue method and require confirm tool handling - By [Jannchie](mailto:jannchie@gmail.com) in [d130ebc](https://github.com/Jannchie/lite-agent/commit/d130ebc)
125
+ - **testing**: add integration and unit tests for agent and file recording - By [Jannchie](mailto:jannchie@gmail.com) in [e5a58ce](https://github.com/Jannchie/lite-agent/commit/e5a58ce)
126
+ - **tool**: add require_confirmation support for tool calls - By [Jannchie](mailto:panjianqi@preferred.jp) in [69625c8](https://github.com/Jannchie/lite-agent/commit/69625c8)
127
+ - **tool-calls**: add require_confirm chunk type and flow - By [Jannchie](mailto:panjianqi@preferred.jp) in [b2d1654](https://github.com/Jannchie/lite-agent/commit/b2d1654)
128
+ - **types**: add agent message and tool call types - By [Jannchie](mailto:jannchie@gmail.com) in [489e370](https://github.com/Jannchie/lite-agent/commit/489e370)
129
+
130
+ ### :adhesive_bandage: Fixes
131
+
132
+ - **agent**: update tool target to completion - By [Jannchie](mailto:jannchie@gmail.com) in [6c8978c](https://github.com/Jannchie/lite-agent/commit/6c8978c)
133
+ - **examples**: simplify temper agent instructions - By [Jannchie](mailto:jannchie@gmail.com) in [6632092](https://github.com/Jannchie/lite-agent/commit/6632092)
134
+ - **loggers**: update logger name to lite_agent - By [Jannchie](mailto:jannchie@gmail.com) in [b4c59aa](https://github.com/Jannchie/lite-agent/commit/b4c59aa)
135
+ - **types**: change tool_calls from sequence to list - By [Jannchie](mailto:jannchie@gmail.com) in [334c9c0](https://github.com/Jannchie/lite-agent/commit/334c9c0)
136
+
137
+ ### :art: Refactors
138
+
139
+ - **agent**: rename prepare_messages to prepare_completion_messages - By [Jannchie](mailto:jannchie@gmail.com) in [02eeed6](https://github.com/Jannchie/lite-agent/commit/02eeed6)
140
+ - **agent**: remove unused completions to responses converter - By [Jannchie](mailto:jannchie@gmail.com) in [f6432c6](https://github.com/Jannchie/lite-agent/commit/f6432c6)
141
+ - **chunk-handler**: update type annotations and chunk types - By [Jannchie](mailto:panjianqi@preferred.jp) in [f2b95c5](https://github.com/Jannchie/lite-agent/commit/f2b95c5)
142
+ - **chunk-handler**: extract helper functions for chunk processing - By [Jannchie](mailto:jannchie@gmail.com) in [083a164](https://github.com/Jannchie/lite-agent/commit/083a164)
143
+ - **litellm**: extract chunk processing logic to function - By [Jannchie](mailto:jannchie@gmail.com) in [f31e459](https://github.com/Jannchie/lite-agent/commit/f31e459)
144
+ - **litellm-stream**: decouple funcall from stream handler && adjust runner tool call logic - By [Jannchie](mailto:jannchie@gmail.com) in [2747e7e](https://github.com/Jannchie/lite-agent/commit/2747e7e)
145
+ - **rich-channel**: extract rich channel to separate module && clean main - By [Jannchie](mailto:jannchie@gmail.com) in [a8be74d](https://github.com/Jannchie/lite-agent/commit/a8be74d)
146
+ - **runner**: modularize runner methods and simplify message handling - By [Jannchie](mailto:jannchie@gmail.com) in [628a6b5](https://github.com/Jannchie/lite-agent/commit/628a6b5)
147
+ - **tests**: parametrize tool call type tests and clean up redundant cases - By [Jannchie](mailto:jannchie@gmail.com) in [0791582](https://github.com/Jannchie/lite-agent/commit/0791582)
148
+ - **types**: move chunk types to types.py && update type imports - By [Jannchie](mailto:panjianqi@preferred.jp) in [d2ebeec](https://github.com/Jannchie/lite-agent/commit/d2ebeec)
149
+
150
+ ### :lipstick: Styles
151
+
152
+ - **tests**: improve formatting and consistency - By [Jannchie](mailto:jannchie@gmail.com) in [4342aa4](https://github.com/Jannchie/lite-agent/commit/4342aa4)
153
+
154
+ ### :memo: Documentation
155
+
156
+ - add initial project readme - By [Jannchie](mailto:panjianqi@preferred.jp) in [f04ec7a](https://github.com/Jannchie/lite-agent/commit/f04ec7a)
157
+
158
+ ### :wrench: Chores
159
+
160
+ - **ci**: switch to uv for dependency management and update to python 3.12 - By [Jannchie](mailto:panjianqi@preferred.jp) in [64d3085](https://github.com/Jannchie/lite-agent/commit/64d3085)
161
+ - **ci**: add github actions workflow - By [Jannchie](mailto:panjianqi@preferred.jp) in [051be1b](https://github.com/Jannchie/lite-agent/commit/051be1b)
162
+ - **deps**: update lock file - By [Jannchie](mailto:jannchie@gmail.com) in [9aa1e77](https://github.com/Jannchie/lite-agent/commit/9aa1e77)
163
+ - **metadata**: rename project and reformat keywords array - By [Jannchie](mailto:jannchie@gmail.com) in [2659c4d](https://github.com/Jannchie/lite-agent/commit/2659c4d)
164
+ - **metadata**: update ai topic classifier - By [Jannchie](mailto:jannchie@gmail.com) in [15d46ea](https://github.com/Jannchie/lite-agent/commit/15d46ea)
165
+ - **rename**: rename project name - By [Jannchie](mailto:jannchie@gmail.com) in [84077a8](https://github.com/Jannchie/lite-agent/commit/84077a8)
166
+
167
+ ## v0.1.0
168
+
169
+ [5859f296f4aa3bf9156e560e5bbd98b3d8795b0d...v0.1.0](https://github.com/Jannchie/lite-agent/compare/5859f296f4aa3bf9156e560e5bbd98b3d8795b0d...v0.1.0)
170
+
171
+ ### :sparkles: Features
172
+
173
+ - **chunk-handler**: add content-delta and tool-call-delta chunk types && update includes list in runner - By [Jannchie](mailto:jannchie@gmail.com) in [a3ba7d1](https://github.com/Jannchie/lite-agent/commit/a3ba7d1)
174
+ - **easy_agent**: add prompt toolkit dependency && update agent to use prompt session && improve chunk handling - By [Jannchie](mailto:jannchie@gmail.com) in [b408c14](https://github.com/Jannchie/lite-agent/commit/b408c14)
175
+
176
+ ### :art: Refactors
177
+
178
+ - **main**: remove datetime imports and usage && add input validator - By [Jannchie](mailto:jannchie@gmail.com) in [eab45b3](https://github.com/Jannchie/lite-agent/commit/eab45b3)
179
+
180
+ ### :wrench: Chores
181
+
182
+ - **import**: remove unused json tool import - By [Jannchie](mailto:jannchie@gmail.com) in [8de5975](https://github.com/Jannchie/lite-agent/commit/8de5975)
183
+ - **lock**: update lock file - By [Jannchie](mailto:jannchie@gmail.com) in [64880d3](https://github.com/Jannchie/lite-agent/commit/64880d3)
184
+ - **pyproject**: update version && improve description && expand keywords && add classifiers - By [Jannchie](mailto:jannchie@gmail.com) in [c3e8ee6](https://github.com/Jannchie/lite-agent/commit/c3e8ee6)
@@ -0,0 +1,100 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Development Commands
6
+
7
+ ### Testing
8
+
9
+ ```bash
10
+ pytest # Run all tests
11
+ pytest tests/unit/ # Run only unit tests
12
+ pytest tests/integration/ # Run only integration tests
13
+ pytest --cov # Run with coverage
14
+ ```
15
+
16
+ ### Linting and Formatting
17
+
18
+ ```bash
19
+ ruff check # Run linter
20
+ ruff format # Format code
21
+ ```
22
+
23
+ ### Package Management
24
+
25
+ ```bash
26
+ uv add lite-agent # Install from PyPI
27
+ uv add --dev lite-agent # Install dev package
28
+ ```
29
+
30
+ ## Project Architecture
31
+
32
+ LiteAgent is a lightweight AI agent framework built on top of LiteLLM. The core architecture consists of:
33
+
34
+ ### Core Components
35
+
36
+ **Agent (`src/lite_agent/agent.py`)**
37
+
38
+ - Central agent class that manages LLM interactions, tool calls, and message handling
39
+ - Supports tool registration via `funcall` library for type-safe function calling
40
+ - Handles agent handoffs (parent-child relationships) for complex workflows
41
+ - Manages completion conditions ("stop" vs "call" for different termination behaviors)
42
+ - Converts between OpenAI's Response API and Completion API message formats
43
+
44
+ **Runner (`src/lite_agent/runner.py`)**
45
+
46
+ - Orchestrates agent execution with streaming support
47
+ - Manages conversation flow and message history
48
+ - Handles tool call execution and agent transfers
49
+ - Supports continuation from previous states and chat history management
50
+ - Provides both streaming and batch execution modes
51
+
52
+ **Type System (`src/lite_agent/types/`)**
53
+
54
+ - Comprehensive Pydantic models for all message types and chunks
55
+ - Supports both Response API and Completion API formats
56
+ - Type-safe definitions for tool calls, chunks, and messages
57
+
58
+ ### Key Features
59
+
60
+ **Tool Integration**
61
+
62
+ - Uses `funcall` library for automatic tool schema generation from Python functions
63
+ - Supports basic types, Pydantic models, and dataclasses as parameters
64
+ - Dynamic tool registration for agent handoffs and control flow
65
+
66
+ **Agent Handoffs**
67
+
68
+ - Parent-child agent relationships for complex task delegation
69
+ - Automatic `transfer_to_agent` and `transfer_to_parent` tool registration
70
+ - Chat history tracking across agent transitions
71
+
72
+ **Message Processing**
73
+
74
+ - Bidirectional conversion between OpenAI API formats
75
+ - Streaming chunk processing with configurable output filtering
76
+ - Message transfer callbacks for preprocessing
77
+
78
+ **Completion Modes**
79
+
80
+ - `"stop"`: Traditional completion until model decides to stop
81
+ - `"call"`: Completion until specific tool (`wait_for_user`) is called
82
+
83
+ ### Examples Directory Structure
84
+
85
+ Examples demonstrate various usage patterns:
86
+
87
+ - `basic.py`: Simple agent with tool calling
88
+ - `handoffs.py`: Agent-to-agent transfers
89
+ - `context.py`: Context passing to tools
90
+ - `chat_display_demo.py`: Rich console output formatting
91
+ - `channels/`: Channel-based communication patterns
92
+
93
+ ### Testing Architecture
94
+
95
+ - **Unit tests**: Test individual components in isolation
96
+ - **Integration tests**: Test full agent workflows with mocked LLM responses
97
+ - **Performance tests**: Test memory usage and performance characteristics
98
+ - **Mock system**: JSONL-based conversation recording/playback for deterministic testing
99
+
100
+ The framework emphasizes simplicity and extensibility while maintaining full type safety and comprehensive streaming support.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lite-agent
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: A lightweight, extensible framework for building AI agent.
5
5
  Author-email: Jianqi Pan <jannchie@gmail.com>
6
6
  License: MIT
@@ -18,7 +18,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
18
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
19
  Requires-Python: >=3.10
20
20
  Requires-Dist: aiofiles>=24.1.0
21
- Requires-Dist: funcall>=0.7.0
21
+ Requires-Dist: funcall>=0.10.0
22
22
  Requires-Dist: prompt-toolkit>=3.0.51
23
23
  Requires-Dist: rich>=14.0.0
24
24
  Description-Content-Type: text/markdown
@@ -4,6 +4,7 @@ import logging
4
4
  from rich.logging import RichHandler
5
5
 
6
6
  from lite_agent.agent import Agent
7
+ from lite_agent.chat_display import display_messages
7
8
  from lite_agent.runner import Runner
8
9
 
9
10
  logging.basicConfig(
@@ -19,7 +20,6 @@ logger.setLevel(logging.DEBUG)
19
20
 
20
21
  async def get_temperature(city: str) -> str:
21
22
  """Get the temperature for a city."""
22
- await asyncio.sleep(1)
23
23
  return f"The temperature in {city} is 25°C."
24
24
 
25
25
 
@@ -35,12 +35,13 @@ async def main():
35
35
  runner = Runner(agent)
36
36
  resp = runner.run(
37
37
  "What is the temperature in New York?",
38
- includes=["final_message", "usage", "tool_call", "tool_call_result"],
39
- record_to="tests/mocks/basic/1.jsonl",
38
+ includes=["usage", "assistant_message", "function_call", "function_call_output", "timing"],
40
39
  )
41
40
  async for chunk in resp:
42
41
  logger.info(chunk)
42
+ display_messages(runner.messages)
43
43
  print(runner.messages)
44
44
 
45
+
45
46
  if __name__ == "__main__":
46
47
  asyncio.run(main())
@@ -0,0 +1,54 @@
1
+ import asyncio
2
+ import logging
3
+
4
+ from rich.logging import RichHandler
5
+
6
+ from lite_agent.agent import Agent
7
+
8
+ logging.basicConfig(
9
+ level=logging.WARNING,
10
+ format="%(message)s",
11
+ datefmt="[%X]",
12
+ handlers=[RichHandler(rich_tracebacks=True)],
13
+ )
14
+
15
+ logger = logging.getLogger("lite_agent")
16
+ logger.setLevel(logging.DEBUG)
17
+
18
+
19
+ async def get_temperature(city: str) -> str:
20
+ """Get the temperature for a city."""
21
+ await asyncio.sleep(1)
22
+ return f"The temperature in {city} is 25°C."
23
+
24
+
25
+ async def get_whether(city: str) -> str:
26
+ """Get the weather for a city."""
27
+ await asyncio.sleep(1)
28
+ return f"The weather in {city} is sunny with a few clouds."
29
+
30
+
31
+ agent = Agent(
32
+ model="gpt-4.1-nano",
33
+ name="Weather Assistant",
34
+ instructions="You are a helpful weather assistant. Before using tools, briefly explain what you are going to do. Provide friendly and informative responses.",
35
+ tools=[get_temperature, get_whether],
36
+ )
37
+
38
+
39
+ async def main():
40
+ resp = await agent.completion(
41
+ [
42
+ {
43
+ "role": "user",
44
+ "content": "What is the temperature and whether in New York?",
45
+ },
46
+ ],
47
+ )
48
+ async for chunk in resp:
49
+ if chunk.type != "completion_raw":
50
+ logger.info(chunk)
51
+
52
+
53
+ if __name__ == "__main__":
54
+ asyncio.run(main())
@@ -1,31 +1,32 @@
1
1
  from rich.console import Console
2
2
 
3
- from lite_agent.types import AgentChunk, ContentDeltaChunk
3
+ from lite_agent.types import AgentChunk, ContentDeltaEvent
4
4
 
5
5
 
6
6
  class RichChannel:
7
7
  def __init__(self) -> None:
8
8
  self.console = Console()
9
9
  self.map = {
10
- "final_message": self.handle_final_message,
11
- "tool_call": self.handle_tool_call,
12
- "tool_call_result": self.handle_tool_call_result,
13
- "tool_call_delta": self.handle_tool_call_delta,
10
+ "function_call": self.handle_tool_call,
11
+ "function_call_output": self.handle_tool_call_result,
12
+ "function_call_delta": self.handle_function_call_delta,
14
13
  "content_delta": self.handle_content_delta,
15
14
  "usage": self.handle_usage,
16
- "require_confirm": self.handle_require_confirm,
17
15
  }
18
- self.new_turn = True
16
+ self._new_turn = True
19
17
 
20
18
  async def handle(self, chunk: AgentChunk):
21
- handler = self.map[chunk.type]
22
- return await handler(chunk)
19
+ handler = self.map.get(chunk.type)
20
+ if handler is None:
21
+ return None
22
+ return await handler(chunk) # type: ignore
23
23
 
24
- async def handle_final_message(self, _chunk: AgentChunk):
24
+ def new_turn(self):
25
25
  print()
26
- self.new_turn = True
26
+ self._new_turn = True
27
27
 
28
28
  async def handle_tool_call(self, chunk: AgentChunk):
29
+ print()
29
30
  name = getattr(chunk, "name", "<unknown>")
30
31
  arguments = getattr(chunk, "arguments", "")
31
32
  self.console.print(f"🛠️ [green]{name}[/green]([yellow]{arguments}[/yellow])")
@@ -35,16 +36,14 @@ class RichChannel:
35
36
  content = getattr(chunk, "content", "")
36
37
  self.console.print(f"🛠️ [green]{name}[/green] → [yellow]{content}[/yellow]")
37
38
 
38
- async def handle_tool_call_delta(self, chunk: AgentChunk): ...
39
- async def handle_content_delta(self, chunk: ContentDeltaChunk):
40
- if self.new_turn:
39
+ async def handle_function_call_delta(self, chunk: AgentChunk): ...
40
+ async def handle_content_delta(self, chunk: ContentDeltaEvent):
41
+ if self._new_turn:
41
42
  self.console.print("🤖 ", end="")
42
- self.new_turn = False
43
+ self._new_turn = False
43
44
  print(chunk.delta, end="", flush=True)
44
45
 
45
46
  async def handle_usage(self, chunk: AgentChunk):
46
47
  if False:
47
48
  usage = chunk.usage
48
49
  self.console.print(f"In: {usage.prompt_tokens}, Out: {usage.completion_tokens}, Total: {usage.total_tokens}")
49
-
50
- async def handle_require_confirm(self, chunk: AgentChunk): ...
@@ -0,0 +1,113 @@
1
+ """
2
+ 示例:使用 chat_display 美观显示聊天记录
3
+
4
+ 这个示例展示了如何使用 chat_display 模块中的函数来美观地显示聊天记录。
5
+ """
6
+
7
+ import asyncio
8
+
9
+ from lite_agent import display_messages
10
+ from lite_agent.agent import Agent
11
+ from lite_agent.runner import Runner
12
+
13
+
14
+ def demo_tools():
15
+ """演示工具函数,用于测试函数调用显示。"""
16
+
17
+ def get_weather(city: str) -> str:
18
+ """获取指定城市的天气信息。"""
19
+ return f"The weather in {city} is sunny with 25°C"
20
+
21
+ def calculate(expression: str) -> str:
22
+ """计算数学表达式。"""
23
+ try:
24
+ result = eval(expression) # noqa: S307
25
+ except Exception as e:
26
+ return f"Error calculating {expression}: {e}"
27
+ else:
28
+ return f"{expression} = {result}"
29
+
30
+ return [get_weather, calculate]
31
+
32
+
33
+ async def create_sample_chat_history() -> Runner:
34
+ """创建一个包含各种消息类型的示例聊天历史。"""
35
+ # 创建 agent
36
+ agent = Agent(
37
+ model="gpt-4o-mini",
38
+ name="DemoAgent",
39
+ instructions="You are a helpful assistant that can provide weather information and perform calculations.",
40
+ tools=demo_tools(),
41
+ )
42
+
43
+ # 创建 runner
44
+ runner = Runner(agent=agent)
45
+
46
+ # 手动添加一些示例消息来展示不同的消息类型
47
+ runner.append_message({"role": "system", "content": "You are a helpful assistant."})
48
+ runner.append_message({"role": "user", "content": "Hello! Can you help me with some tasks?"})
49
+ runner.append_message({"role": "assistant", "content": "Of course! I'd be happy to help you. What would you like to do?"})
50
+ runner.append_message({"role": "user", "content": "What's the weather like in Tokyo?"})
51
+
52
+ # 添加函数调用消息
53
+ runner.append_message(
54
+ {
55
+ "type": "function_call",
56
+ "call_id": "call_123",
57
+ "name": "get_weather",
58
+ "arguments": '{"city": "Tokyo"}',
59
+ "content": "",
60
+ },
61
+ )
62
+
63
+ # 添加函数调用输出
64
+ runner.append_message(
65
+ {
66
+ "type": "function_call_output",
67
+ "call_id": "call_123",
68
+ "output": "The weather in Tokyo is sunny with 25°C",
69
+ },
70
+ )
71
+
72
+ runner.append_message({"role": "assistant", "content": "The weather in Tokyo is sunny with a temperature of 25°C. Is there anything else you'd like to know?"})
73
+ runner.append_message({"role": "user", "content": "Can you calculate 25 * 4 + 10?"})
74
+
75
+ # 添加另一个函数调用
76
+ runner.append_message(
77
+ {
78
+ "type": "function_call",
79
+ "call_id": "call_456",
80
+ "name": "calculate",
81
+ "arguments": '{"expression": "25 * 4 + 10"}',
82
+ "content": "",
83
+ },
84
+ )
85
+
86
+ runner.append_message(
87
+ {
88
+ "type": "function_call_output",
89
+ "call_id": "call_456",
90
+ "output": "25 * 4 + 10 = 110",
91
+ },
92
+ )
93
+
94
+ runner.append_message({"role": "assistant", "content": "The calculation 25 * 4 + 10 equals 110."})
95
+
96
+ return runner
97
+
98
+
99
+ async def main():
100
+ """主函数:演示 chat_display 的使用。"""
101
+ print("🎨 Chat Display Demo\n")
102
+
103
+ # 创建示例聊天历史
104
+ runner = await create_sample_chat_history()
105
+
106
+ # print demo
107
+ display_messages(
108
+ runner.messages,
109
+ )
110
+
111
+
112
+ if __name__ == "__main__":
113
+ asyncio.run(main())
@@ -43,13 +43,13 @@ async def main():
43
43
  runner = Runner(agent)
44
44
  resp = runner.run(
45
45
  "What is the weather in New York? And what is the temperature there?",
46
- includes=["final_message", "usage", "tool_call", "tool_call_result"],
46
+ includes=["usage", "assistant_message", "function_call", "function_call_output"],
47
47
  record_to="tests/mocks/confirm_and_continue/1.jsonl",
48
48
  )
49
49
  async for chunk in resp:
50
50
  logger.info(chunk)
51
51
  resp = runner.run_continue_stream(
52
- includes=["final_message", "usage", "tool_call", "tool_call_result"],
52
+ includes=["usage", "assistant_message", "function_call", "function_call_output"],
53
53
  record_to="tests/mocks/confirm_and_continue/2.jsonl",
54
54
  )
55
55
  async for chunk in resp:
@@ -26,7 +26,7 @@ def test_consolidate_history():
26
26
  print("Consolidated messages count:", len(result))
27
27
  print("\nConsolidated content:")
28
28
  print("=" * 50)
29
- if result and isinstance(result[0], dict):
29
+ if result and isinstance(result[0], dict) and "content" in result[0]:
30
30
  print(result[0]["content"])
31
31
  print("=" * 50)
32
32
 
@@ -38,7 +38,7 @@ def test_consolidate_history():
38
38
  single_message = [{"role": "user", "content": "Just a simple test"}]
39
39
  single_result = consolidate_history_transfer(single_message)
40
40
  print(f"\nSingle message result count: {len(single_result)}")
41
- if single_result and isinstance(single_result[0], dict):
41
+ if single_result and isinstance(single_result[0], dict) and "content" in single_result[0]:
42
42
  print("Single message consolidated content:")
43
43
  print(single_result[0]["content"])
44
44