# アーキテクチャ

> PentAGIが実行するサービス、それらの連携方法、およびオプション機能について説明します。

PentAGIはDockerサービスの集合体です。コアスタックだけで[flows](https://pentagi.com/ja/docs/glossary/#flow)を実行するのに十分ですが、[knowledge graph](https://pentagi.com/ja/docs/glossary/#knowledge-graph)とオブザーバビリティスタックはオプションのアドオンです。

## [システムコンテキスト](https://pentagi.com/ja/docs/concepts/architecture/#system-context)

```mermaid
flowchart LR
  accTitle: System context of PentAGI with its users, targets, LLM providers, search engines, monitoring and the update server
  user["Security engineer"] -->|HTTPS| pentagi["PentAGI"]
  user -->|monitors| langfuse["Langfuse"]
  user -->|monitors| grafana["Grafana"]
  pentagi -->|tests| target["Target systems"]
  pentagi -->|queries| llm["LLM providers"]
  pentagi -->|searches| search["Search engines"]
  pentagi -->|reports| langfuse
  pentagi -->|reports| grafana
  pentagi -->|checks for updates| update["update.pentagi.com"]
```

PentAGI はまた、起動後2分以内およびその後3時間ごとに `update.pentagi.com` をチェックして新しいビルドの有無を確認し、リクエストとともにインストールの概要を送信します。[Update check](https://pentagi.com/ja/docs/configuration/security/#update-check) には、その内容と無効化する方法が記載されています。

## [サービス](https://pentagi.com/ja/docs/concepts/architecture/#services)

| グループ            | サービス                                                                                                                             | Composeファイル                        |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| コア              | `pentagi`（RESTおよびGraphQL対応Goバックエンド、React UI）、`pgvector`（pgvector搭載PostgreSQL）、`pgexporter`（PostgreSQLメトリクス）、`scraper`（隔離されたブラウザ） | `docker-compose.yml`               |
| Knowledge graph | `graphiti`、`neo4j`                                                                                                               | `docker-compose-graphiti.yml`      |
| LLMオブザーバビリティ    | `langfuse-web`、`langfuse-worker`、`clickhouse`、`redis`、`minio`、`postgres`                                                         | `docker-compose-langfuse.yml`      |
| システムオブザーバビリティ   | `grafana`、`otel`、`victoriametrics`、`jaeger`、`clickstore`、`loki`、`node-exporter`、`cadvisor`                                       | `docker-compose-observability.yml` |

[Tools](https://pentagi.com/ja/docs/glossary/#tool)は`pentagi`コンテナ自体の中では決して実行されません。各flowには、Kali Linuxなどflowの目的に合わせて選択されたイメージからビルドされた、独自の[sandbox](https://pentagi.com/ja/docs/glossary/#sandbox)コンテナが用意されます。

## [コンテナ](https://pentagi.com/ja/docs/concepts/architecture/#containers)

```mermaid
graph TB
  accTitle: Containers of the core stack and the optional knowledge graph
  subgraph Core
    UI[Web UI] -->|HTTP/WS| API[Backend API]
    API --> DB[(PostgreSQL + pgvector)]
    API --> Agents[Agents]
    Agents --> Sandbox[Sandboxed tools]
    Agents --> Scraper[Isolated browser]
  end
  subgraph Knowledge graph
    Graphiti --> Neo4j[(Neo4j)]
  end
  Agents --> Graphiti
  API -->|telemetry| OTEL[OpenTelemetry]
  API -->|LLM traces| Langfuse
```

* **バックエンドAPI** — Go製で、RESTおよびGraphQLに対応し、自動化のためのBearerトークンアクセスをサポートします。
* **Vector store** — pgvectorを搭載したPostgreSQLが、すべてのコマンド、出力、エンベディングを保持します。
* **Agents** — 作業の計画と実行を行うマルチエージェントシステムです。詳細は[Agents](https://pentagi.com/ja/docs/concepts/agents/)をご覧ください。
* **Sandbox** — ホストから隔離されたtool用コンテナです。本番環境では、これらを別の[worker node](https://pentagi.com/ja/docs/deployment/worker-node/)に配置することも可能です。