Jidoka.Harness.Session (Jidoka v0.8.0-beta.1)

Copy Markdown View Source

Serializable harness envelope for running an agent across requests.

A session is data. It stores the agent spec, request history, hibernated snapshots, pending review requests, and the latest result/error. It does not own processes or runtime capabilities.

Summary

Types

status()

@type status() :: :new | :running | :hibernated | :waiting | :finished | :error

t()

@type t() :: %Jidoka.Harness.Session{
  agent_id: binary(),
  error: nil | nil | any(),
  metadata: map(),
  pending_reviews: [term()],
  requests: [term()],
  result: nil | nil | term(),
  schema_version: integer(),
  session_id: binary(),
  snapshots: [term()],
  spec: term(),
  status:
    (:new | :running | :hibernated | :waiting | :finished | :error) | binary()
}

Functions

from_input(session)

@spec from_input(t() | keyword() | map()) :: {:ok, t()} | {:error, term()}

latest_snapshot(session)

@spec latest_snapshot(t()) :: Jidoka.Runtime.AgentSnapshot.t() | nil

new(attrs)

@spec new(keyword() | map()) :: {:ok, t()} | {:error, term()}

new!(attrs)

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

put_error(session, reason)

@spec put_error(t(), term()) :: t()

put_request(session, request)

@spec put_request(t(), Jidoka.Turn.Request.t()) :: t()

put_result(session, result)

@spec put_result(t(), Jidoka.Turn.Result.t()) :: t()

put_snapshot(session, snapshot)

@spec put_snapshot(t(), Jidoka.Runtime.AgentSnapshot.t()) :: t()

schema()

@spec schema() :: Zoi.schema()

schema_version()

@spec schema_version() :: pos_integer()

start(spec, opts \\ [])

@spec start(
  Jidoka.Agent.Spec.t(),
  keyword()
) :: {:ok, t()} | {:error, term()}

statuses()

@spec statuses() :: [status()]