# Runtime policy, approvals, and traces

A Capability gives an Agent an operation it can call. Check its scope and
requirements, then choose if the operation can run without approval. A policy
decision says if work may run. A trace event records what happened.

## Choose a tool policy

Tool policy defaults to `allow`. Set `policy: 'deny'` to reject an operation.
Set `policy: 'require-approval'` when a trusted caller must approve it first.
Read [Capabilities](https://vitehub.dev/docs/agents/capabilities) to see how policy works with
modes, path scopes, and input validation.

A policy does not replace those limits. An approved tool call must still meet
its Capability's requirements. Give the smallest scope the task needs, such
as read access to a docs directory.

## Know who owns the approval

Runtime approval interfaces describe requests and decisions. They do not give
a durable approval queue, and they do not authenticate the approver. If you
build your own entry point, your app must:

- authenticate the actor
- link the response to the pending call
- prevent replay
- resume or reject the operation

The built-in HTTP Chat route does this for you. It stores pending approvals in
its Chat state, rebuilds the tool call on the server, and uses each response
once under a session lock. Client chat history and Invocation context cannot
grant approval. Read [Chat capability](https://vitehub.dev/docs/agents/capabilities/chat) and the
[Capability approval contract](https://vitehub.dev/docs/agents/capabilities#use-an-eve-extension)
before you show approval controls in your app.

## Inspect what happened

The Invocation ID links a decision, pending approval, tool call, and final
result. The [Console](https://vitehub.dev/docs/development/console) shows them.
[Invocation APIs](https://vitehub.dev/docs/agents/invocations) and
[runtime events](https://vitehub.dev/docs/reference/runtime-events) show them from code.

> [!WARNING]
> An in-memory trace is lost on restart. Use an Invocation journal or an
> [OTLP receiver](https://vitehub.dev/docs/agents/capabilities/otlp) to keep evidence. Traces
> store metadata only by default. Store content only when the app needs it,
> and set access, redaction, and retention for it.

<!-- vitehub-docs:section-links -->
## In this section

- [Start](https://vitehub.dev/raw/docs/agents.md)
- [Define and run](https://vitehub.dev/raw/docs/agents/agent-definitions.md)
- [Instructions and tools](https://vitehub.dev/raw/docs/agents/instructions.md)
- [History and context](https://vitehub.dev/raw/docs/agents/chat-history-sessions.md)
- [Channels](https://vitehub.dev/raw/docs/agents/channels.md)
- [Inspect and evaluate](https://vitehub.dev/raw/docs/agents/observability.md)
- Advanced
  - [Agent presets and inheritance](https://vitehub.dev/raw/docs/agents/agent-presets.md)
  - [Invocation storage](https://vitehub.dev/raw/docs/agents/invocation-storage.md)
  - [Runtime policy, approvals, and traces](https://vitehub.dev/raw/docs/agents/runtime-policy.md) (this page)
  - [Custom capabilities](https://vitehub.dev/raw/docs/agents/capabilities/custom.md)
  - [Child invocations](https://vitehub.dev/raw/docs/agents/controlled-child-invocations.md)
  - [Sandboxes](https://vitehub.dev/raw/docs/agents/sandboxes.md)
  - [Sandbox tutorial](https://vitehub.dev/raw/docs/agents/sandbox-tutorial.md)
  - [Process hosts](https://vitehub.dev/raw/docs/agents/process-hosts.md)
- [Recipes](https://vitehub.dev/raw/docs/agents/support-agent.md)
- [Presets](https://vitehub.dev/raw/docs/agents/presets.md)
- [Capabilities](https://vitehub.dev/raw/docs/agents/capabilities/access.md)

Next: [Custom capabilities](https://vitehub.dev/raw/docs/agents/capabilities/custom.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
