Getting started
Your first policy
Write a rule that blocks a tool call before it runs and watch it fire.
You now have an agent that flows through Klent but has no rules to enforce — every action is allowed by default. Let us change that.
A realistic scenario
Suppose your billing agent has a transfer_funds tool. It should never be allowed to move
more than $10,000 in a single call. Everything else is fine.
The policy:
- Tool:
transfer_funds - Condition:
input.amount > 10000 - Effect:
deny
Create the policy
In the dashboard
Go to Policies → New policy and fill in:
| Field | Value |
|---|---|
| Name | Block high-value transfers |
| Condition field | input.amount |
| Operator | greater_than |
| Condition value | 10000 |
| Effect | deny |
| Enabled | ✓ |
Save. The rule is live immediately.
Via the API
curl -X POST https://api.klent.dev/v1/policies \
-H "Authorization: Bearer $KLENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Block high-value transfers",
"enabled": true,
"effect": "deny",
"conditions": [
{ "field": "input.amount", "operator": "greater_than", "value": 10000 }
]
}'Watch it fire
Call evaluateAction with an amount over the limit:
const decision = await klent.evaluateAction({
execution_id: execution.id,
tool: 'transfer_funds',
input: { to_account: 'BR-9921', amount: 50_000, currency: 'USD' },
});
console.log(decision);
// {
// decision: 'deny',
// matched_policy_id: 'pol_…',
// modifications: null,
// reason: 'Matched policy "Block high-value transfers"'
// }And with one under the limit:
const decision = await klent.evaluateAction({
execution_id: execution.id,
tool: 'transfer_funds',
input: { to_account: 'BR-9921', amount: 5_000, currency: 'USD' },
});
console.log(decision.decision); // → 'allow'What just happened
- Klent compiled your policy once (in memory, per project).
- On each evaluation it walked your enabled policies in creation order, checked the condition against the action payload, and returned on the first match.
- The decision was recorded as an event on the execution timeline. Denials become
action_blockedevents; allows becomedecisionevents.
Combine conditions
All conditions in a single policy are AND-ed together. To block only transfers above $10k made in USD, add a second condition:
{
"name": "Block high-value USD transfers",
"effect": "deny",
"conditions": [
{ "field": "input.amount", "operator": "greater_than", "value": 10000 },
{ "field": "input.currency", "operator": "equals", "value": "USD" }
]
}For OR semantics, create two policies with the same effect.
Next
- Read the policy engine reference — all operators, the
five effects (
allow/deny/modify/approve/steer), evaluation order, field resolution, shadow / dry-run mode. - Use auto-instrumentation so you don't have to call
evaluateActionandlogEventby hand. - Set up alerts in the dashboard (Alerts → New alert) so you hear about denials, errors, or pending approvals without having to watch the timeline live. Email and webhook delivery, with retries.