GenAgentEnsemble.Agents.Simple (gen_agent_ensemble v0.2.0)

Copy Markdown View Source

A reusable single-turn GenAgent callback module.

The smallest useful agent: accepts a prompt, runs one backend turn, returns to idle ready for the next prompt. All options are forwarded to the backend as-is, so you can pass backend-specific keys like :system_prompt (Claude), :system (Anthropic), :model, etc.

Intended for iex experimentation and as the default worker for example ensembles. For real projects you'll typically write your own callback module with richer state and prompt-engineered behaviour.

Example (from iex)

{:ok, _} =
  GenAgentEnsemble.start_link(
    name: "solo",
    strategy: GenAgentEnsemble.Strategies.Solo,
    opts: [
      agent: {"w", GenAgentEnsemble.Agents.Simple,
              backend: GenAgent.Backends.Anthropic,
              system: "You are a pragmatic Elixir reviewer."}
    ]
  )

{:ok, r} = GenAgentEnsemble.ask("solo", "What's wrong with Enum.map(list, &(&1 + 1))?")
IO.puts(r.text)