zgbjgg
Hayata - An Erlang/OTP framework for building AI agents
Hayata is an Erlang/OTP framework for building AI agents using a graph-based execution model. It is designed to bring the benefits of Erlang’s concurrency, supervision, and fault-tolerance model to agent development, while remaining usable from both Erlang and Elixir applications.
The project started with a simple idea: what would an agent framework look like if it were designed around Erlang/OTP from the ground up?
Rather than treating agents as a collection of function calls, Hayata models execution through agents, nodes, and edges, with explicit process responsibilities and message passing.
What can you build with Hayata?
Hayata provides a runtime for coordinating agent execution and integrating LLMs into applications.
Some of its main features include:
-
Graph-based execution: Define nodes and control the execution flow through decision policies.
-
OTP supervision: Use supervised processes, monitoring, and message passing to manage execution and failures.
-
Parallel execution: Run multiple branches concurrently and collect their results in a predictable order.
-
LLM integration: Use provider adapters to connect agents to different LLM providers, including OpenAI, Anthropic, and Gemini.
-
Tool execution: Let an agent invoke tools, process their results, and continue the model interaction cycle.
-
Native streaming: Support streaming responses through the LLM integration layer.
-
Conversational memory: Keep conversational memory separate from the core execution runtime.
-
Telemetry: Observe agent invocations and execution lifecycles through Telemetry events.
The goal is not to reproduce another framework’s API feature by feature. Hayata follows its own design, built around Erlang/OTP primitives.
How does it work?
At a high level, an agent coordinates an invocation, nodes execute tasks, and a decision policy determines what happens next.
A policy can schedule another node, launch multiple nodes in parallel, or finish the invocation. Nodes and their associated processes manage execution and report their results back to the runtime.
For example, an agent using an LLM and a weather tool can follow this sequence:
-
Send the user’s question to the LLM.
-
Receive a tool call, such as
get_weather. -
Execute the tool and collect its result.
-
Send the tool result back to the LLM.
-
Return the final answer, optionally as a streamed response.
The runtime coordinates this cycle, while provider adapters handle the communication and response normalization required by each LLM provider.
Why Erlang/OTP?
I think Erlang ecosystem’s strengths could be applied to AI agent execution.
Agents can involve concurrent tasks, external requests, long-running operations, and failures at different points in an execution. Erlang/OTP offers useful primitives for structuring these systems: supervised processes, monitoring, message passing, and explicit lifecycle management.
Hayata is an attempt to build on those primitives rather than hide them behind a generic agent abstraction.
Project status
Hayata is available on Hex, and the repository includes working examples and tests. The project is actively evolving as I develop the agent runtime and its LLM integrations.
Feedback, ideas, and contributions are welcome. I’d especially like to hear from people experimenting with AI agents in Erlang or Elixir, and from anyone interested in exploring OTP-based approaches to agent orchestration.
Links
Hex package: hayata | Hex
HexDocs: The hayata application
GitHub repository:
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #hex










