ExAgent.Runtime (ExAgent v3.0.0)

View Source

Read-only inspection for trusted operators. Authorize callers in the host application before exposing these queries. Namespace filters select rows.

Stability — Stable.

Queries run on the process's node. By default events omit classified content and metadata, and approval arguments are redacted. A trusted host may supply content: {:redact, {module, function, extra_args}}. The callback receives the classified field name and value before its extra arguments. Its return value can cross the network. Failures become :redaction_failed.

Version 1 maps evolve by adding keys. Start timestamps in index entries and current runs use Unix milliseconds. Byte counts use Erlang external size.

Summary

Functions

Read an in-memory summary, optionally including up to 256 events after a cursor.

List processes, optionally filtering by kind, namespace or node.

Read a Server's persisted pending items on demand. Each item has the conversation :id, the held invocation's opaque :call_ref, the fresh per-read :operation_id of ExAgent.Continuation.pending/2, :tool, :decisions, :expires_at and :args under the content policy. To act on an item, read the trusted request with ExAgent.Server.pending/2.

Types

content()

@type content() :: false | {:redact, {module(), atom(), list()}}

entry()

@type entry() :: %{
  version: 1,
  kind: kind(),
  pid: pid(),
  node: node(),
  namespace: term(),
  id: String.t() | nil,
  started_at: integer()
}

kind()

@type kind() :: :server | :session | :jobs

Functions

info(pid, opts \\ [])

@spec info(pid(),
  events: 0..256,
  after: ExAgent.Event.cursor() | nil,
  timeout: timeout(),
  content: content()
) ::
  {:ok, map()}
  | {:error,
     :timeout | :unavailable | {:cursor_expired, ExAgent.Event.cursor()}}

Read an in-memory summary, optionally including up to 256 events after a cursor.

list(opts \\ [])

@spec list(
  kind: kind() | [kind()],
  limit: 1..10000,
  node: node(),
  namespace: term(),
  timeout: timeout()
) :: {:ok, [entry()]} | {:error, :unavailable}

List processes, optionally filtering by kind, namespace or node.

The limit is 1–10,000 (default 500). The read uses a 1,000 ms timeout unless the caller supplies :timeout. A timed-out node is unavailable.

pending(pid, opts \\ [])

@spec pending(pid(), timeout: timeout(), content: content()) ::
  {:ok, [map()]} | {:error, term()}

Read a Server's persisted pending items on demand. Each item has the conversation :id, the held invocation's opaque :call_ref, the fresh per-read :operation_id of ExAgent.Continuation.pending/2, :tool, :decisions, :expires_at and :args under the content policy. To act on an item, read the trusted request with ExAgent.Server.pending/2.