Skip to content

Commit 0df390e

Browse files
committed
docs: update doc and ci/cd
1 parent e55d444 commit 0df390e

4 files changed

Lines changed: 75 additions & 12 deletions

File tree

.github/workflows/pr-tests-and-format.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,48 @@ on:
44
pull_request:
55

66
jobs:
7-
lint-and-test:
7+
test-backend:
88
runs-on: ubuntu-latest
9-
109
steps:
1110
- uses: actions/checkout@v4
12-
1311
- name: Set up uv
1412
uses: astral-sh/setup-uv@v2
1513
with:
1614
python-version: "3.12"
17-
cache: true
18-
1915
- name: Install dependencies
2016
run: uv sync --frozen
17+
- name: Run pytest
18+
run: uv run pytest
2119

20+
lint-backend:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up uv
25+
uses: astral-sh/setup-uv@v2
26+
with:
27+
python-version: "3.12"
28+
- name: Install dependencies
29+
run: uv sync --frozen
2230
- name: Check formatting with Black
2331
run: uv run black . --check
2432

25-
- name: Run pytest
26-
run: uv run pytest
33+
build-frontend:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Set up Node.js
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: '16'
41+
- name: Cache Node.js modules
42+
uses: actions/cache@v4
43+
with:
44+
path: ui-web/frontend/node_modules
45+
key: ${{ runner.os }}-node-${{ hashFiles('ui-web/frontend/package-lock.json') }}
46+
restore-keys: |
47+
${{ runner.os }}-node-
48+
- name: Install frontend dependencies
49+
run: npm install --prefix ui-web/frontend
50+
- name: Build frontend
51+
run: npm run build --prefix ui-web/frontend

ARCHITECTURE.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ LieGraph follows a **state machine architecture** built on LangGraph, with clear
3737
│ │ Identity │ │ Speech │ │ Voting │ │
3838
│ │ Inference │ │ Generation │ │ Logic │ │
3939
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
40+
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
41+
│ │ Strategy │ │ Speech │ │ Vote │ │
42+
│ │ Coordination │ │ Tools │ │ Tools │ │
43+
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
4044
├─────────────────────────────────────────────────────────────┤
4145
│ Configuration Layer │
4246
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
@@ -77,9 +81,18 @@ LieGraph follows a **state machine architecture** built on LangGraph, with clear
7781
- `merge_private_states`: Incremental mindset updates
7882
- `add`: Append-only operations for immutable records
7983

80-
### 3. AI Strategy (`src/game/llm_strategy.py`)
84+
### 3. AI Strategy System (`src/game/strategy/`)
85+
86+
**Purpose**: Implements intelligent agent behavior through LLM reasoning with structured tools.
87+
88+
**Core Components**:
89+
- **Strategy Core (`strategy_core.py`)**: Main coordination for LLM-powered game intelligence
90+
- **Prompt Builders (`builders/`)**: Context and prompt builders for different game phases
91+
- **LLM Schemas (`llm_schemas.py`)**: Pydantic models for structured LLM outputs
8192

82-
**Purpose**: Implements intelligent agent behavior through LLM reasoning.
93+
**Agent Tools (`src/game/agent_tools/`)**:
94+
- **Speech Tools (`speech_tools.py`)**: Structured reasoning for tone, clarity, and tactical focus
95+
- **Vote Tools (`vote_tools.py`)**: Evidence-based voting decisions with structured reasoning
8396

8497
**Core Intelligence Systems**:
8598
- **Dynamic Identity Inference**: Real-time role analysis through conversation patterns
@@ -191,4 +204,21 @@ Next Round or Game End
191204
### Reliability
192205
- **Immutable State**: Append-only records for critical game actions
193206
- **Error Recovery**: Checkpoint-based state recovery
194-
- **Validation**: Configuration and state validation at runtime
207+
- **Validation**: Configuration and state validation at runtime
208+
209+
## Recent Architectural Improvements
210+
211+
### Enhanced Strategy System
212+
- **Modular Strategy Coordination**: Separated core coordination from prompt builders and LLM schemas
213+
- **Structured Agent Tools**: Dedicated tools for speech planning and voting decisions with structured reasoning
214+
- **Improved Serialization**: Enhanced serialization support across strategy modules
215+
216+
### Metrics and Analysis
217+
- **Historical Aggregation**: CLI tools for aggregating and analyzing game metrics summaries
218+
- **Quality Scoring**: Deterministic and LLM-based quality evaluation methods
219+
- **Comprehensive Tracking**: Enhanced metrics collection with detailed game progression analysis
220+
221+
### Development Experience
222+
- **Test Coverage**: Comprehensive test suite covering game rules, state management, nodes, and agent tools
223+
- **Code Organization**: Better separation between workflow orchestration and AI intelligence
224+
- **Error Handling**: Enhanced fallback mechanisms and error recovery strategies

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ LieGraph is a multi-agent implementation of the popular social deduction game "W
1414
- **Natural Language Interaction:** Agents communicate and reason in natural language throughout the game
1515
- **Probabilistic Belief System:** Sophisticated belief tracking with self-belief confidence and suspicions matrix
1616
- **Strategic Reasoning:** Advanced bluff detection, alliance formation, and long-term planning
17+
- **LLM-driven Strategy:** Structured tools for speech planning and voting decisions
1718
- **Built-in Metrics:** Automatic quality tracking for win balance, identification accuracy, and speech diversity with JSON reports for prompt evaluation workflows
19+
- **Historical Analysis:** CLI tools for aggregating and analyzing game metrics summaries
1820

1921
## 🚀 Quick Start
2022

@@ -200,7 +202,9 @@ LieGraph/
200202
│ │ ├── state.py # Game state definitions
201203
│ │ ├── nodes/ # Graph node implementations
202204
│ │ ├── rules.py # Game logic and win conditions
203-
│ │ └── llm_strategy.py # AI reasoning and speech generation
205+
│ │ ├── strategy/ # AI strategy coordination and builders
206+
│ │ ├── agent_tools/ # Structured tools for speech and voting
207+
│ │ └── metrics.py # Game metrics and quality scoring
204208
├── tests/ # Pytest test suite
205209
├── ui-web/frontend/ # React web interface
206210
└── config.yaml # Game configuration

README_zh.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ LieGraph 是基于 LangGraph 构建的流行社交推理游戏 "谁是卧底"
1515
- **自然语言交互:** 智能体在整个游戏中以自然语言进行交流和推理
1616
- **概率信念系统:** 具有自我信念置信度和怀疑矩阵的复杂信念追踪系统
1717
- **战略推理:** 高级的虚张声势检测、联盟形成和长期规划
18+
- **LLM 驱动策略:** 用于发言规划和投票决策的结构化工具
1819
- **内建指标:** 自动追踪胜率平衡、身份识别准确率与发言多样性,并生成 JSON 报告以供后续提示词评估使用
20+
- **历史分析:** 用于聚合和分析游戏指标摘要的 CLI 工具
1921

2022
## 🚀 快速开始
2123

@@ -201,7 +203,9 @@ LieGraph/
201203
│ │ ├── state.py # 游戏状态定义
202204
│ │ ├── nodes/ # 图节点实现
203205
│ │ ├── rules.py # 游戏逻辑和胜利条件
204-
│ │ └── llm_strategy.py # AI 推理和发言生成
206+
│ │ ├── strategy/ # AI 策略协调和构建器
207+
│ │ ├── agent_tools/ # 用于发言和投票的结构化工具
208+
│ │ └── metrics.py # 游戏指标和质量评分
205209
├── tests/ # Pytest 测试套件
206210
├── ui-web/frontend/ # React 网页界面
207211
└── config.yaml # 游戏配置

0 commit comments

Comments
 (0)