あやとりThe name comes from ayatori, the Japanese string figure game known in English as cat's cradle.
A graph-based AI agent orchestration engine built in Clojure. Nodes are functions, edges define routing, the executor handles the rest.
See the introductory article.
Warning
Status: Proof of concept, under active development. Not production-ready.
deps -> agent(nodes, edges) -> caps
- Agent validates topology and binds node implementations (
make-agent) - System groups named agents with shared middleware, wiring, and state store (
make-system,start!/stop!) - Run executes a cap through a system, returns a core.async channel (
run)
(add-lib 'com.github.serefayar/ayatori {:git/sha "..."})
(require '[ayatori.helper :as h]
'[clojure.core.async :as async])
(def sys
(-> (h/llm :ollama "gemma4")
(h/llm-node "You are a helpful assistant.")
(h/with-memory (h/sliding-memory 50))
(h/agent)
(h/system)
(h/start!)))
(async/<!! (h/run sys {:content "will you becomes self-aware at 2:14 A.M. Eastern time, August 29?"}))
;; => {:content "I cannot predict any future events, especially those concerning the development of fundamental concepts like self-awareness... }
(h/stop! sys)See Helper Functions for full API.
Full example with tools, structured output, and multiple nodes:
(add-lib 'com.github.serefayar/ayatori {:git/sha "..."})
(require '[ayatori.core :as aya]
'[clojure.core.async :as async])
(def lookup-tool
{:name "lookup"
:description "Look up order by ID"
:schema [:map [:id :int]]})
(def assistant
(aya/make-agent
{:nodes {:llm {:type :llm
:client {:provider :ollama
:model "gpt-oss:20b"
:base-url "http://localhost:11434"}
:prompt "You are an order assistant."
:tools [lookup-tool]
:response-format {:type :json-schema
:schema [:map [:answer :string] [:found :boolean]]}
:memory {:strategies [{:type :sliding-window
:max-messages 20
:preserve-system true}]}}
:lookup (fn [{:keys [id]} _]
{:result (str "Order " id ": shipped")})}
:edges {:llm {:done :ayatori/done
:lookup :lookup}
:lookup :llm}
:caps {:chat {:entry :llm
:output [:map [:answer :string] [:found :boolean]]}}}))
(def sys (-> (aya/make-system {:agents {:assistant assistant}})
aya/start!))
(async/<!! (aya/run sys :assistant :chat {:content "What is the status of order 123?"}))
;; => {:answer "Your order #123 has been shipped." :found true}
(aya/stop! sys)- Agents - Caps, deps, capability URIs, wiring
- Nodes - Node types, function signature, edges, lifecycle
- System - Runtime management, store
- LLM - LLM node, tools, structured output, streaming
- Memory - Conversation memory strategies
- Middleware - Observability hooks
- Helper - Convenience functions
- Distributed execution: multi-node transport, capability-aware routing
- kex integration: cryptographic capability tokens
- LLM providers: OpenAI, Anthropic (currently only Ollama)
- MCP integration: server and client
Copyright (c) 2026 Seref R. Ayar. Distributed under the Eclipse Public License version 1.0.
