charmbracelet / charmbracelet/fantasy

No convenient way to define tools executed on client side

Open
#259 0 comments 0 reactions 0 assignees View on GitHub
area: tools
Dominant language
Go
Stars
987
Forks
137
Avg merge
14h 41m
Merged PRs (30d)
12

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.