Lesson 1: Your First AI Agent
Welcome to the first lesson of the AWS Strands course! Here, you'll learn the fundamentals of creating a simple but powerful AI agent.
We'll build a weather assistant that can understand a question, fetch live data from an external API, and provide a helpful answer. This will introduce you to the core concepts of the Strands SDK:
- Agent Creation: How to instantiate an agent.
- Model Configuration: How to connect your agent to a large language model (LLM).
- Tool Usage: How to give your agent abilities, like accessing the internet.
Key Concepts Explained
-
System Prompt: The
WEATHER_SYSTEM_PROMPTis the agent's constitution. It's a detailed set of instructions that defines the agent's personality, its capabilities, and the exact steps it should follow. A well-crafted system prompt is crucial for reliable agent behavior. -
Model Configuration:
LiteLLMModelis a bridge to the language model that acts as the agent's "brain". Strands useslitellmunder the hood, which means you can easily switch between dozens of LLM providers (like OpenAI, Anthropic, Google, etc.) just by changing themodel_id. -
Tool Usage: Tools are the agent's hands and eyes. By giving the agent the
http_requesttool, we grant it the ability to access the internet. The agent's LLM brain knows how to use this tool to follow the instructions in the system prompt. -
Agent Instantiation: The
Agentclass brings everything together. We provide it with the system prompt, the model, and the tools it's allowed to use. -
Invocation: Calling the agent is as simple as calling a function:
weather_agent(user_query). The agent takes the query, thinks step-by-step (using the LLM), uses its tools as needed, and returns a final, synthesized answer.
Further Learning
- Watch the Video: AWS Strands Course Playlist
- Read the Docs: Official Strands Documentation
Navigation
| Previous Lesson | Next Lesson |
|---|---|
| N/A | Lesson 2: Session Management |