Implement Apex Agent MVP scaffold
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any
|
||||
|
||||
from core.models import Scene
|
||||
from runtime.context import TaskContext
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PlannedStep:
|
||||
action: str
|
||||
description: str
|
||||
args: dict[str, Any] = field(default_factory=dict)
|
||||
expected_text: str | None = None
|
||||
|
||||
|
||||
class Planner:
|
||||
def plan(
|
||||
self,
|
||||
*,
|
||||
goal: str,
|
||||
scene: Scene,
|
||||
context: TaskContext,
|
||||
) -> list[PlannedStep]:
|
||||
if context.step_results:
|
||||
return []
|
||||
return [
|
||||
PlannedStep(
|
||||
action="describe_screen",
|
||||
description=f"Observe current screen for goal: {goal}",
|
||||
args={},
|
||||
)
|
||||
]
|
||||
|
||||
def goal_reached(self, *, goal: str, scene: Scene, context: TaskContext) -> bool:
|
||||
return bool(context.step_results) and all(
|
||||
result.success for result in context.step_results
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user