ReqManagedAgents.Evidence.Recorder (ReqManagedAgents v0.13.3)

Copy Markdown View Source

Caller-owned, bounded observations for one provider session, independent of Session lifetime. Stop the recorder after taking its snapshot. Recording failures never retry provider work.

Admission charges external-term bytes plus record overhead across queued and retained observations; snapshots additionally enforce the encoded artifact limit. Local monotonic ticks are nanoseconds in the recorder-scoped clock. Rejected observations and unfinished invocations produce a partial capture. A barrier timeout returns available validated records with a gap, rather than a consistent completion claim.

AgentCore observations begin at decoded Converse frames. Original EventStream headers, byte encoding and malformed frames discarded by the transport decoder are unavailable.

Summary

Functions

Returns a specification to start this module under a supervisor.

Sets provider identity before observations; a missing session may be filled after open.

Admits an observation without waiting; rejected observations increment the gap count.

Returns bounded evidence, or a safe unavailable error when the recorder cannot be read.

Starts a recorder linked to its caller, using validated capture options.

Types

t()

@type t() :: %ReqManagedAgents.Evidence.Recorder{
  capture_id: String.t(),
  clock_id: String.t(),
  counters: :atomics.atomics_ref(),
  options: ReqManagedAgents.Evidence.Options.t(),
  ordinal: non_neg_integer(),
  started_at: DateTime.t(),
  table: :ets.tid()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

context(pid, provider, session_id)

@spec context(pid() | nil, :managed | :agentcore, String.t() | nil) :: :ok

Sets provider identity before observations; a missing session may be filled after open.

emit(pid, record)

Admits an observation without waiting; rejected observations increment the gap count.

snapshot(pid)

@spec snapshot(pid()) ::
  {:ok, ReqManagedAgents.Evidence.Capture.t()}
  | {:error, ReqManagedAgents.Evidence.Error.t()}

Returns bounded evidence, or a safe unavailable error when the recorder cannot be read.

start_link(options)

Starts a recorder linked to its caller, using validated capture options.