FelisOrion

FelisOrion

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:

Showing Posts 1 to 2

amackera

amackera

Nice work! I am watching this space develop into something exciting.

If the app restarts while an agent is waiting for a user to confirm something, does the pending confirmation survive, or does the user have to start over?

FelisOrion

FelisOrion OP

Thanks! The short answer is: it can survive, as long as durable state persistence is configured.

For example, imagine the agent asks, “Do you want me to delete this account?” At that point, Spectre saves both the pending action and the fact that it is waiting for confirmation. If the app restarts, starting the session again with the same conversation_id restores that state, so the user can simply reply “yes” or “no” and continue.

{:ok, session} =
  Spectre.summon(
    MyApp.SpectreSupervisor,
    MyApp.SupportAgent,
    conversation_id: "chat-123"
  )

The agent must use a durable state adapter backed by something like a database:

defmodule MyApp.SupportAgent do
  use Spectre.Agent

  state MyApp.AgentStateStore
end

So the behavior is under the application’s control: use durable state plus the same conversation ID to resume, or use in-memory state when restart recovery isn’t needed.

There are two additional details:

  • Dynamically created sessions are not automatically recreated after a full application restart. The host must summon the session again, normally when the next user message arrives.
  • Spectre restores the confirmation state, but it does not automatically resend the original question. The UI may need to display it again.

This is a good place for next improvements! Thank you.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews