ExecutionAgent¶
Runs test scripts in MOCK / LOCAL / GRID mode and manages the Human-in-the-Loop approval gate.
Responsibility¶
The only agent that actually executes code. Manages the execution environment, HITL gate, trust domains, and collects raw results.
Input¶
class ExecutionInput(BaseModel):
selenium_scripts: list[SeleniumScript]
api_tests: list[APITest]
execution_mode: str # MOCK | LOCAL | GRID
target_url: str
approval_fn: Callable[[], bool] | None
Output¶
class ExecutionResult(BaseModel):
test_case_id: str
status: str # "passed" | "failed" | "skipped" | "error"
duration_ms: int
error_message: str | None
screenshot_path: str | None
locator_used: str | None
healing_triggered: bool
HITL gate¶
Before executing, the agent calls approval_fn() if provided:
# In CLI: approval_fn = None → auto-approve
# In Streamlit: approval_fn = lambda: st.session_state.get("hitl_approved", False)
# In Python API: user-supplied callback
if self.approval_fn is not None:
approved = self.approval_fn({"test_cases": test_cases, "mode": mode})
if not approved:
return ExecutionResult(status="skipped", reason="HITL rejected")
Execution modes¶
The AI simulates test execution and generates realistic results based on the test steps. No real browser or HTTP calls. Used in CI/cloud environments.
Launches a real Chrome browser via webdriver-manager. Requires Chrome installed locally.
Trust domains¶
The agent maintains a trust_domains table. URLs added to trusted domains bypass certain safety checks. Useful for staging environments.