Your first agent
An agent is an object with a name and a set of instructions. That is all it takes to make one, and nothing runs when you do.
from agents import Agent
support = Agent(
name="Support",
instructions="You answer questions about orders. Be brief.",
)The name is for you and for the traces you will read in lesson 22. The instructions are what the model is told about how to behave, on every single turn.
print("name: ", support.name)
print("instructions:", support.instructions)
print("tools: ", support.tools)No tools, and no model named either. Creating an agent does not call anything, which is why this runs with no key and no network.
What an agent is not
It is not a running process, and it is not a conversation. It is a description: who this is, what it is told, what it is allowed to use. Something else has to take that description and run it, and that arrives in lesson 4.
Everything you add over the next twenty three lessons is another field on this object. Tools, a model, other agents to hand work to, guards on the way in and out. It stays one object.
- Change the name and run it again.
- Make a second agent with different instructions and print both.
- Print
supporton its own and look at every field an agent carries.
Little by little, you're building something great.