# `Jidoka.Kino`
[🔗](https://github.com/agentjido/jidoka/blob/v0.9.0/lib/jidoka/kino.ex#L2)

Optional Livebook helpers for inspecting and demonstrating Jidoka agents.

Kino is not a runtime dependency of Jidoka. These helpers compile only in the
development and test environments. 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.Session.Replay`, and trace
timelines.

# `agent_diagram`

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

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

# `call_graph`

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

Renders a Mermaid call graph from a Jidoka timeline.

# `chat`

```elixir
@spec chat(String.t(), (-&gt; 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`

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

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

# `debug_agent`

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

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

# `debug_request`

```elixir
@spec debug_request(
  term(),
  keyword()
) :: {:ok, Jidoka.Debug.RequestSummary.t()} | {:error, String.t()}
```

Renders a request-level debug summary from a turn result, session, snapshot, or replay.

# `format_chat_result`

```elixir
@spec format_chat_result(term()) :: term()
```

Formats common Jidoka turn/session results for notebook display.

# `load_provider_env`

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

Mirrors a Livebook provider secret into the normal provider environment.

# `preflight`

```elixir
@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`

```elixir
@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`

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

Configures a notebook and renders a compact setup status table.

# `start_or_reuse`

```elixir
@spec start_or_reuse(String.t(), (-&gt; DynamicSupervisor.on_start_child()), keyword()) ::
  DynamicSupervisor.on_start_child()
```

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`

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

Renders a small Markdown table in Livebook.

# `timeline`

```elixir
@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`

```elixir
@spec trace(String.t(), (-&gt; result), keyword()) :: result when result: term()
```

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

# `trace_table`

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

Renders the raw compact timeline table.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
