- Newest
- Most votes
- Most comments
It looks like you're encountering an error when trying to use DeepSeek models with the Strands SDK. The error suggests there's an issue with the JSON formatting when making requests to the DeepSeek API.
When working with Amazon Bedrock and DeepSeek models, you need to ensure you're using the correct format for the API calls. For DeepSeek-R1 specifically, there's a particular format required for prompts and requests.
Instead of using the LiteLLM approach, I'd recommend using Amazon Bedrock's native SDK for working with DeepSeek models. Here's how you might approach it:
import boto3 import json from strands import Agent # Create a Bedrock Runtime client bedrock_runtime = boto3.client("bedrock-runtime", region_name="us-west-2") # Use the DeepSeek model through Amazon Bedrock model_id = "us.deepseek.r1-v1:0" # Create your agent using Bedrock's implementation # Note: You'll need to adapt this to the Strands SDK requirements agent = Agent(model=bedrock_model, tools=[calculator])
When working with Strands Agents and Amazon Bedrock, be aware of token limits as well. If you make too many requests or use too many tokens in a short period, you might encounter throttling exceptions with messages like "Too many tokens, please wait before trying again."
If you continue to face issues, you might want to check:
- That you're using the correct format for DeepSeek models
- That your session IDs aren't too long (keep them under 32 characters)
- That you have the proper IAM permissions configured
Sources
Building Agentic AI app with Strands Agents & MCP | AWS re:Post
Amazon Lex API Call Fails: "Invalid Bot Configuration: Amazon Lex could not access your Amazon Bedrock Agent" | AWS re:Post
DeepSeek models - Amazon Bedrock
answered a year ago
Relevant content
asked a year ago
asked a year ago
asked a year ago

Can you run the example present here https://strandsagents.com/latest/documentation/docs/user-guide/concepts/model-providers/litellm/
I see in your code the "param" section also missing after the model_id.