Building
Tools
Python functions, MCP servers or signed webhooks. Each has an effect level and gets a stable idempotency key.
In python
from keel.tools.registry import Registry
tools = Registry()
async def order_status(idempotency_key: str):
return await desk.orders.find(key=idempotency_key) # None if it never landed
@tools.tool(effect="external", timeout_s=30, reconcile=order_status)
async def place_order(market_id: str, side: str, size: float, idempotency_key: str):
"""Place a limit order."""
return await desk.orders.create(market_id, side, size, key=idempotency_key)The input schema comes from the signature and the docstring becomes the description. idempotency_key is filled in by keel and hidden from the model. It's derived from (run_id, step, call_index), so a retried call always carries the same key.
MCP servers
On the Tools page, add a streamable http MCP server. keel lists its tools and registers each as server__tool. Tools the server marks read only become pure; everything else is external. The idempotency key is sent in the call's _meta as keel/idempotency_key.
Webhooks
A webhook tool is an https endpoint keel POSTs the tool's arguments to as JSON. Each request is signed with HMAC-SHA256 over the timestamp, a dot and the raw body, using a secret you store in Secrets, and carries an Idempotency-Key header that stays the same on every retry of one call.
POST /your/endpoint
Idempotency-Key: tc_3f9a...
X-Keel-Timestamp: 1764000000
X-Keel-Signature: v1=8c1e...
{"market_id": "fed-dec", "side": "buy", "size": 10}