Skip to content

Commit

Permalink
feat(tool): create shallow copy of the input
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Dvorak <[email protected]>
  • Loading branch information
Tomas2D committed Nov 4, 2024
1 parent d218f8b commit ad905be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/agents/bee/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export class BeeAgentRunner extends Serializable {
},
meta,
});
const toolOutput: ToolOutput = await tool.run(iteration.tool_input, options);
const toolOutput: ToolOutput = await tool.run(shallowCopy(iteration.tool_input), options);
await emitter.emit("toolSuccess", {
data: {
tool,
Expand Down
2 changes: 2 additions & 0 deletions src/tools/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ export abstract class Tool<
}

run(input: ToolInputRaw<this>, options?: TRunOptions): Promise<TOutput> {
input = shallowCopy(input);

return RunContext.enter(
this,
{ signal: options?.signal, params: [input, options] as const },
Expand Down

0 comments on commit ad905be

Please sign in to comment.