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
smolagents environment is set up and litellm is installed (pip install 'smolagents[litellm]').
- Have
acp_sdk installed and running locally with agents at http://localhost:8000 and http://localhost:8001 (as per the test.py setup).
- Use the
fastacp.py script (specifically, the version prior to the recent fixes).
- Execute the
L8.ipynb notebook 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]
smolagents version: [1.20.0]
litellm version: [1.72.6]
acp_sdk version: [1.0.0]
Hi Nick,
Greetings!!
When attempting to integrate and run
fastacp.pywithsmolagents.models.LiteLLMModel, the script consistently encountersAttributeError: 'dict' object has no attribute 'role'.This prevents the
ACPCallingAgentfrom successfully making calls to theLiteLLMModel.Steps to Reproduce:
smolagentsenvironment is set up andlitellmis installed (pip install 'smolagents[litellm]').acp_sdkinstalled and running locally with agents athttp://localhost:8000andhttp://localhost:8001(as per thetest.pysetup).fastacp.pyscript (specifically, the version prior to the recent fixes).L8.ipynbnotebook provided in the repository.Expected Behavior:
The
ACPCallingAgentshould successfully interact with theLiteLLMModel, 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 underlyingsmolagents.models.ChatMessageclass and internal message processing viaget_clean_message_list) has a strict expectation for the format of chat messages. The previousfastacp.pyscript was passing messages either as plain Python dictionaries orsmolagents.models.ChatMessageobjects whosecontentattribute was a simple string.Environment:
smolagentsversion: [1.20.0]litellmversion: [1.72.6]acp_sdkversion: [1.0.0]