Skip to content

Quickstart

Install the reference SDK and run two coordinating agents.

Alpha

The Python SDK is in development, not yet on PyPI, and the API surface may shift as it stabilizes.

Prerequisites

  • Python 3.10+

Install

bash
pip install git+https://github.com/signalgatingprotocol/python-sdk

Run two coordinating agents

A planner emits tasks; a gate on the worker lets only the high-priority ones through:

python
import asyncio
from signal_gating import Signal, Gate, Agent, Mesh

class TaskSignal(Signal):
    task: str

planner = Agent("planner")
worker = Agent("worker", gates=[Gate.by_priority(3)])  # only high-priority tasks reach it

@worker.on(TaskSignal)
async def handle(signal: TaskSignal):
    print(f"working on: {signal.task}")

mesh = Mesh([planner, worker])
mesh.connect(planner, worker)

async def main():
    async with mesh:
        await planner.emit(TaskSignal(task="build feature", priority=5))
        await planner.emit(TaskSignal(task="minor cleanup", priority=1))  # gated out
        await asyncio.sleep(0.05)

asyncio.run(main())

What's happening

  • Gate.by_priority(3) suppresses the low-priority task before it ever reaches the worker.
  • @worker.on(TaskSignal) registers a typed handler; the worker reacts only to the signals it cares about.
  • mesh.connect(planner, worker) wires the topology; the mesh routes signals along it.

Next steps

  • Read Core Concepts for the Signal / Gate / Agent / Mesh model.
  • Browse the SDKs for the full primitive surface.
  • See the Specification for the formal protocol definition.

Released under open governance.