Architecture
1. Overview
AKG Agents is an LLM-powered multi-agent collaboration framework for AI Infra and high-performance computing, aimed at boosting the development and optimization efficiency of high-performance code through intelligent agent collaboration.
The framework provides a complete agent infrastructure: extensible Skill / Tools / Sub-agent mechanisms, LangGraph workflow orchestration, tree-based Trace system, and a unified configuration and registry.
2. Architecture Diagram
┌─────────────────────────────────────────────────────────────────┐
│ AKG Agents │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌───────────────┐ │
│ │ Agents │ │ Skills │ │ Tools │ │ Workflows │ │
│ │ │ │ │ │ │ │ (LangGraph) │ │
│ │ AgentBase │ │ Registry │ │ Executor │ │ BaseWorkflow │ │
│ │ ReAct │ │ Loader │ │ Basic │ │ BaseTask │ │
│ │ Plan │ │ Selector │ │ Domain │ │ Router │ │
│ │ Registry │ │ Hierarchy│ │ │ │ Visualizer │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └──────┬────────┘ │
│ │ │ │ │ │
│ ┌────┴──────────────┴─────────────┴───────────────┴────────┐ │
│ │ Trace System │ │
│ │ TraceSystem · FileSystemState · ActionCompressor │ │
│ └──────────────────────────┬────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────┴────────────────────────────────┐ │
│ │ LLM Layer │ │
│ │ LLMProvider · LLMClient · Embedding │ │
│ └──────────────────────────┬────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────┴────────────────────────────────┐ │
│ │ Configuration │ │
│ │ AKGSettings · ModelConfig · EmbeddingConfig │ │
│ └───────────────────────────────────────────────────────────┘ │
│ │
├─────────────────────────────────────────────────────────────────┤
│ Scenarios │
│ ┌───────────────────┐ ┌────────────────┐ ┌──────────────┐ │
│ │ Kernel Agent (op) │ │ Common Agent │ │ More ... │ │
│ │ Multi-backend │ │ │ │ │ │
│ │ Multi-DSL │ │ │ │ │ │
│ └───────────────────┘ └────────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────┘
3. Module Overview
| Module | Description |
|---|---|
| Agents | Agent base classes (AgentBase, ReActAgent), agent registry and discovery mechanism. See Agent System. |
| Skills | Skill management system: metadata, loading, registry, hierarchy, LLM-driven selection, version management. See Skill System. |
| Tools | Tool execution framework: built-in tools (file I/O, shell), domain tools (kernel verification, profiling), argument resolver. See Tools. |
| Workflows | LangGraph-based workflow orchestration: BaseWorkflow, BaseLangGraphTask, routers, visualization. See Workflow. |
| Trace | Tree-based inference tracing system: multi-fork, state persistence, checkpoint resume. See Trace System. |
| LLM | LLM access layer: OpenAI-compatible provider, client with token counting and streaming, embedding models. See LLM. |
| Configuration | Unified configuration management: settings.json, environment variables, multi-level priority. See Configuration. |
4. Scenario: Kernel Agent
The first production scenario is AI Kernel Code Generation — leveraging LLM planning and multi-agent collaboration to automate multi-backend, multi-DSL high-performance kernel generation and optimization.
For details, see Kernel Agent.
5. CLI
AKG Agents provides a command-line interface (akg_cli) for interactive use. See AKG CLI.
6. Additional Modules (v1 Documentation)
The following modules have not changed since v1 and their documentation remains in the v1 directory:
| Module | Description | Documentation |
|---|---|---|
| RAG | Vector retrieval-augmented generation module | RAG (EN) / RAG (CN) |
| Database | Database base class and kernel-specific storage | Database (EN) / Database (CN) |
| Server Architecture | Client-Server-Worker service architecture | ServerArchitecture (EN) / ServerArchitecture (CN) |
| DevicePool | Device pool management (Ascend / CUDA / CPU) | DevicePool (EN) / DevicePool (CN) |
| TaskPool | Async task pool management | TaskPool (EN) / TaskPool (CN) |