class AgentTool implements Approvable, Tool, Transient

Traits

Properties

protected Approval|bool|null $approvalRequirement from  InteractsWithApprovals

Methods

requireApproval(string|null $reason = null)

Indicate that the tool requires approval before execution.

withoutApproval()

Indicate that the tool may execute without approval.

Approval|null
shouldRequestApproval(Request $request)

Determine whether the tool should request approval for the given request.

Approval|bool
needsApproval(Request $request)

Determine whether the tool needs approval for the given request.

__construct(Agent $agent)

Create a tool that delegates work to the given agent.

string
name()

Get the name of the tool.

Stringable|string
description()

Get the description of the tool's purpose.

Stringable|string
handle(Request $request)

Execute the tool.

stream(Request $request)

Execute the sub-agent and stream its activity.

string
failedResult(Throwable $throwable)

Report the sub-agent's failure and get the result the parent agent receives.

array
schema(JsonSchema $schema)

Get the tool's schema definition.

agent()

Get the underlying agent instance.

Details

InteractsWithApprovals requireApproval(string|null $reason = null)

Indicate that the tool requires approval before execution.

Parameters

string|null $reason

Return Value

InteractsWithApprovals

InteractsWithApprovals withoutApproval()

Indicate that the tool may execute without approval.

Return Value

InteractsWithApprovals

Approval|null shouldRequestApproval(Request $request)

Determine whether the tool should request approval for the given request.

Parameters

Request $request

Return Value

Approval|null

at line 134
protected Approval|bool needsApproval(Request $request)

Determine whether the tool needs approval for the given request.

Parameters

Request $request

Return Value

Approval|bool

at line 29
__construct(Agent $agent)

Create a tool that delegates work to the given agent.

Parameters

Agent $agent

at line 36
string name()

Get the name of the tool.

Return Value

string

at line 46
Stringable|string description()

Get the description of the tool's purpose.

Return Value

Stringable|string

at line 59
Stringable|string handle(Request $request)

Execute the tool.

Parameters

Request $request

Return Value

Stringable|string

at line 78
Generator stream(Request $request)

Execute the sub-agent and stream its activity.

Parameters

Request $request

Return Value

Generator

at line 102
protected string failedResult(Throwable $throwable)

Report the sub-agent's failure and get the result the parent agent receives.

Parameters

Throwable $throwable

Return Value

string

at line 116
array schema(JsonSchema $schema)

Get the tool's schema definition.

Parameters

JsonSchema $schema

Return Value

array

at line 126
Agent agent()

Get the underlying agent instance.

Return Value

Agent