BerriAI/litellm · error · ValueError
Invalid model format. Expected format: 'model=agent/AGENT_ID
Error message
Invalid model format. Expected format: 'model=agent/AGENT_ID/ALIAS_ID'
What it means
Error "Invalid model format. Expected format: 'model=agent/AGENT_ID/ALIAS_ID'" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/bedrock/chat/invoke_agent/transformation.py:139
optional_params=optional_params,
request_data=request_data,
api_base=api_base,
model=model,
stream=stream,
fake_stream=fake_stream,
api_key=api_key,
)
def _get_agent_id_and_alias_id(self, model: str) -> tuple[str, str]:
"""
model = "agent/L1RT58GYRW/MFPSBCXYTW"
agent_id = "L1RT58GYRW"
agent_alias_id = "MFPSBCXYTW"
"""
# Split the model string by '/' and extract components
parts: Final = model.split("/")
if len(parts) != 3 or parts[0] != "agent":
raise ValueError("Invalid model format. Expected format: 'model=agent/AGENT_ID/ALIAS_ID'")
return parts[1], parts[2] # Return (agent_id, agent_alias_id)
def _get_session_id(self, optional_params: dict) -> str:
""" """
return optional_params.get("sessionID", None) or str(uuid.uuid4())
def transform_request(
self,
model: str,
messages: list[AllMessageValues],
optional_params: dict,
litellm_params: dict,
headers: dict,
) -> dict:
# use the last message content as the query
query: Final[str] = convert_content_list_to_str(messages[-1])
return {View on GitHub (pinned to 6c2dcb801b)
Solutions
- Use model format 'agent/AGENT_ID/ALIAS_ID'.
When it happens
Trigger: Thrown at litellm/llms/bedrock/chat/invoke_agent/transformation.py:139 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/63d3ed55bbabc40f.
Report an issue: GitHub.