FelisOrion

FelisOrion

Spectre - OTP-native runtime for explicit and policy-controlled AI agents

Hi everyone,

I recently made Spectre public.

Spectre is an OTP-native Elixir runtime for building AI agents while keeping routing, state, policies and side effects explicit.

I started working on it because I wanted to use agents inside real Elixir applications without moving all the application logic into prompts or hiding it behind a large framework.

The basic idea is simple:

  • the model can help classify requests and propose actions;

  • deterministic application policies decide whether protected actions are allowed;

  • approvals update the agent state but do not automatically execute anything;

  • the host application remains responsible for side effects.

For example, an agent may propose sending a message, changing data or deleting an account. Spectre can represent that action, request confirmation when required and return the result to the application. The application still decides how and when the action is executed.

Spectre uses a small DSL to describe the stable shape of an agent, including routes, policies, actions and interruptions. Normal Elixir modules continue to own the business logic, storage, permissions and integrations.

A small example:

defmodule MyApp.SupportAgent do
  use Spectre.Agent

  actions MyApp.SupportActions do
    protect(:delete_account, with: :delete_account_confirmation)
  end

  policy :delete_account_confirmation do
    request(:confirm_delete_account)
    accept(:confirmed_delete, regex: ~r/^yes, delete it$/i)
    reject(:cancel_delete, regex: ~r/^(no|cancel)$/i)
    attempts(3, then: :cancel_pending)
  end

  flow :support do
    on :PRICING, regex: ~r/\b(price|pricing|cost)\b/i do
      reply(:pricing)
    end

    on :DELETE_ACCOUNT, regex: ~r/\bdelete my account\b/i do
      action(:delete_account)
    end
  end
end

The project is designed around OTP processes and explicit state transitions rather than autonomous execution hidden inside the framework.

I am also developing optional companion libraries for areas such as tool planning, browser interaction, memory and mission planning. They are separate projects because not every agent needs all of these capabilities, and I prefer being able to add only the parts required by an application.

Spectre is currently in public preview. I am already using it in a few applications, but some APIs may still evolve as I continue testing the design in real projects.

Feedback about the API, architecture and documentation is very welcome.

Source code:

Where Next?

Popular in Announcing Top

Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: GitHub - tmbb/phoenix_ws: Websockets implemented over Phoenix Ch...
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New
tfwright
After working on it for a couple of months and using it in production for most of that time, today I’ve released LiveAdmin, a LiveView ba...
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
198 11220 107
New

Other popular topics Top

New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement