Tools extend your agent’s capabilities, allowing it to perform tasks like sending messages, making API calls, or executing commands.
$parallelToolCalls
to null
if you want to remove it from the
request, as some models (o1) do not support parallel tool calls.#[Tool]
attribute to transform your agent’s methods into tools:
#[Tool]
attribute with static methods if there’s
no need for the agent instance ($this
).LarAgent\Tool
class:
setCallback
method accepts any php
callable, such as
a function name, a closure, or a class method.$tools
property:
forceTool
method requires tool’s name as a parameter.toolRequired
& forceTool
is set only at the first call, after that it will automatically switched to ‘auto’ avoiding infinite loop.ToolCallMessage
ToolCallMessage
instance, providing more flexibility
in terms of when and how they are executed.withTool
and removeTool
methods:
Add tool with instance