History¶
目标¶
明确 QitOS 中消息历史(History)的归属和用法。
归属¶
History 归属于 AgentModule(self.history),未设置时使用 Engine 运行时 history。
契约¶
History 提供:
append(message)retrieve(query, state, observation)summarize(max_items)reset(run_id)
Engine 使用方式¶
默认模型路径(decide -> None)下,Engine 按如下顺序组装消息:
system(可选)- 按
history_policy选择的 history 消息 - 当前
prepare(state)生成的user消息
Engine 会把当前轮 user/assistant 消息写入 history。
典型 history 序列:
systemuserassistantuserassistant- ...
HistoryPolicy¶
通过 Engine 配置:
rolesmax_messagesstep_window