Skip to content

Monitor-Lizzard/whisperer

Repository files navigation

Whisperer

Actions Status Hex.pm Documentation

Whisperer is an unopionated multi-agent framework in Elixir

Features

  • No-batteries-included: With Whisperer, you can build your own agents with any implementations and logic you want
  • Resilient orchestration: Whisperer orchestrates and manages the lifecycle of your agents using battle-tested OTP strategies
  • Scalable: Whisperer is built on top of Elixir's OTP, which means it can scale to millions of agents with ease
  • Fault-tolerant: Whisperer is built to be fault-tolerant, meaning that it can recover from failures and continue to operate

 Workflow Structure

Workflow Struture

Key Components

Orchestrator

The Orchestrator is the main component of Whisperer. It is responsible for managing the lifecycle of agents and orchestrating the communication between them. The Orchestrator is the entry point for all agents and is responsible for starting, stopping, and monitoring agents.

Agent

An Agent is a worker that performs a specific task. Agents can be implemented in any way you want, as long as they implement the Whisperer.Agent behaviour. Agents can communicate with each other using messages.

Message

A Message is a data structure that is sent between agents. Messages can contain any data you want, as long as it is serializable. Messages are used to communicate between agents and the Orchestrator.

Sequence

A Sequence is a collection of agents that are executed in a specific order. Sequences can be used to model complex workflows and orchestrate the work of multiple agents.

If available in Hex, the package can be installed by adding whisperer to your list of dependencies in mix.exs

Usage

1. Implement a Sequencer

defmodule MultiAgentDemo.Simple.Sequencer do
  @moduledoc false

  alias Whisperer.Sequence
  @behaviour Whisperer.Sequencer

  @impl true
  def create_sequence(_content, _characteristics, _conversation_history) do
    {:ok,
     %Sequence{
       start_agent: "bracket",
       connections: %{
         "bracket" => ["division"],
         "division" => ["multiplication"],
         "multiplication" => ["addition"],
         "addition" => ["subtraction"]
       }
     }}
  end
end

2: Initialize the Workflow

{:ok, _} = Whisperer.start_session(session_id, MultiAgentDemo.Simple.Sequencer, %{})

3: Implement agents

defmodule MultiAgentDemo.Simple.Agents.Division do
  @moduledoc false

  @agent_id "division"

  @behaviour Whisperer.Agent

  @impl true
  def characteristics do
    %{
      id: @agent_id,
      name: "Division Agent",
      description: "Specializes in dividing numbers",
      capabilities: ["math", "division"]
    }
  end

  @impl true
  def process_message(%_{content: content}, _context, _conversation_history) do
    with result <- solve_division(content) do
      {:ok, %Whisperer.Message{content: result, agent_id: @agent_id, role: :assistant}}
    end
  end
end

4: Add implemented agents to the workflow

Whisperer.add_agent(session_id, MultiAgentDemo.Simple.Agents.Division)

5: Evaluate User Input

Whisperer.process_user_input(session_id, content)

Demos

A demo app for the BODMAS mathematics problem containing two implementations, an algorithmic implementation and an LLM implementation has been created here

def deps do
  [
    {:whisperer, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/whisperer.

About

Whisperer provides an unopinionated approach for running multiple agents in Elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages