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

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} = MyApp.TimeAgent.chat("What time is it in Chicago?")

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's harness.

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.Runtime.AgentSnapshot.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.request_input(), keyword()) :: Jidoka.run_result()

Runs a DSL agent turn through Jidoka's harness.

spec(agent_module)

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

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