Jidoka.Agent (Jidoka v0.9.0)

Copy Markdown View Source

Minimal Spark DSL for defining a Jidoka agent on top of Jido.

defmodule MyApp.TimeAgent do
  use Jidoka.Agent

  agent :time_agent do
    model "openai:gpt-4o-mini"
    instructions "Use local_time when asked for the time."
  end

  tools do
    action MyApp.Actions.LocalTime
  end
end

{:ok, text} = Jidoka.chat(MyApp.TimeAgent, "What time is it in Chicago?")

Agent modules also generate bound chat/2 and run_turn/2 convenience functions. Use the root Jidoka facade as the main application path.

Summary

Functions

Runs a DSL agent turn and returns final assistant text.

Returns the normalized data compiled from a Spark DSL agent module.

Runs a DSL agent turn through Jidoka turn execution.

Compiles a DSL agent module into Jidoka.Agent.Spec.

Functions

chat(agent_module, input, opts \\ [])

@spec chat(module(), String.t(), keyword()) ::
  {:ok, String.t()} | {:hibernate, Jidoka.Snapshot.t()} | {:error, term()}

Runs a DSL agent turn and returns final assistant text.

definition!(agent_module)

@spec definition!(module()) :: %{
  id: String.t(),
  model: LLMDB.Model.t(),
  generation: Jidoka.Agent.Spec.Generation.t(),
  instructions: String.t(),
  description: String.t() | nil,
  context_schema: term(),
  result: Jidoka.Agent.Spec.Result.t() | nil,
  memory: Jidoka.Agent.Spec.Memory.t() | nil,
  actions: [module()],
  operations: [Jidoka.Agent.Spec.Operation.t()],
  tool_sources: [map()],
  controls: Jidoka.Agent.Spec.Controls.t()
}

Returns the normalized data compiled from a Spark DSL agent module.

run_turn(agent_module, input, opts \\ [])

@spec run_turn(module(), Jidoka.Turn.Request.input(), keyword()) ::
  {:ok, Jidoka.Turn.Result.t()}
  | {:hibernate, Jidoka.Snapshot.t()}
  | {:error, term()}

Runs a DSL agent turn through Jidoka turn execution.

spec(agent_module)

@spec spec(module()) :: Jidoka.Agent.Spec.t()

Compiles a DSL agent module into Jidoka.Agent.Spec.