OpenAI Agents SDKopenai-agents 0.22 · Python 3.10+
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
25 small wins to finish your pathNext lesson

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.

python
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.

Example
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.

Try it yourself
  • Change the name and run it again.
  • Make a second agent with different instructions and print both.
  • Print support on its own and look at every field an agent carries.

Little by little, you're building something great.