Packages
A Fair Source multi-agent runtime with deterministic agent scoring and replayable run history.
Current section
Files
Jump to
Current section
Files
lib/syntropy.ex
defmodule Syntropy do
@moduledoc """
Public convenience API for the Syntropy runtime.
"""
alias Syntropy.{
Agent,
ClusterInfo,
ClusterMonitor,
EventRecorder,
HistoryStore,
LatticeSupervisor,
RecommendationStore,
TaskScheduler
}
@spec agents() :: [map()]
def agents, do: LatticeSupervisor.list_agents()
@spec agent(String.t()) :: map() | nil
def agent(agent_id), do: LatticeSupervisor.get_agent(agent_id)
@spec cluster_info() :: ClusterInfo.info()
def cluster_info, do: ClusterInfo.info()
@spec cluster_report() :: ClusterMonitor.report()
def cluster_report, do: ClusterMonitor.report()
@spec node_id() :: String.t()
def node_id, do: ClusterInfo.node_id()
@spec submit(String.t(), keyword()) :: {:ok, map()} | {:error, term()}
def submit(prompt, opts \\ []), do: TaskScheduler.submit(prompt, opts)
@spec start_run(String.t(), keyword()) :: {:ok, map()} | {:error, term()}
def start_run(prompt, opts \\ []), do: TaskScheduler.start_run(prompt, opts)
@spec task(String.t()) :: map() | nil
def task(task_id), do: TaskScheduler.get(task_id)
@spec run(String.t()) :: map() | nil
def run(run_id), do: TaskScheduler.get_run(run_id)
@spec cancel_run(String.t()) :: {:ok, map()} | {:error, term()}
def cancel_run(run_id), do: TaskScheduler.cancel_run(run_id)
@spec think(String.t(), String.t()) :: {:ok, String.t()} | {:error, term()}
def think(agent_id, prompt), do: Agent.think(agent_id, prompt)
@spec join(String.t(), String.t()) :: {:ok, String.t()} | {:error, term()}
def join(agent_a_id, agent_b_id), do: LatticeSupervisor.join(agent_a_id, agent_b_id)
@spec meet(String.t(), String.t()) :: {:ok, String.t()} | {:error, term()}
def meet(agent_a_id, agent_b_id), do: LatticeSupervisor.meet(agent_a_id, agent_b_id)
@spec recent_events(non_neg_integer()) :: [map()]
def recent_events(limit \\ 100), do: EventRecorder.recent(limit)
@spec events(non_neg_integer()) :: [map()]
def events(limit \\ 100), do: EventRecorder.recent(limit)
@spec recent_tasks(non_neg_integer()) :: [map()]
def recent_tasks(limit \\ 100), do: TaskScheduler.recent(limit)
@spec recent_runs(non_neg_integer()) :: [map()]
def recent_runs(limit \\ 100), do: TaskScheduler.recent_runs(limit)
@spec snapshot(String.t()) :: map() | nil
def snapshot(snapshot_id), do: HistoryStore.get(snapshot_id)
@spec recent_snapshots(non_neg_integer()) :: [map()]
def recent_snapshots(limit \\ 100), do: HistoryStore.recent(limit)
@spec recommendation(String.t()) :: map() | nil
def recommendation(recommendation_id), do: RecommendationStore.get(recommendation_id)
@spec recent_recommendations(non_neg_integer()) :: [map()]
def recent_recommendations(limit \\ 100), do: RecommendationStore.recent(limit)
@spec approve_recommendation(String.t()) :: {:ok, map()} | {:error, term()}
def approve_recommendation(recommendation_id),
do: TaskScheduler.approve_recommendation(recommendation_id)
@spec reject_recommendation(String.t()) :: {:ok, map()} | {:error, term()}
def reject_recommendation(recommendation_id),
do: TaskScheduler.reject_recommendation(recommendation_id)
end