Jidoka: Hello Agent
Build the smallest useful Jidoka agent, inspect its compiled definition, and
send it one provider-backed chat request through a Jidoka.Session.
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/agentjido/jidoka.git", branch: "main"},
{: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 dofor stable identity and optional context schema -
defaults dofor instructions and model -
capabilities dofor tools and other model-reachable capabilities -
lifecycle dofor 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
Create a session and send one message. The session is just data: it names the
conversation, the runtime agent id, and trusted context. Jidoka.chat/3 starts
or reuses the session’s runtime agent.
session =
Jidoka.Session.new!(
agent: LivebookDemo.AssistantAgent,
id: "livebook-assistant",
context: %{channel: "livebook"}
)
Map.take(session, [:id, :agent_id, :conversation_id, :context])
Jidoka.Kino.chat/3 captures useful runtime events, renders a compact trace,
and returns plain response text.
Jidoka.Kino.chat("Assistant chat", fn ->
Jidoka.chat(session, "Write one sentence about what Jidoka does.")
end)
Next
Continue with: