phi-kernel-tools
Kernel tools for phi-agent — LLM-callable Tool implementations injected via factory pattern.
This crate provides the Tool implementations that the LLM uses to interact with agent-works infrastructure. It contains no infrastructure itself — only the Tool / TypedTool impls that bridge the LLM to the runtime.
Architecture
agent-base Runtime kernel (trait interfaces)
↑
agent-works Infrastructure (MCP, Skills, Multi-Agent runtime)
↑
phi-kernel-tools Tool implementations (this crate)
↑
phi-agent Framework + CLI (consumer)
Features
All features are opt-in. Use full to enable all.
| Feature | Tools |
|---|---|
file |
read_file, write_file, list_files, edit_file |
multi-agent |
spawn_agent, send_message, followup_task, wait_agent, list_agents, close_agent |
shell |
execute_command |
full |
Enables all of the above |
Installation
[]
= "0.1.1"
Or pick specific features:
[]
= { = "0.1.1", = ["file", "shell"] }
Usage
File Tools
use ;
use PathBuf;
let cwd = from;
builder
.register_tool
.register_tool
.register_tool
.register_tool;
EditFileTool supports precision text replacement with a 4-level fallback matching strategy (exact match → rstrip → trim → Unicode NFC normalization).
Shell Tools
use LocalShellTool;
builder.register_tool; // 30s timeout
Multi-Agent Tools
use multi_agent;
use ;
// Create a factory from phi-kernel-tools
let factory: MultiAgentToolFactory =
new;
// Inject into the builder
let runtime = new
.with_multi_agent
.with_multi_agent_tool_factory
.build
.unwrap;
The spawn_agent tool supports these parameters:
| Parameter | Description |
|---|---|
fork_history |
"none" (default), "all", or N — how much parent history the child inherits |
depth |
Nesting depth (1 = direct child, 2 = grandchild, etc.) |
model |
Optional model override for the sub-agent |
reasoning_effort |
Optional reasoning effort (low / medium / high) |
agent_type |
Optional role type that maps to a preset config |
system_prompt |
Optional custom system prompt (overrides agent_type) |
License
MIT — see LICENSE.