Tutorial: Contextual Policies

Omnigent ships with a set of context-aware policies you can attach to any live session, no code required. They watch what your agent is doing and step in when it matters: warning you about spend, pausing for approval, or blocking a risky action outright. This tutorial walks you through setting one up on a running session.

Time: 5 minutes. Everything runs locally.

1. Start a new session

Open the web UI and start a new session with whichever agent you like. We'll use a Claude Code session for this walkthrough, but policies work the same across every agent type.

Starting a new Claude Code session in the Omnigent web UI

2. Add a policy to the session

Click the info button (i) at the top of the page to open the session panel. You'll see the current session cost and a Policies section. Hit the + button, then pick a policy from the list. There are plenty to choose from — for this tutorial we'll use Session Cost Budget, which keeps an eye on how much the session is spending on the model.

The clip below walks through the whole flow: opening the panel, choosing the policy, and filling in its settings.

Opening the session info panel, choosing Session Cost Budget, and configuring its limits

As you can see in the clip, the cost policy gives you two kinds of guardrails:

Once you fill in the values and click Add, the policy goes live on the session right away — you'll see it listed under Policies in the panel.

3. Watch the policy in action

Keep an eye on the running cost in the info panel (i) as you chat. Now let's trip each guardrail.

Cross the soft limit

Once spend passes your soft limit, ask the agent to run any tool. Instead of charging ahead, it pauses and asks whether you want to continue. Approve to keep going, or reject to stop the call.

Approval prompt shown after the session cost crosses the soft limit

Hit the hard limit

When spend reaches the hard limit, the policy blocks every following tool call that would use an expensive model. The agent tells you what happened and waits — switch to a cheaper model and you're free to continue.

Expensive models blocked after the session hits the hard cost limit, then unblocked by downgrading

That's the whole loop: warn, ask, block. The same pattern applies to every built-in policy, so you can mix and match them to fit how you want a session to behave.

What's next