Role-playing (RP) agents rely on behavioral profiles to act consistently across diverse narrative contexts, yet existing profiles are largely unstructured, non-executable, and weakly validated, leading to brittle agent behavior. We propose Codified Decision Trees (CDT), a data-driven framework that induces an executable and interpretable decision structure from large-scale narrative data. CDT represents behavioral profiles as a tree of conditional rules, where internal nodes correspond to validated scene conditions and leaves encode grounded behavioral statements, enabling deterministic retrieval of context-appropriate rules at execution time. The tree is learned by iteratively inducing candidate scene-action rules, validating them against data, and refining them through hierarchical specialization, yielding profiles that support transparent inspection and principled updates. Across multiple benchmarks, CDT substantially outperforms human-written profiles and prior profile induction methods on $85$ characters across $16$ artifacts, indicating that codified and validated behavioral representations lead to more reliable agent grounding.
翻译:角色扮演(RP)智能体依赖行为配置文件在不同叙事情境中保持行为一致性,然而现有配置文件大多为非结构化、不可执行且验证薄弱,导致智能体行为脆弱。本文提出编码决策树(CDT),一种从大规模叙事数据中推导可执行、可解释决策结构的数据驱动框架。CDT将行为配置文件表示为条件规则树,其中内部节点对应已验证的场景条件,叶节点编码具体行为陈述,从而在执行时能够确定性检索符合情境的规则。该树通过迭代推导候选场景-动作规则、基于数据进行验证,并通过层次化特化进行优化而习得,最终生成的配置文件支持透明检视与原则性更新。在多个基准测试中,CDT在涵盖$16$个作品的$85$个角色上显著优于人工编写的配置文件及先前的配置文件推导方法,表明经过编码与验证的行为表征能够实现更可靠的智能体基础。