-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Hi Nick,
Greetings!!
When attempting to integrate and run fastacp.py with smolagents.models.LiteLLMModel, the script consistently encounters AttributeError: 'dict' object has no attribute 'role'.
This prevents the ACPCallingAgent from successfully making calls to the LiteLLMModel.
Steps to Reproduce:
- Ensure a
smolagentsenvironment is set up andlitellmis installed (pip install 'smolagents[litellm]'). - Have
acp_sdkinstalled and running locally with agents athttp://localhost:8000andhttp://localhost:8001(as per thetest.pysetup). - Use the
fastacp.pyscript (specifically, the version prior to the recent fixes). - Execute the
L8.ipynbnotebook provided in the repository.
Expected Behavior:
The ACPCallingAgent should successfully interact with the LiteLLMModel, process messages, call relevant ACP agents, and return a final answer without errors.
Actual Behavior (Error Trace Snippet):
Calling model with messages: [{'role': 'system', 'content': "..."}] Error details - message format: [{'role': 'system', 'content': "..."}] Error details - tools: ['policy_agent', 'health_agent'] [ERROR] Error while generating or parsing output:'dict' object has no attribute 'role' [ERROR] Error in step 1: Error while generating or parsing output:'dict' object has no attribute 'role'
Root Cause:
The smolagents.models.LiteLLMModel (and the underlying smolagents.models.ChatMessage class and internal message processing via get_clean_message_list) has a strict expectation for the format of chat messages. The previous fastacp.py script was passing messages either as plain Python dictionaries or smolagents.models.ChatMessage objects whose content attribute was a simple string.
Environment:
- Python Version: [3.12]
smolagentsversion: [1.20.0]litellmversion: [1.72.6]acp_sdkversion: [1.0.0]