Skip to content

[Feature] Provide Custom Tools. #108

@ParisMolver

Description

@ParisMolver

Current I have to hijack /tool/built-in/index.ts to create the following

export const BUILT_IN_TOOLS: ToolDefinition<any>[] = [
  bashTool,
  fileReadTool,
  fileWriteTool,
  fileEditTool,
  grepTool,
  customTools.runTestsTool,
  customTools.buildTestsTool,
  customTools.getProjectTreeTool,
  customTools.readLogTool,
]

Whilst I could get the AI to use bash and execute the commands to run the test, i don't like giving an agent bash unless it requires it as it often does things such as recursive scan of directories which just blows up the model.

I wrote my custom tools and spent many days trying to get things working then i injected them into the built-in tools for use in 'registerBuiltInTools' and found that for the first time it actually works. I will still continue to use the built in tools when required but I think it's a bit jank having to edit the source file to allow for custom tools.

Ideally I would like to have the built in tools registered as usual, then at the start of my code i can either pop a built in tool out, or add in a custom tool.

Is there a better way of using custom tools as I haven't seen any of the examples mentioning it. Having taken a deeper look it seems that the orchestrator would need some changes such that

function buildAgent(config: AgentConfig): Agent {
  const registry = new ToolRegistry()
  registerBuiltInTools(registry)

  const executor = new ToolExecutor(registry)
  return new Agent(config, registry, executor)
}

allows for the pop / append of customTools to registry when the buildAgent is called

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions