Path: redb-route/redb.Route.Llm.Abstractions/Tools/LlmToolEnums.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Llm.Abstractions/Tools/LlmToolEnums.cs
----
namespace redb.Route.Llm.Abstractions.Tools;
///
/// Side-effect classification declared by a tool author. Read by the engine for two decisions: a tool
/// whose is not may not declare a
/// caching policy, because a cache hit suppresses the side effect the entry stands for; and an
/// tool is not run inside an ambient transaction (a route's .Transacted()),
/// because that transaction can roll back while the external action cannot. Beyond that the
/// Mutating / External distinction stays declarative — it selects neither the approval gate
/// nor the idempotency policy.
///
public enum ToolSideEffect
{
/// Read-only: no state is mutated, so retries are harmless. The only class that may be cached.
ReadOnly,
/// Mutates internal state. Declared intent: a retry must carry an idempotency key.
Mutating,
/// Has external irreversible side-effects (mail, payment, deployment). Declared intent:
/// requires approval — set explicitly, because
/// approval is not derived from this value. Not run inside an ambient transaction: the model receives
/// instead.
External
}
///
/// Result-caching policy for . Enforced for read-only tools: the engine
/// consults a cache and skips a call it can answer from it, reporting the skip to observers. A tool
/// that declares Caching != None together with a mutating side effect is rejected at route
/// build.
///
public enum ToolCachingPolicy
{
/// Do not cache.
None,
/// Memoise per (tool, resolved endpoint address, input) for the lifetime of the agent run,
/// in process — the entry dies with the run and never reaches a store.
Memoize,
/// Memoise across runs in the configured cache store with a TTL (24 h). An output the
/// redaction filter changed is not cached.
Persist
}
/// Cost class hint for budget-aware scheduling. Reserved — budgets are computed from
/// real provider usage, not from this hint.
public enum ToolCostClass
{
/// Sub-millisecond, no external IO.
Cheap,
/// Single-digit milliseconds, single network call.
Moderate,
/// Multi-second / external API / paid call.
Expensive
}