feat(core/agent): 添加 Step 和 LoopResult 数据类
保真 TRM4 算法 #11,Step 新增 call_id 字段。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""AgentLoop 数据类型。"""
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
|
||||
@dataclass
|
||||
class Step:
|
||||
"""Agent 单步决策记录。"""
|
||||
|
||||
thought: str
|
||||
reflect: dict[str, Any]
|
||||
plan: dict[str, Any]
|
||||
tool_call: dict[str, Any]
|
||||
tool_output: str
|
||||
raw_content: str
|
||||
call_id: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class LoopResult:
|
||||
"""AgentLoop 完整运行结果。"""
|
||||
|
||||
result: dict[str, Any] | None = None
|
||||
steps: list[Step] = field(default_factory=list)
|
||||
steps_used: int = 0
|
||||
token_usage: dict[str, int] = field(
|
||||
default_factory=lambda: {"prompt_tokens": 0, "completion_tokens": 0}
|
||||
)
|
||||
stop_reason: str = "finished"
|
||||
Reference in New Issue
Block a user