Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsAn AI agent is a model-driven system that can respond to instructions and, when equipped with tools or handoffs, take actions and continue working through a task. In the OpenAI Agents SDK for TypeScript, a runner calls the agent, handles its requested actions or transfers, and repeats until it receives a final answer or reaches a configured stop condition. That is an implementation-oriented explanation of this SDK—not a universal formal definition of every system described as an agent.
What makes an AI agent more than a prompt?
A prompt supplies directions; an agent is the configured model-and-control setup that acts on those directions. The OpenAI Agents SDK describes its framing this way: “An agent is an LLM equipped with instructions, tools and handoffs.” Those capabilities are possible parts of an agent, not a checklist every agent must satisfy. A simple agent may have instructions and no tools; another may use tools or pass work to a specialist.
Instructions are the directions attached to an agent definition. The SDK guide describes them as the agent’s system prompt. A tool is a callable capability the agent can use to take an action. A handoff transfers control of the run to another agent. Together, these concepts distinguish an agent from a single model response: the model can request work, while the surrounding runner determines what happens next.
How does the agent loop work?
The loop is iterative. The runner invokes the current agent with the conversation, examines the model’s response, and either returns a final answer or handles a requested action before calling a model again. The OpenAI Agents SDK puts it simply: “Agents do nothing by themselves – you run them with the Runner class or the run() utility.”
#1 Best Overall
- Start with the configured agent and the user’s input.
- Call the current agent with the conversation.
- If the response is final output, return it.
- If the response requests a tool, execute the tool, add its result to the conversation, and call the agent again.
- If the response hands off control, switch to the receiving agent and continue the run.
This is a conceptual outline of the SDK runner’s flow, not a claim about a hand-written implementation. The exact response handling depends on whether the model produced final output, tool calls, or a handoff. The runner can also stop with an exception if a configured maximum turn count is exceeded; that is SDK control behavior, not a requirement shared by all agent architectures.
A minimal TypeScript agent
The official OpenAI Agents SDK for TypeScript uses this concise pattern to define an agent, run it with a string input, and print its final output:
Rank #2
import { Agent, run } from '@openai/agents';
const agent = new Agent({
name: 'Assistant',
instructions: 'You are a helpful assistant',
});
const result = await run(agent, 'Write a haiku about recursion in programming.');
console.log(result.finalOutput);
The string passed to run() is treated as a user message. The runner invokes the starting agent and returns when it has final output; if the response instead requests a tool or hands control to another agent, the runner handles that outcome and continues. A maximum-turn limit can raise an exception rather than allowing the run to continue indefinitely.
The snippet shows the agent-and-runner structure, not a standalone application setup. The SDK quickstart describes using an existing TypeScript app with an index.ts entry point. Consult the official TypeScript quickstart for setup steps, and the running agents guide for the run lifecycle.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallWhat happens when an agent calls a tool?
A tool call is an action requested by the model, not the tool executing itself. The runner receives the request, invokes the corresponding capability, adds the tool’s result to the interaction, and calls the model again. The model can then use that result to decide what to do next or produce its final answer.
The SDK groups several kinds of capabilities under tools, including hosted tools, built-in execution tools, function tools, agents used as tools, MCP servers, and sandbox capabilities. Which kind is appropriate depends on the task; an agent does not need every tool category. See the SDK tools guide for the documented options.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.How is a handoff different from an agent used as a tool?
Both patterns let one agent involve another, but they differ in who keeps control of the conversation. A handoff transfers control to a receiving agent, which continues with the conversation context unless filtering changes what it receives. In a manager pattern, the central agent remains in charge and calls a specialist exposed as a tool.
| Pattern | Who controls the run? | How the specialist participates | Who produces the final response? |
|---|---|---|---|
| Manager with agents as tools | The manager stays in control. | The specialist performs a bounded callable task and returns a result to the manager. | The manager remains responsible for the user-facing response. |
| Handoff | Control transfers to the receiving agent. | The receiving agent takes over the conversation, retaining context unless it is filtered. | The receiving agent can continue the run and produce the response. |
Use the manager pattern when one agent should coordinate specialists and retain responsibility for the overall answer. Use a handoff when the next agent should take over the conversation. The agent orchestration guide describes both patterns.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Best Value
What the SDK example does—and does not—imply
This loop is a practical way to understand one SDK’s agent model, not a rule that every AI agent must follow. The SDK documentation supports optional tools and handoffs; it does not establish that every agent needs multiple tools, multiple agents, persistent memory, planning, or long-running autonomous execution. Those are design choices that depend on the job. For the SDK’s own overview and agent definition, see OpenAI Agents SDK for TypeScript and its agents guide.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




