Agentix.Scope (Agentix v0.1.0)

Copy Markdown View Source

The caller's authorization/context, passed per entry-verb call (send_message/3, resolve/4) and threaded into :server tool callbacks via Agentix.Turn.

A scope is per-call and never persisted — it reflects who is acting now, not conversation state. Two flavours:

  • a user scope — carries current_user and arbitrary assigns;
  • a system scope (system/0) — system?: true, the documented scope for timeout-driven resolutions and other server-initiated actions. A system scope may not carry a current_user.

Built with new/1 (rejects unknown keys).

Summary

Functions

Builds a scope from attrs. Raises ArgumentError on unknown keys, if assigns is not a map, or if a system scope carries a current_user.

The documented system scope (e.g. timeout-driven resolutions).

Types

t()

@type t() :: %Agentix.Scope{
  assigns: map(),
  current_user: term() | nil,
  system?: boolean()
}

Functions

new(attrs \\ [])

@spec new(keyword() | map()) :: t()

Builds a scope from attrs. Raises ArgumentError on unknown keys, if assigns is not a map, or if a system scope carries a current_user.

system()

@spec system() :: t()

The documented system scope (e.g. timeout-driven resolutions).