Skip to content
agustito37Public

About

Graph Stigmergic Multi-Agent System

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

GSMAS

Decentralized multi-agent platform for collaborative investigation over knowledge graphs, with stigmergic coordination

Given an input signal about an investigation case, specialist agents reconstruct what happened, with what degree of confidence, and propose a conclusion — in an auditable and reproducible way. The platform orchestrates the agents, materializes the units of work, propagates graph events, and consolidates learning across cases. The same architecture serves different kinds of investigation: the roles that take part and the tools each one invokes are declared by configuration.

Core ideas

  • Stigmergic coordination. No agent communicates directly with another: all coordination happens through mutations of a shared graph. Agents react to graph events relevant to their role. There is no central coordinator or planner.
  • Distributed learning by retrospective. When a wrong verdict is corrected, the role's retrospective distills an insight — a local rule keyed on the recurring identifier — into its long-term memory (LTM holds a role's Insight nodes). Later cases recall and apply it; each insight's vitality (corroborated vs refuted by the cases it was applied in) decides whether it stays active.
  • Configurable and extensible. Adding a new role or changing the available tools is declarative and does not require touching the core architecture.

Repository layout

  • core/ — domain-agnostic engine: the graph store and structural invariants, the event bus and orchestrator, roles/agents, and the learning module (recall + retrospective).
  • domain/ — the instantiated domain: security-alert triage (its roles, tools, and verdict vocabulary). The same core serves other domains by swapping this out.
  • app/ — FastAPI + WebSocket server and the live graph viewer (Cytoscape.js).
  • tests/ — unit (fast) and integration (real Neo4j) suites.

Stack

  • Python 3.14 with uv for dependency management.
  • Neo4j 5 (Docker) as the knowledge graph; Neo4j Browser for inspection.
  • Direct LLM SDKs (openai) behind a thin in-house interface.
  • Pydantic v2 for node models and structured LLM outputs.
  • asyncio for the event bus and asynchronous coordination.
  • Ruff (lint + format) and Pyright (type checking).

Prerequisites

  • uv
  • Docker (for Neo4j)
  • An OpenAI API key

Getting started

# 1. Dependencies
uv sync

# 2. Environment variables
cp .env.example .env
#    edit .env: OPENAI_API_KEY and NEO4J_AUTH (user/password format)

# 3. Neo4j
docker compose up -d

# 4. Check
#    Neo4j Browser: http://localhost:7474
Service Access
Neo4j Browser http://localhost:7474
Neo4j Bolt bolt://localhost:7687
User neo4j (per NEO4J_AUTH)

Run an example

With Neo4j up (docker compose up -d) and your .env filled in (OPENAI_API_KEY, NEO4J_AUTH), start the platform:

uv run python -m app.main   # dashboard on http://localhost:8000

Open http://localhost:8000, type an alert in the input box, and press investigate. For example:

SIEM alert [HIGH]: anomalous login for user jdoe from Minsk, Belarus on a new device

The swarm derives hypotheses, plans and runs investigations over the sample telemetry (data/telemetry.jsonl), gathers evidence, and concludes with a verdict — the whole graph builds in real time, and every conclusion is traceable back to the signal. To close the learning loop, give feedback on the verdict from the panel: that triggers each role's retrospective, which distills insights into its memory.

Development

uv run ruff check .           # lint
uv run ruff format .          # formatting (indentation, quotes, imports)
uv run pyright                # type checking
uv run pytest                 # unit tests (fast, no external dependencies)
uv run pytest -m integration  # integration tests (spin up Neo4j via testcontainers; needs Docker)

About

Graph Stigmergic Multi-Agent System

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages