Prepare the runtime
The Agent SDK package is not yet on Packagist. Follow the source installation instructions.Quickstart
What it ships
AgentSdk::createAgent(...)AgentSdk::defineTool(...)AgentSdk::createGatewayAgentClient(...)- a bounded tool loop over the Phaseo
responsesAPI
Advanced runtime
PHP supports validation and approval callables, HITL and manual tools, progress, recoverable errors, replayable iterators, stop helpers, dynamic turns, persisted next-turn parameters, normalized usage/cost, andStateAccessor.
Streaming and cancellation
Agent::stream(...) and Agent::continueStream(...) drive the gateway’s Responses SSE stream through a Fiber as the returned iterator is consumed. Use textStream(), reasoningStream(), itemStream(), or fullStream(); call cancel() to stop the Fiber and close the generator. Completed steps retain request IDs, provider metadata, finish reasons, warnings, usage, and cost.