Your first governed agent
Run a safe tool, see Thoth stop a disallowed action, and inspect both decisions.
Start with two local callbacks: one returns a greeting, the other must never execute. You do not need a model API key or an existing agent framework. After this guide, you will have checked an action before execution and verified the result in your tenant's decision history.
Before you start
You need an activated trial with the trial-demo policy, your tenant ID,
unified tenant API base URL, and execute key. Trial access and connection
details explains how to get them.
These examples are not an offline demo; they call your tenant's enforcer.
1. Set your connection details
In a local terminal, set these variables using your trial details. Load the key from your secret manager or a private file; do not commit it or paste it into shared terminal logs.
2. Install the SDK and run your agent
Use Python 3.12+, Node.js 22+, or Go 1.25+. These examples need no model API
key and make no external tool calls. They use the same trial-demo agent and
tool names as the onboarding demo. Start with demo.read; only proceed to
shell.exec after the read succeeds.
The trial demo policy is expected to allow demo.read and block shell.exec.
approved_scope describes the agent's intended tools; it does not install or
override server policy. The shell.exec callback is a guard that raises an
error if reached; it never starts a shell.
Save as trial.py, then run python trial.py:
3. Verify the result
With the configured demo policy, the terminal prints:
The refusal's exact wording varies by SDK and policy. Treat a missing greeting, an unexpected execution error, or a different decision as a failed check.
Confirm the demo.read decision is ALLOW and the shell.exec decision is
BLOCK in decision history, including the reason and correlation ID. A
refusal exception alone is insufficient: fail-closed SDKs also refuse calls
on authentication, rate-limit, or transport failures. Resolve those errors
before counting the demo as successful. A STEP_UP pauses for approval; it
is not the expected result for this two-tool demo.
The demo BLOCK quarantines trial-demo. An administrator must open
Agents → trial-demo → Restore Agent before repeating the examples,
including switching SDK languages. Then start with demo.read again.
Onboarding activation progress records the first authenticated, finalized enforcement decision. It can record a refused action too. Check decision history separately to verify the expected policy outcome and available evidence; the progress indicator does not prove tool execution or a finalized evidence export.
4. Connect your own agent
You have verified a permitted action and a refusal. Next, instrument your own agent and keep its tool execution behind the same policy check. If the demo did not behave as expected, use the troubleshooting guide before continuing.