Agents as plain PHP classes
An agent is a class with instructions. Add tools, conversation history, an output schema or middleware by implementing an interface, and tune the model, step limit and timeout with PHP attributes.
Structured output you can rely on
Describe the response with a schema builder and read the result like an array. No parsing JSON out of free text.
Tools that call your own code
Give an agent a tool, such as looking up an order, and the model calls it when it needs to. Arguments are validated against the tool's schema, and errors go back to the model to correct.
Failover between providers
Pass a list of providers and the next one is tried when the first is rate limited, overloaded, out of credit or unreachable. Build a provider at runtime too, for example with a key stored per customer.
Fakes for unit tests
Fake any agent to return canned responses and assert what it was asked. Fakes need no API key and no ObjectManager, so they run in plain unit tests.
Magento events and middleware
Every run, step and tool call fires a Magento event, so logging token usage is one observer. Middleware runs on each step to cap spend or remove a tool.