Tool

Give agents real capabilities: files, commands, and human approvals.

What it is

Tools are callable functions the LLM can request during an agent run. They are the primary way an agent interacts with the outside world: reading/writing files, executing commands, talking to services, or asking a human for confirmation.

Phero tools are just function tools from llm, registered on an agent.

Built-in tool packages

Phero includes a few ready-to-use tools under tool/. These are designed to be easy to attach to an agent. (Exact behavior can be customized via validation hooks.)

Tip: for anything with side effects (writes, deletes, shell commands), add a validation/approval step.

Example: safe file writes (with approval)

The examples/skills program combines skills with a file-writing tool that asks the user to approve writes.

// From examples/skills (edited for brevity)

writeTool, err := file.NewWriteTool()
if err != nil {
    panic(err)
}

tools = append(tools, writeTool.WithValidation(writeValidationFunc).Tool())

for _, tool := range tools {
    if err := a.AddTool(tool); err != nil {
        panic(err)
    }
}
// From examples/skills (edited for brevity)

func writeValidationFunc(_ context.Context, input *file.WriteInput) error {
    fmt.Printf("Do you want to write to the file '%s'? (y/N): ", input.Path)
    var permission string
    _, scanErr := fmt.Scanln(&permission)
    if scanErr != nil {
        return fmt.Errorf("failed to read user input: %w", scanErr)
    }

    if strings.EqualFold(permission, "y") {
        return nil
    }

    return fmt.Errorf("user permission denied")
}

This pattern keeps the agent powerful while still giving the user control.

Run an example

These are good starting points to see tools in action (provider setup is described in each example README):

# Skills + file tool (run from example dir)
cd ./examples/skills
go run .

# Multi-agent workflow (uses a restricted command tool)
cd -
go run ./examples/multi-agent-workflow

Related packages