Skip to content

No convenient way to define tools executed on client side #259

@fwang2002

Description

@fwang2002

Description

When using Fantasy on the server side, there is currently no convenient way to define a tool that should be executed on the client side.
The issue is that when creating a tool via NewAgentTool, the return value of the execution function is always treated as a tool result. However, for client-side tools, we typically don't want to return a tool result from the server at all — we simply want to interrupt the current turn and hand control back to the client so it can execute the tool locally.

It would be best to introduce a clear convention for the execution function’s return value, so this situation can be handled directly inside the tool execution function itself. For example, returning a specific sentinel value (such as YieldToClient) could signal that the tool should be executed on the client and the current turn should be interrupted.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions