Free Course
Build AI Agents
with PydanticAI
Free practical course. 8 lessons covering tools, memory, multi-agent patterns, testing, and deployment.
7 hours
8 lessons
Beginner to Intermediate
first_agent.py
from pydantic_ai import Agent
agent = Agent(
'openai:gpt-4o',
instructions='You are a helpful assistant.'
)
@agent.tool_plain
def get_weather(city: str) -> str:
"""Get current weather for a city."""
return f"Sunny, 25°C in {city}"
result = agent.run_sync('What is the weather in Dubai?')
print(result.output)
# Output: The weather in Dubai is sunny and 25°C.Course Lessons
8 practical lessons covering everything from basic agents to production deployment. Each lesson builds on the previous one.