# agentflocks/flocks architecture

> Architecture diagram of the GitHub repository agentflocks/flocks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/agentflocks/flocks
- Repository: https://github.com/agentflocks/flocks

## Overview

Flocks is an AI-native SecOps platform. A user reaches agents through the WebUI, HTTP API, terminal UI, or messaging channels; agents work through sessions, tools, and model providers to produce SecOps results. Workflows and event-ingest services provide a separate automation branch, while memory and persistent storage support ongoing work. The README documents the product capabilities; source-level evidence is sampled for selected modules, so several runtime connections are shown as unverified rather than asserted.

Main entry points: [`flocks/session/session.py`](https://github.com/agentflocks/flocks/blob/main/flocks/session/session.py) (Session Runtime), [`flocks/workflow/runner.py`](https://github.com/agentflocks/flocks/blob/main/flocks/workflow/runner.py) (Workflow Runner), [`flocks/server/app.py`](https://github.com/agentflocks/flocks/blob/main/flocks/server/app.py) (HTTP API), [`flocks/tool/catalog.py`](https://github.com/agentflocks/flocks/blob/main/flocks/tool/catalog.py) (Agent Tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_webui["WebUI<br/>[App.tsx]"]
  node_http_api["HTTP API<br/>[app.py]"]
  node_terminal_ui["Terminal UI<br/>[app.tsx]"]
  node_messaging["Messaging Channels<br/>[manager.py]"]
end

subgraph group_agent_runtime["Agent Runtime"]
  node_agent_system["Agent System<br/>[agent.py]"]
  node_sessions["Session Runtime<br/>[session.py]"]
  node_tools["Agent Tools<br/>[catalog.py]"]
  node_providers["Model Providers<br/>[provider.py]"]
end

subgraph group_automation["Automation"]
  node_workflow_runner["Workflow Runner<br/>[runner.py]"]
  node_workflow_engine["Workflow Engine<br/>[engine.py]"]
  node_execution_plan["Execution Plan<br/>[execution_plan.py]"]
  node_workflow_models["Workflow Models<br/>[models.py]"]
  node_workflow_store[("Workflow Store<br/>[fs_store.py]")]
  node_event_ingest["Event Ingest<br/>[manager.py]"]
  node_syslog_ingest["Syslog Ingest<br/>[manager.py]"]
end

subgraph group_platform_services["Platform Services"]
  node_memory["Memory<br/>[manager.py]"]
  node_storage[("Persistent Storage<br/>[storage.py]")]
  node_hooks["Hook Pipeline<br/>[pipeline.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_mcp["MCP Integration<br/>[server.py]"]
  node_lsp["LSP Integration<br/>[server.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_webui
node_user -->|"requests"| node_http_api
node_user -.->|"uses"| node_terminal_ui
node_user -.->|"messages"| node_messaging
node_http_api -.->|"dispatches"| node_agent_system
node_messaging -.->|"dispatches"| node_agent_system
node_agent_system -.->|"runs"| node_sessions
node_sessions -.->|"invokes"| node_tools
node_sessions -.->|"requests"| node_providers
node_sessions -.->|"uses"| node_memory
node_sessions -.->|"persists"| node_storage
node_workflow_runner -->|"runs"| node_workflow_engine
node_workflow_runner -->|"builds"| node_execution_plan
node_execution_plan -->|"reads"| node_workflow_models
node_workflow_runner -.->|"resolves"| node_workflow_store
node_event_ingest -.->|"triggers"| node_workflow_runner
node_syslog_ingest -.->|"triggers"| node_workflow_runner
node_hooks -->|"resolves session"| node_sessions
node_config -->|"configures"| node_hooks
node_http_api -->|"executes"| node_hooks
node_http_api -.->|"exposes"| node_mcp
node_tools -.->|"uses"| node_mcp
node_tools -.->|"uses"| node_lsp

click node_webui "https://github.com/agentflocks/flocks/blob/main/webui/src/App.tsx"
click node_http_api "https://github.com/agentflocks/flocks/blob/main/flocks/server/app.py"
click node_terminal_ui "https://github.com/agentflocks/flocks/blob/main/tui/flocks/cli/cmd/tui/app.tsx"
click node_messaging "https://github.com/agentflocks/flocks/blob/main/flocks/channel/gateway/manager.py"
click node_agent_system "https://github.com/agentflocks/flocks/blob/main/flocks/agent/agent.py"
click node_sessions "https://github.com/agentflocks/flocks/blob/main/flocks/session/session.py"
click node_tools "https://github.com/agentflocks/flocks/blob/main/flocks/tool/catalog.py"
click node_providers "https://github.com/agentflocks/flocks/blob/main/flocks/provider/provider.py"
click node_memory "https://github.com/agentflocks/flocks/blob/main/flocks/memory/manager.py"
click node_storage "https://github.com/agentflocks/flocks/blob/main/flocks/storage/storage.py"
click node_workflow_runner "https://github.com/agentflocks/flocks/blob/main/flocks/workflow/runner.py"
click node_workflow_engine "https://github.com/agentflocks/flocks/blob/main/flocks/workflow/engine.py"
click node_execution_plan "https://github.com/agentflocks/flocks/blob/main/flocks/workflow/execution_plan.py"
click node_workflow_models "https://github.com/agentflocks/flocks/blob/main/flocks/workflow/models.py"
click node_workflow_store "https://github.com/agentflocks/flocks/blob/main/flocks/workflow/fs_store.py"
click node_event_ingest "https://github.com/agentflocks/flocks/blob/main/flocks/ingest/kafka/manager.py"
click node_syslog_ingest "https://github.com/agentflocks/flocks/blob/main/flocks/ingest/syslog/manager.py"
click node_hooks "https://github.com/agentflocks/flocks/blob/main/flocks/hooks/pipeline.py"
click node_config "https://github.com/agentflocks/flocks/blob/main/flocks/config/config.py"
click node_mcp "https://github.com/agentflocks/flocks/blob/main/flocks/mcp/server.py"
click node_lsp "https://github.com/agentflocks/flocks/blob/main/flocks/lsp/server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webui,node_http_api,node_terminal_ui,node_messaging,node_user toneBlue
class node_agent_system,node_sessions,node_tools,node_providers toneAmber
class node_workflow_runner,node_workflow_engine,node_execution_plan,node_workflow_models,node_workflow_store,node_event_ingest,node_syslog_ingest toneMint
class node_memory,node_storage,node_hooks,node_config,node_mcp,node_lsp toneRose
```

## Components

### User Interfaces

- [WebUI](https://github.com/agentflocks/flocks/blob/main/webui/src/App.tsx): `webui/src/App.tsx`
- [HTTP API](https://github.com/agentflocks/flocks/blob/main/flocks/server/app.py): `flocks/server/app.py`
- [Terminal UI](https://github.com/agentflocks/flocks/blob/main/tui/flocks/cli/cmd/tui/app.tsx): `tui/flocks/cli/cmd/tui/app.tsx`
- [Messaging Channels](https://github.com/agentflocks/flocks/blob/main/flocks/channel/gateway/manager.py): `flocks/channel/gateway/manager.py`

### Agent Runtime

- [Agent System](https://github.com/agentflocks/flocks/blob/main/flocks/agent/agent.py): `flocks/agent/agent.py`
- [Session Runtime](https://github.com/agentflocks/flocks/blob/main/flocks/session/session.py): `flocks/session/session.py`
- [Agent Tools](https://github.com/agentflocks/flocks/blob/main/flocks/tool/catalog.py): `flocks/tool/catalog.py`
- [Model Providers](https://github.com/agentflocks/flocks/blob/main/flocks/provider/provider.py): `flocks/provider/provider.py`

### Automation

- [Workflow Runner](https://github.com/agentflocks/flocks/blob/main/flocks/workflow/runner.py): `flocks/workflow/runner.py`
- [Workflow Engine](https://github.com/agentflocks/flocks/blob/main/flocks/workflow/engine.py): `flocks/workflow/engine.py`
- [Execution Plan](https://github.com/agentflocks/flocks/blob/main/flocks/workflow/execution_plan.py): `flocks/workflow/execution_plan.py`
- [Workflow Models](https://github.com/agentflocks/flocks/blob/main/flocks/workflow/models.py): `flocks/workflow/models.py`
- [Workflow Store](https://github.com/agentflocks/flocks/blob/main/flocks/workflow/fs_store.py): `flocks/workflow/fs_store.py`
- [Event Ingest](https://github.com/agentflocks/flocks/blob/main/flocks/ingest/kafka/manager.py): `flocks/ingest/kafka/manager.py`
- [Syslog Ingest](https://github.com/agentflocks/flocks/blob/main/flocks/ingest/syslog/manager.py): `flocks/ingest/syslog/manager.py`

### Platform Services

- [Memory](https://github.com/agentflocks/flocks/blob/main/flocks/memory/manager.py): `flocks/memory/manager.py`
- [Persistent Storage](https://github.com/agentflocks/flocks/blob/main/flocks/storage/storage.py): `flocks/storage/storage.py`
- [Hook Pipeline](https://github.com/agentflocks/flocks/blob/main/flocks/hooks/pipeline.py): `flocks/hooks/pipeline.py`
- [Configuration](https://github.com/agentflocks/flocks/blob/main/flocks/config/config.py): `flocks/config/config.py`
- [MCP Integration](https://github.com/agentflocks/flocks/blob/main/flocks/mcp/server.py): `flocks/mcp/server.py`
- [LSP Integration](https://github.com/agentflocks/flocks/blob/main/flocks/lsp/server.py): `flocks/lsp/server.py`

### Other components

- **User**

## Connections

- User → WebUI: uses (evidence: `README.md`)
- User → HTTP API: requests (evidence: `README.md`)
- User → Terminal UI: uses
- User → Messaging Channels: messages
- HTTP API → Agent System: dispatches
- Messaging Channels → Agent System: dispatches
- Agent System → Session Runtime: runs
- Session Runtime → Agent Tools: invokes
- Session Runtime → Model Providers: requests
- Session Runtime → Memory: uses
- Session Runtime → Persistent Storage: persists (evidence: `flocks/storage/storage.py`)
- Workflow Runner → Workflow Engine: runs (evidence: `flocks/workflow/runner.py`)
- Workflow Runner → Execution Plan: builds (evidence: `flocks/workflow/runner.py`)
- Execution Plan → Workflow Models: reads (evidence: `flocks/workflow/execution_plan.py`)
- Workflow Runner → Workflow Store: resolves
- Event Ingest → Workflow Runner: triggers (evidence: `flocks/ingest/kafka/manager.py`)
- Syslog Ingest → Workflow Runner: triggers (evidence: `flocks/ingest/syslog/manager.py`)
- Hook Pipeline → Session Runtime: resolves session (evidence: `flocks/hooks/pipeline.py`)
- Configuration → Hook Pipeline: configures (evidence: `flocks/hooks/pipeline.py`)
- HTTP API → Hook Pipeline: executes (evidence: `flocks/server/app.py`)
- HTTP API → MCP Integration: exposes
- Agent Tools → MCP Integration: uses
- Agent Tools → LSP Integration: uses
