Agent: name, instructions and tools
An Agent is a configuration object that pairs a model with a name, a set of instructions, and a list of tools the model may call.
Last updated: 28 Sep, 2026 · openai-agents 0.22.3
An Agent holds no logic of its own. It records what the agent is called, how it should behave, and what it is allowed to do. The Runner from lesson 4 is what turns that configuration into a run; here you build the configuration and read its fields.
The Agent constructor
You create an Agent by passing keyword arguments. Only name is required; instructions and tools default to nothing.
from agents import Agent
agent = Agent(
name="Shop", # a label for this agent
instructions="Help with orders.", # the system prompt
tools=[], # functions it may call (none yet)
)Naming the agent
name is a short label. It shows up when you inspect a run and when one agent hands off to another, so give each agent a distinct name.
agent = Agent(name="Shop") # name is the only required fieldWriting the instructions
instructions is the system prompt: the standing message that tells the model how to behave. It is not the customer's question; that arrives when you run the agent.
agent = Agent(
name="Shop",
instructions="Help the customer with their order.", # system prompt
)Listing tools
tools is the list of functions the model may call. It is empty here; lesson 5 adds a real tool to it.
agent = Agent(name="Shop", instructions="Help.", tools=[]) # no tools yetReading an agent's fields
Creating an Agent needs no model call, so this runs on its own. It prints the three fields you set.
from agents import Agent
shop_agent = Agent(name="Shop", instructions="Help the customer with their order.")
print("name:", shop_agent.name)
print("instructions:", shop_agent.instructions)
print("tools:", shop_agent.tools)What the three fields held
- name came back as the string you passed,
Shop. - instructions is stored as given; the model reads it as the system prompt at run time.
- tools is an empty list, because none were passed; the model can call nothing yet.
instructions vs a run message
| instructions | run message | |
|---|---|---|
| Set where | On the Agent, once | Passed to the Runner, per run |
| Role | System prompt (how to behave) | User turn (what to answer) |
| Changes per question | No | Yes |
Where you configure agents
- Giving each agent in a multi-agent flow a clear name and job.
- Putting rules the agent must always follow into instructions.
- Collecting the tools an agent is allowed to use in one place.
instructions makes it a standing rule for every run instead of a one-off request.Related
- Previous: Setup: install the openai-agents package
- Next: Model: a stand-in you can run without a key
- Reference: Agents
- Change
nameto"Refunds"and print it. - Add a second sentence to
instructionsand print the field. - Print
len(agent.tools)and confirm it is0.
You understood something today that you didn't yesterday.