Hello everyone,
I would like to share with you Hail, a Swift runtime for building durable, distributed LLM agents.
Please note this is an early-stage implementation—many details can still change. I have also used coding agents to help me as a solo developer to deliver the work, while I keep track of the implementation and the design myself.
Hail an agent—it answers from wherever it lives. The name comes from hailing a ship—or a spacecraft—and inviting it to reply. And this is not only a metaphor: an agent keeps the same stable address whether it runs on your local node, on a machine across the network, or on any node across the globe —or, one day, a spacecraft. It can be idle, recovered after a failure, or moved to another machine; you just hail it, and it answers.
The core idea: LLMs are tools, not the foundation of your product. I believe agent infrastructure should belong to everyone, not only to big tech. Hail is built on open-source Swift and keeps every model provider replaceable—hosted API, local, self-hosted, or your own integration behind one ModelEndpoint protocol. No provider is privileged by the architecture: your agent definitions, tools, authority policies, and event journal stay the same when you change vendors. Small teams and individual developers should be able to build agent products without asking permission from a platform.
The second point where I take a clear position: most agent frameworks today are built around a loop—while true, the host keeps the agent alive, polls, retries, and owns the control flow. And because a loop dies with the process, they then build durable workflows on top of it: external orchestrators, checkpoint stores, retry plumbing—durability at the wrong granularity, owned by the framework instead of the agent. I think this is the wrong abstraction. Hail follows the virtual actor model with event sourcing instead: an isolated agent owns its state, receives a message, reacts, emits durable events, and then becomes idle. There is no loop to keep alive, no process to babysit, and no orchestrator to reconcile with reality. A message arrives, the agent activates—possibly on another node, possibly after weeks of being idle—replays its journal if needed, reacts, and sleeps again. Durability belongs to the entity, not to the framework around it. The runtime manages the lifecycle; you just address the agent.
How it works:
- Distributed actors—an agent is an isolated, stateful actor with a typed message boundary. It does not belong to one process or one machine.
- Durable entities—Virtual Actors give the agents a stable identity which survives failure: event sourcing journals every meaningful transition, and a recovered actor replays the journal. The journal is the source of truth; a warm session from a provider is only an optimization.
- Scoped effects—an LLM can propose an action, but the host decides what this action may touch. File, process, and network operations are represented as typed values (
ScopedEffect), anAuthoritygrants or denies them, andwithEffectcreates a non-escapableEffectTokenonly inside the granted scope. Secrets travel as references (SecretRef), never as raw strings in prompts or in the logs. This is inspired by the work of Martin Odersky and collaborators on tracked capabilities for safer agents, adapted to the concurrency model of Swift.
A small example:
let scoutID = AgentID(role: Role("scout"), contextID: AgentContextID("mission-7"))
let scout: Agent = try await system.virtualActors.getActor(
identifiedBy: VirtualActorID(rawValue: scoutID.rawValue),
dependency: AgentSpawnConfig(agentID: scoutID, projectRootPath: projectRoot)
)
let reply: ChatResponse = try await scout.respond(
"Survey the area and report anything unusual."
)
Requirements: Swift 6.4, and macOS 26 for the local CLI model harnesses. The current implementation builds on AnyLanguageModel for the model abstractions and swift-acp for the Agent Client Protocol integrations.
I would especially appreciate feedback on two areas:
- Does the
ScopedEffect/Authoritydesign provide a useful security boundary in practice? - Is the combination of virtual actors and event sourcing a convincing execution model for durable agents?
The repository is here: github.com/akbashev/hail

