How a tool call will travel through Kumi's kernel, from the agent that asks to the plugin that runs it, and back.
An agent asks for a tool called note.write. The arguments are {"name":"todo.md","text":"read-only text"}. The name says write and the text says read-only, but neither decides what kind of call this is. The kernel doesn't run it yet. If the policy says ask, the call is put on hold and someone has to approve it. Until then, the plugin never sees it, and a request nobody answers runs out and counts as a no.
Kumi is an AI agent client, and nearly everything in it is a plugin, including the tools an agent uses. The kernel is the fixed part underneath that isn't a plugin. Last time we looked at how it answers "may this plugin do this?". This time we follow one tool call from start to finish, because that answer is only one stop on the road.
By design, the broker is the only place that decides whether a tool call runs: once tools are registered, every call has to go through it.
A tool describes itself once
Before any call happens, a tool is described in its plugin's manifest, the short file every plugin ships with. Here is the note.write tool from our local tools plugin, as the kernel reads it:
[[contracts.tools]]
name = "note.write"
schema_hash = "local-note-write-v1"
effect = "write"
resources = ["workspace.notes"]
replay_safe = false
Two lines matter. effect says what kind of thing the tool does. There are four kinds: read, write, external (it reaches outside systems) and irreversible (it can't be undone). resources names what the tool touches, here the notes.
The part of the kernel that carries tool calls is called the broker. It decides how to treat a call from this description, not from the call itself.
The road, in order
The broker's source file opens with a numbered list of steps. A fresh call follows them in this order, and stops at the first check that refuses it:
| Step | What the kernel does |
|---|---|
| 1 | Looks up a tool with this exact name. No tool, no call. |
| 2 | Checks that the plugin holds a grant to serve it. No grant, no call. |
| 3 | Checks the arguments against the tool's schema and a size cap. Bad arguments never reach the plugin. |
| 4 | Writes the call down before sending it. If it can't, the call stops. |
| 5 | Takes the effect from the manifest. |
| 6 | Asks the policy. Only "allow" goes on. |
| 7 | Locks the resources the tool touches, and gives up if it waits too long. |
| 8 | Sends the call to the plugin, with a time limit. |
| 9 | Labels and stores the result, then writes down how the call ended. |
On this road, the tool's plugin is reached in step 8 or not at all. The policy, which can itself be a plugin, sees the call in step 6 so it can judge it.
That list is for a new call. Two other paths don't walk all of it. On the scoped, supervised path, a repeated call id skips the road entirely: before step 1, the broker checks that the caller may still use that session, then returns the stored result of the first call with that id. The tool doesn't run again, and grants, schema, policy and the floor aren't asked again. An approved call that was parked at step 6 resumes at the locks; on the scoped path, its grants and session are checked again first. The policy is not asked again, and the approval is bound by a hash to the tool, the arguments, whoever made the call and that call's identity.
No contract, no call
Here is step 1 (excerpt, reindented):
// Step 1: a tool without a manifest contract cannot be invoked.
let entry = if let Some(entry) = self.registry.get(&tool) {
entry.clone()
} else {
let err = BrokerError::NoContract { tool: tool.clone() };
return fail_response(&call_id, &tool, &requester, &err);
};
The registry is a table of tools filled from manifests and keyed by exact name. Ask for a name that isn't in it and the trip ends with a reason like this:
no manifest contract for tool "note.writ"
Not a long message, but nothing is guessed. There is no "closest match" and no fallback.
Step 2 is the check from our last post: the plugin offering the tool needs a grant to serve it. Step 3 checks the arguments. Bad or oversized arguments are refused before they reach the plugin, so a tool never has to defend itself against input the kernel already knew was wrong.
Step 4 is the quiet one. The broker writes the call to storage before sending it. If the kernel stops halfway, a restart can see that a call was in flight.
The label comes from the manifest
Step 5 opens with two lines of comment and one line of code (excerpt, reindented):
// Step 5: classify the effect from the manifest, never from the
// args or the tool name.
let effect = action_effect(entry.contract.effect);
A call carries a tool name and some arguments. The broker asks neither of them what kind of call this is. In the opening example, the arguments said "read-only text" and the manifest said the tool's effect is write. The manifest won. A friendly tool name wouldn't change the label either.
Why build it this way? If a call could describe itself, the cheapest trick would be to describe a write as a read. Taking the label from the manifest moves that decision to a file that can be read before anything runs, and keeps it out of the call itself.
One honest limit: the label is a promise from the plugin's author. A call can't change it on the way. The kernel does not check that a tool really does only what its label says.
Only "allow" goes on
Step 6 hands the call, with its label, to the policy. The policy is a separate piece the broker consults, and it can be swapped. Only "allow" goes on. A call that gets "ask" is parked, not run, until someone answers. If nobody does in time, the answer is no.
Two details keep this step strict. If the policy plugin is missing, crashes, times out or sends back something invalid, the answer is deny. And before any rule, the policy checks the kernel's own safety floor, which no rule can override. The design relies on the kernel to classify sensitive operations before policy checks. Those classifications let the safety floor enforce its restrictions; they are not supplied by the tool itself. A normal tool call carries none of those markings, so on that road the floor has nothing to refuse.
Separately, nobody can approve a call they made themselves. That is checked when an approval is answered.
The last steps are about order and honesty. Reads can share a lock and run side by side, while a write waits for its turn. Which resources get locked comes from the manifest, not from the arguments.
Then the plugin finally gets the call, with a time limit to answer. What comes back is labelled with the plugin and tool it came from, and marked untrusted, because tool output is text from outside and the kernel keeps saying so. Then the broker releases the locks and stores the result with a record of how the call ended. That record is what a repeated call id gets back.
The same road for every new call
Nine steps for one tool call sounds like a lot. Several of them are a lookup in a table, and that's the point: every new call takes the same road. This is how a tool call will travel through Kumi, and we're building it now. If you'd put a step in a different place, write to us and tell us why.
If you'd like to hear when you can try Kumi, there's a waitlist.
