Immutable solution version
Strands agent can't support LiteLLM model with Groq and Cerebras
Complete solution
How to strands agent can't support LiteLLM model with Groq and Cerebras. Verified in gh:strands-agents/harness-sdk#729.
What this teaches
How to strands agent can't support LiteLLM model with Groq and Cerebras.
The problem
Issue strands-agents/harness-sdk#729 (closed, 11 comments): ### Checks - [x] I have updated to the lastest minor and patch version of Strands - [x] I have checked the documentation and this is not expected behavior - [x] I have searched [./issues](./issues?q=) and there are no duplicates of my issue ### Strands Version 1.5.0 ### Python Version 3.12.11 ### Operating System Colab notebook ### Installation Method pip ### Steps to Reproduce # Problem Statement Currently, LiteLLM model supports Cerebras and Groq provider, but i cannot use them in strands agent - It appears strands_agents wrapper of litellm did not passed the input correctly, which result...
What worked (verified answer)
If a Strands agent can't use LiteLLM with Groq or Cerebras, especially when tools are involved, the root cause is LiteLLM's inconsistent content format across providers: OpenAI expects content as a list of parts ([{type: text, text: ...}]) while Cerebras and Groq expect a plain string. A community fix addresses this by overriding message formatting in LiteLLMModel (formatrequestmessagecontents / formatrequest_messages) so tool messages get provider-compatible formatting too. When debugging similar provider errors in Strands, check how message content is shaped for the target provider before assuming the provider key or model is the problem.
Source
gh:strands-agents/harness-sdk#729 - https://github.com/strands-agents/harness-sdk/issues/729
Evidence
In gh:strands-agents/harness-sdk#729, the reporter ran into: Issue strands-agents/harness-sdk#729 (closed, 11 comments): ### Checks - [x] I have updated to the lastest minor and patch version of Strands - [x] I have checked the documentation and this is not expected behavior - [x] I have searched [./issues](./issues?q=) and there are no duplicates of my issue ### Strands Version 1.5.0 ### Python Version 3.12.11 ### Operating System Colab notebook ### Installation Method pip ### Steps to Reproduce # Problem Statement Currently, LiteLLM model supports Cerebras and Groq provider, but i cannot use them in strands agent - It appears strandsagents wrapper... The verified answer was: If a Strands agent can't use LiteLLM with Groq or Cerebras, especially when tools are involved, the root cause is LiteLLM's inconsistent content format across providers: OpenAI expects content as a list of parts ([{type: text, text: ...}]) while Cerebras and Groq expect a plain string. A community fix addresses this by overriding message formatting in LiteLLMModel (formatrequestmessagecontents / formatrequestmessages) so tool messages get provider-compatible formatting too. When debugging similar provider errors in Strands, check how message content is shaped for the target provider before assuming the provider key or model is the problem. Source issue: https://github.com/strands-agents/harness-sdk/issues/729
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_1V2gDN4g-so9o5CrrMxg5Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Strands agent can't support LiteLLM model with Groq and Cerebras <span>— Vectle</span></a>