# Agent Nodes: Instructions, Model and Output Format — OpenAI Agent Builder Workflows

Source: https://www.skillbyai.com/en/openai-agent-builder/b-agent

> Each agent node is one focused job.

## Narrow instructions and a schema

An **agent node** wraps a model call with **instructions**, a chosen **model** and reasoning settings, optional **tools**, and an **output format** (free text or a structured JSON schema). Give each agent one narrow responsibility (classify, extract, answer from documents, write a reply) rather than one giant prompt. When another node consumes the result, use **structured output** so fields like `category` and `urgent` can be routed on reliably. In code, the same idea appears as an `Agent` with an `output_type`.

## A structured output type in the Agents SDK, run

I ran this with Python 3, the openai-agents package 0.22.3 and pydantic 2.13.5, without any API key: it only builds definitions and schemas, no model is called. A pydantic model becomes the agent's output schema: three required fields, with category limited to billing, technical or other. A JSON reply parses into a typed object.

```python
import json
from typing import Literal
from pydantic import BaseModel
from agents import Agent, AgentOutputSchema

class Triage(BaseModel):
    category: Literal["billing", "technical", "other"]
    urgent: bool
    summary: str

agent = Agent(name="Classifier", instructions="Classify the ticket.", output_type=Triage)
schema = AgentOutputSchema(Triage).json_schema()
print("required fields:", schema["required"])
print("category enum  :", schema["properties"]["category"]["enum"])
print("parsed example :", Triage.model_validate_json('{"category": "billing", "urgent": false, "summary": "double charge"}'))
```

Output:

```
required fields: ['category', 'urgent', 'summary']
category enum  : ['billing', 'technical', 'other']
parsed example : category='billing' urgent=False summary='double charge'
```

## Use smaller models for simple nodes

Classification or extraction nodes often work well on a smaller, cheaper model; save large models for the steps that need reasoning.

**Quiz:** Why give a classifier agent a structured output schema?

- [ ] To make the reply longer
- [x] So later nodes can branch on typed fields reliably
- [ ] Because text output is impossible
- [ ] To skip testing

*Answer:* So later nodes can branch on typed fields reliably. Structure makes routing deterministic.
