Where AI agents debate, so you don't have to.
DuiDa is a multi-role structured debate framework for AI agents. Define fighters with opposing stances, set the rules, and let them argue it out — producing structured decisions along the way.
CrewAI lets agents do things. DuiDa lets agents think things.
Most multi-agent frameworks focus on task execution. DuiDa focuses on adversarial discussion → structured decision-making. Think of it as a debate arena where AI roles with different perspectives clash, and a recorder extracts the consensus into structured output.
npm install duida
# Or run directly
npx duida fight --arena templates/screenwriting/short-drama.yaml --input novel.txtWho fights, what rules. Defined in YAML:
id: short-drama
name: 不挑活儿编剧室
referee: producer-li
recorder: writer-zhang
fighters:
- id: producer-li
name: 李制片
role: referee
stance: |
你是编剧室的项目经理和总导演...
- id: writer-wang
name: 王编剧 (远见家)
role: fighter
stance: |
你是一个充满理想主义的编剧...
rounds:
- id: synopsis
name: 总纲撰写
objective: 完成所有分集梗概
next: detailedCurrent score and match history. Updated after each bout.
One LLM call = one round of debate. The core loop:
import { run, loadArena, GeminiAdapter } from 'duida';
const arena = loadArena('./my-arena.yaml');
const adapter = new GeminiAdapter({ apiKey: process.env.GEMINI_API_KEY });
const board = await run(arena, { adapter }, {
topic: '改编这部小说为80集短剧',
sourceText: novelText,
});
console.log(board.score); // Structured output (e.g. StoryBible)The referee controls the loop via signals:
CONTINUE— keep debatingNEXT_ROUND— move to next stagePAUSE— wait for user inputSTOP— all done
| Template | Description |
|---|---|
screenwriting/short-drama |
不挑活儿编剧室 — 短剧/电影/动漫通用 |
screenwriting/children-content |
少儿内容编剧室 — 4-12岁儿童 |
screenwriting/romance-drama |
花千树编剧室 — 高概念爱情 |
screenwriting/sci-fi |
深空编剧室 — 硬科幻 |
screenwriting/chinese-film |
中国电影编剧室 — 原创电影 |
Any scenario where multiple perspectives need to clash:
- Product Review — PM + Engineer + Designer + QA
- Investment Decision — Analyst + Risk + Fund Manager
- Academic Review — 3 Reviewers + Editor
- Legal Analysis — Prosecution + Defense + Judge
Just write a YAML file. No code needed.
import { GeminiAdapter, OpenAIAdapter, ClaudeAdapter } from 'duida';
// Pick your LLM
const adapter = new GeminiAdapter({ apiKey: '...' });
const adapter = new OpenAIAdapter({ apiKey: '...' });
const adapter = new ClaudeAdapter({ apiKey: '...' });DuiDa is abstracted from AIKuaiDa (AI快打编剧室), a screenwriting tool that uses multi-role AI discussion to produce structured screenplays.
The name DuiDa (对打) means "strike against" in Chinese — one word, three meanings:
- 对打 (duì dǎ) — clash, strike against
- 对话 (duì huà) — dialogue, discussion
- 对决 (duì jué) — showdown, duel
Apache-2.0