ToolBot and AsyncToolBot — EARS
Parent LLD: ./LLD.md
Tool registration
-
[x] CORE-TOOL-001: Where
toolsisNoneor empty,ToolBot.__init__shall useDEFAULT_TOOLSas the full tool list. -
[x] CORE-TOOL-002: Where
toolsis non-empty and does not include allDEFAULT_TOOLSby function name, the system shall prependDEFAULT_TOOLSbefore the user tools. -
[x] CORE-TOOL-003: The system shall expose LiteLLM
toolsas the list ofjson_schemaattributes from the resolved tool functions and shall map__name__to the callable inname_to_tool_map.
Message composition
-
[x] CORE-TOOL-010:
compose_tool_messagesshall resolve callable arguments by invoking them and requiring astrresult wrapped inHumanMessage. -
[x] CORE-TOOL-011: When
chat_memoryis set and user messages exist, the message list shall includechat_memory.retrieve(user_messages[0].content)after the system prompt. -
[x] CORE-TOOL-012: When
execution_historyis provided, the system shall append aSystemMessagesummarizing up to the last five tool calls before the user messages.
ToolBot sync
- [x] CORE-TOOL-020:
ToolBot.__call__shall return the list fromextract_tool_callsaftermake_responseandstream_chunks, and shall append the first user message and anAIMessagewhose content is the string representation of that tool-call list tochat_memory.
AsyncToolBot
-
[x] CORE-TOOL-030:
AsyncToolBot.__call__shall obtain completions viamake_async_responseand shall assemble the finalModelResponsewithasync_stream_chunksbeforeextract_tool_calls. -
[x] CORE-TOOL-031:
AsyncToolBot.__call__shall not wrap synchronousToolBot.__call__inasyncio.to_thread; it shall use nativeacompletion.
Verification
| ID | Tests / code |
|---|---|
| CORE-TOOL-001–003 | tests/bot/test_toolbot.py |
| CORE-TOOL-010–012 | tests/bot/test_toolbot.py (compose_tool_messages) |
| CORE-TOOL-020 | tests/bot/test_toolbot.py |
| CORE-TOOL-030–031 | tests/bot/test_async_toolbot_call.py, llamabot/bot/toolbot.py (AsyncToolBot) |