// Examples
Tutorials, ordered.
Ten tutorials, sorted by what you need next. Start with the Neuron in twelve lines; finish on the production switch from MemorySynapse to NATS or Kafka. Then the CLI reference, in one page.
A Neuron is just an async function. Wrap it in an Axon, host it on a Dendrite, connect an orchestrator Dendrite, and call dispatch_and_wait. No broker needed — MemorySynapse runs in-process.
from cosmonapse import Axon, Dendrite, MemorySynapse async def greet(input, context): return {"msg": f"Hello, {input['name']}!"} synapse = MemorySynapse() await synapse.connect() worker = Dendrite(synapse=synapse, namespace="demo", role="worker") worker.attach_axon(Axon(neuron_id="greeter", neuron_fn=greet)) orch = Dendrite(synapse=synapse, namespace="demo") async with worker, orch: reply = await orch.dispatch_and_wait( neuron="greeter", input={"name": "world"}, timeout_s=5.0 ) print(reply.payload["output"]) # {"msg": "Hello, world!"}→ Building a Neuron — full walkthrough