AWS SageMaker
Use AWS SageMaker models with PraisonAI Agents
Point an Agent at AWS SageMaker by setting your credentials and naming the model.
Quick Start
- Install
bash pip install "praisonaiagents[llm]" - Set credentials
bash export AWS_ACCESS_KEY_ID=your-access-key export AWS_SECRET_ACCESS_KEY=your-secret-key export AWS_REGION_NAME=us-east-1 - Run an agent
python from praisonaiagents import Agent agent = Agent( instructions="You are a helpful assistant", model="sagemaker/meta-llama/Llama-3.1-8B-Instruct", ) agent.start("Hello!")
How it works
The sagemaker/ prefix tells PraisonAI to route the request through litellm to AWS SageMaker, which reads AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME from your environment. See Provider Auto-Detection for how model strings are resolved.
Common Patterns
Pick a different model
Keep the sagemaker/ prefix and swap the rest for any model your AWS SageMaker account offers.
from praisonaiagents import Agent
agent = Agent(
instructions="You are a helpful assistant",
model="sagemaker/<your-endpoint-name>",
)Tune the response with a config dict
Pass a dict to set temperature, token limits, or other options.
from praisonaiagents import Agent
agent = Agent(
instructions="You write short, friendly answers",
model={
"model": "sagemaker/meta-llama/Llama-3.1-8B-Instruct",
"temperature": 0.3,
"max_tokens": 500,
},
)
agent.start("Give me three tips for better sleep.")Best Practices
Prefer the shortest form
Start with model="sagemaker/meta-llama/Llama-3.1-8B-Instruct" and nothing else. Add a config dict only when you need to tune temperature or limits.
Set the provider key once via env
Export AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME in your shell or .env file. Keep keys out of your code.
Keep model= canonical
Always use model=. The older llm= name still works but prints a deprecation warning. See Model Parameter.