Skip to main content
Create Tool values and pass them through AgentSdk::defineTool(...). Tools can include:
  • JSON parameters shown to the model
  • inputSchema, outputSchema, and eventSchema validation callables
  • timeoutMs and an execute callback
  • boolean or callable requireApproval
  • onToolCalled and onResponseReceived for interactive work
  • nextTurnParams and onError: "return-to-model"
Use RuntimeContext::$emitProgress for preliminary results and $setContext for application context.
Tool callbacks execute synchronously in the standard PHP runtime. Concurrency and interruption therefore follow the capabilities of the PHP process hosting the SDK.
Last modified on July 26, 2026