Files
CyberStrikeAI/docs/en-US/architecture.md
T
Sycun cfaa95d7bd refactor(runtime): remove Eino and make Pi the sole agent engine
Delete the Eino model adapters, callbacks, middleware, orchestration,
summarization and single-agent runner together with their dependencies.
Chat, batch tasks, workflow Agent nodes and sub-agents now share the Pi
runtime, and dispatch is a single code path instead of an engine switch.

Configuration migrates eino_middleware/eino_skills to runtime/skills and
drops the retired callback settings while old files still load. Settings,
i18n and docs describe Pi only. Also carry the Pi follow-up fixes: empty
required lists are omitted from tool schemas, historical tool results stay
with their call batch, model proxies work over HTTP/1.1, single-query
retrieval skips query expansion, and finalization docs match Pi lifecycle
events.
2026-11-12 17:55:36 +08:00

2.5 KiB

Architecture

中文

CyberStrikeAI is a single Go Web application with a static frontend, SQLite persistence, Agent orchestration, MCP tooling, workflow graphs, knowledge retrieval, and optional C2/WebShell subsystems.

Overview

flowchart LR
    U["Web / Robot / API"] --> R["Gin Router"]
    R --> H["Handlers"]
    H --> DB["SQLite"]
    H --> A["Agent / Multi-Agent"]
    A --> M["MCP Server"]
    M --> T["Built-in / YAML / Skill tools"]
    M --> EM["External MCP"]
    A --> K["Knowledge Retrieval"]
    H --> W["Workflow Runtime"]
    H --> C2["C2"]
    H --> WS["WebShell"]
    H --> AU["Audit / Monitor"]

Request Path

For /api/agent/stream:

  1. Gin route enters auth middleware.
  2. Handler parses message, conversation, role, uploads, and WebShell context.
  3. Agent builds model input: history, role prompt, project facts, tools.
  4. Pi Runner calls the model.
  5. Tool requests go through MCP.
  6. HITL may interrupt before execution.
  7. Tool results are saved to process details and monitoring.
  8. Model continues and produces final text.
  9. SSE streams progress and deltas to the browser.
  10. Conversation and process details persist to SQLite.

This explains why a failure may live in auth, config, model, MCP, HITL, DB, SSE, or frontend rendering.

Cross-Cutting Modules

  • Project facts are injected into Agent context.
  • HITL sits before tool execution.
  • Monitor records tool execution and supports cancellation/review.
  • Audit records platform management actions.
  • Tool search controls what tools the model can currently see.

These are not just pages; they affect many runtime paths.

Complexity Hotspots

  • internal/app/app.go: service construction and route wiring.
  • internal/handler/config.go: hot application of config across model, KB, C2, robot, MCP.
  • internal/multiagent/: streaming, retry, summarization, middleware, tools.
  • internal/security/: auth and shell execution boundary.
  • internal/database/: SQLite schema compatibility.

Design Trade-Offs

The project uses a single Go service, static frontend, and SQLite to keep deployment simple. The trade-offs:

  • multi-instance scale is not automatic;
  • runtime files must be backed up carefully;
  • high-privilege tools and admin UI live in one process, so deployment isolation matters.

Source Anchors

  • App wiring: internal/app/app.go
  • Handlers: internal/handler/
  • Multi-agent: internal/multiagent/
  • MCP: internal/mcp/
  • DB: internal/database/