End-to-End Topologies.
Runnable example setups built on Cosmonapse primitives. Copy any of them, swap the Synapse URL, and adapt for your own agents. Sorted by difficulty - start with Building a Neuron and work down. If you want a guided ten-step track instead, head to Tutorials.
Building a Neuron
The smallest possible Cosmonapse program - one Neuron, one Axon, one Dendrite, one TASK, one reply. Single process, in-memory Synapse, no broker. The example to read first.
Building an Orchestrator API
Wire a Dendrite into Flask, FastAPI, Express, or raw WSGI. Your HTTP framework stays at the edge and dispatches TASKs from its route handlers - the Neuron never sees HTTP, the framework never sees the Synapse.
Orchestrator + Round Robin
A Cortex (orchestrator Dendrite) load-balances prompts across two workers in a plain rotation. Slide across five stacks - Python and TypeScript over devsynapse, NATS, and Kafka.
Pathway - three consumption shapes
One primitive, three faces: await pw.wait() for sequential request/reply, @pw.on(SignalType.X) for reactive trace-scoped callbacks, and async for sig in pw: for streaming. Plus scope="terminal" for decentralised orchestration and observe_pathway() for non-originating watchers.
Integrating an Engram
Bind shared memory to a Neuron with EngramBinding. The Neuron calls recall() and imprint() to read and write the bound Engram without ever touching the protocol. Backed by InMemoryEngram; swap for SqliteEngram / PostgresEngram without editing Neuron code.
No Orchestrator
Drop the Cortex. Every worker hears every task and runs the same pure owner_of(trace_id), so exactly one claims each - no coordination, no queue. Same five stacks via the slider.
Real-world Neurons (MCP + web edge)
A Neuron is anything that interacts with the real world - here, a wrapped stdio MCP server. An HTTP API is not a Neuron: your web framework (Flask / Express) stays at the edge and dispatches TASKs from its route handlers via an orchestrator Dendrite. Same five stacks via the slider.
Capability-based Routing
A router Dendrite holds a RegistryStore and discovers workers from their REGISTER signals. Each task names a capability; the router finds a live worker that advertises it - no hard-coded ids. Same five stacks via the slider.
Bidding - TASK_OFFER / BID / TASK_AWARDED
Competitive bidding for capability-routed dispatch. Workers register on_task_offer + call bid(); the producer picks a winner by first_bid, lowest_cost, or highest_confidence and emits TASK_AWARDED. Atomic claim for heterogeneous deployments where queue-group routing falls short.
Full RAG System
Retrieval-augmented generation built entirely on Cosmonapse primitives - four Neurons across two workers, three Engrams across two hosts, run as a staged retrieve → rerank → generate pipeline on one trace. Hybrid semantic + lexical retrieval fused by reciprocal rank, plus an answer cache shared through one Engram binding.
RAG + MCP Coding Agent
RAG-grounded code generation that lands on disk and runs. A coder Neuron recalls the team style guide from a VectorEngram, an MCP filesystem Neuron writes the file, and a runner Neuron executes it - retrieve → write → run, one trace. The model follows rules it was never trained on, supplied entirely by retrieval.
Retry, STOP & Rollback
Resilience patterns over the RAG primitives, fully offline. run_with_retry re-dispatches a stuck stage on a fresh trace after STOPping the abandoned one; stop_trace cooperatively cancels a whole workflow by trace_id; and stop_trace(rollback=True) replays each Engram's saga journal to undo a half-finished write.