How Agent Works
A look inside the Agent - from Unity component to API response
The Layer Cake
+-----------------------------------------------+
| Your MonoBehaviour / UI | <- You write this
+-----------------------------------------------+
| AgentBehaviour | <- Unity Component
+-----------------------------------------------+
| Agent | <- Core runtime (pure C#)
+--------------+-------------+-----------------+
| Conversation | Tools | Audio (opt.) | <- Internal controllers
| Controller | Controller | Controller |
+--------------+-------------+-----------------+
| ChatCompletions / Responses / Assistants / | <- Chat API adapter
| Realtime API |
+-----------------------------------------------+Startup: What Happens in Awake
What Happens When You Send a Message
Step 1 - Validation
Step 2 - Context Assembly
Step 3 - API Call
Step 4 - Response Handling
Step 5 - Tool Call Loop (only when the model requests tools)
Internal Controllers
Controller
Responsibility
ChatApiType Reference
ChatApiType
Protocol
Best for
Agent Status
Status
Meaning
How Events Reach Your Code
Event
Fired when
Last updated