Jidoka.Kino (Jidoka v0.8.0-beta.1)

Copy Markdown View Source

Optional Livebook helpers for inspecting and demonstrating Jidoka agents.

Kino is not a runtime dependency of Jidoka. These helpers compile and run without Kino installed; rendering becomes a no-op outside Livebook. The helpers are intentionally thin wrappers around Jidoka data contracts such as Jidoka.inspect/1, Jidoka.preflight/3, Jidoka.Harness.Replay, and trace timelines.

Summary

Functions

Renders a Mermaid diagram for an agent definition or inspection map.

Renders a Mermaid call graph from a Jidoka timeline.

Runs a notebook chat cell and renders a concise result summary.

Renders a runtime context map with public and internal keys separated.

Renders Jidoka.inspect/1 for an agent definition, plan, session, or result.

Formats common Jidoka turn/session results for notebook display.

Mirrors a Livebook provider secret into the normal provider environment.

Configures optional notebook conveniences.

Configures a notebook and renders a compact setup status table.

Starts a process-hosted Jidoka agent unless an agent with id is already running.

Renders a small Markdown table in Livebook.

Renders a compact Jidoka event timeline from a result, snapshot, session, replay, or raw events.

Runs fun, renders a Jidoka timeline when the result contains one, and returns the original result.

Renders the raw compact timeline table.

Functions

agent_diagram(target, opts \\ [])

@spec agent_diagram(
  term(),
  keyword()
) :: {:ok, String.t()} | {:error, String.t()}

Renders a Mermaid diagram for an agent definition or inspection map.

call_graph(target, opts \\ [])

@spec call_graph(
  term(),
  keyword()
) :: {:ok, String.t()} | {:error, String.t()}

Renders a Mermaid call graph from a Jidoka timeline.

chat(label, fun, opts \\ [])

@spec chat(String.t(), (-> term()), keyword()) :: term()

Runs a notebook chat cell and renders a concise result summary.

By default this does not require provider credentials; deterministic notebooks can pass injected LLM functions. Pass require_provider?: true when the cell should fail fast if provider credentials are missing.

context(label, context, opts \\ [])

@spec context(String.t(), map(), keyword()) :: :ok

Renders a runtime context map with public and internal keys separated.

debug_agent(target, opts \\ [])

@spec debug_agent(
  term(),
  keyword()
) :: {:ok, map()} | {:error, String.t()}

Renders Jidoka.inspect/1 for an agent definition, plan, session, or result.

format_chat_result(result)

@spec format_chat_result(term()) :: term()

Formats common Jidoka turn/session results for notebook display.

load_provider_env(names \\ RuntimeSetup.provider_env_names())

@spec load_provider_env([String.t()]) :: {:ok, String.t()} | {:error, String.t()}

Mirrors a Livebook provider secret into the normal provider environment.

preflight(agent_or_plan, request_input, opts \\ [])

@spec preflight(Jidoka.plan_input() | module(), Jidoka.request_input(), keyword()) ::
  {:ok, Jidoka.Inspection.Preflight.t()} | {:error, String.t()}

Runs Jidoka.preflight/3 and renders prompt/timeline tables.

setup(opts \\ [])

@spec setup(keyword()) :: :ok

Configures optional notebook conveniences.

This is opt-in and intended for Livebook/examples. It can mirror Livebook secrets such as LB_OPENAI_API_KEY into the provider environment expected by ReqLLM.

setup_notebook(opts \\ [])

@spec setup_notebook(keyword()) :: map()

Configures a notebook and renders a compact setup status table.

start_or_reuse(id, start_fun, opts \\ [])

Starts a process-hosted Jidoka agent unless an agent with id is already running.

This keeps Livebook cells repeatable when a notebook is re-evaluated.

table(label, rows, opts \\ [])

@spec table(String.t(), [map()], keyword()) :: :ok

Renders a small Markdown table in Livebook.

timeline(target, opts \\ [])

@spec timeline(
  term(),
  keyword()
) :: {:ok, [map()]} | {:error, String.t()}

Renders a compact Jidoka event timeline from a result, snapshot, session, replay, or raw events.

trace(label, fun, opts \\ [])

@spec trace(String.t(), (-> result), keyword()) :: result when result: term()

Runs fun, renders a Jidoka timeline when the result contains one, and returns the original result.

trace_table(target, opts \\ [])

@spec trace_table(
  term(),
  keyword()
) :: {:ok, [map()]} | {:error, String.t()}

Renders the raw compact timeline table.