Powered by AppSignal & Oban Pro

Jidoka: Hello Agent

livebook/01_hello_agent.livemd

Jidoka: Hello Agent

Run in Livebook

Build the smallest useful Jidoka agent, inspect its compiled definition, and send it one provider-backed chat request.

Setup

This notebook installs Jidoka from GitHub so it can run from Livebook without a local checkout. Chat cells use a Livebook secret named ANTHROPIC_API_KEY.

Mix.install(
  [
    {:jidoka, git: "https://github.com/mikehostetler/jidoka.git", ref: "924a486f3c1b7e7a943cb3d5ceee0de65f158467"},
    {:kino, "~> 0.19.0"}
  ],
  config: [
    jidoka: [
      model_aliases: %{
        fast: "anthropic:claude-haiku-4-5"
      }
    ]
  ]
)
Jidoka.Kino.setup()

Define An Agent

A Jidoka agent starts with four public sections:

  • agent do for stable identity and optional context schema
  • defaults do for instructions and model
  • capabilities do for tools and other model-reachable capabilities
  • lifecycle do for runtime policy like hooks, guardrails, and memory

Only agent.id and defaults.instructions are needed for this first agent.

defmodule LivebookDemo.AssistantAgent do
  use Jidoka.Agent

  agent do
    id :livebook_assistant
    description "Minimal assistant used by the first Jidoka Livebook."
  end

  defaults do
    model :fast
    instructions "You are a concise assistant. Answer directly."
  end
end

Inspect the compiled agent without making a model call:

{:ok, definition} = Jidoka.inspect_agent(LivebookDemo.AssistantAgent)

Map.take(definition, [
  :kind,
  :id,
  :description,
  :model,
  :context,
  :tool_names,
  :subagent_names,
  :workflow_names,
  :handoff_names
])

Run The Agent

Start the agent and send one message. Jidoka.Kino.chat/3 captures useful runtime events, renders a compact trace, and returns plain response text.

{:ok, pid} =
  Jidoka.Kino.start_or_reuse("livebook-assistant", fn ->
    LivebookDemo.AssistantAgent.start_link(id: "livebook-assistant")
  end)

Jidoka.Kino.chat("Assistant chat", fn ->
  LivebookDemo.AssistantAgent.chat(pid, "Write one sentence about what Jidoka does.")
end)

Next

Continue with: