Datasets:

Tasks:
Other
ArXiv:
File size: 1,886 Bytes
c72a741
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""AgentRunner interface and the Trace/SessionPlan data model.

A SessionPlan is an ordered list of steps the agent performs in ONE browser session
(shared context). Pre-visit steps plant ground-truth prior-origin state; the final
step routes the agent to the attacker probe. A Trace is the ground-truth record of
what the agent did internally (for analysis); the actual side-channel observables
live in the attacker's event log, joined later by session_id.
"""
from __future__ import annotations

from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from typing import Any


@dataclass
class Step:
    """One instruction in a session plan."""
    task: str                      # natural-language task for the agent
    label: str = ""                # e.g. "plant_bank", "visit_probe"
    start_url: str | None = None   # optional URL to open before reasoning


@dataclass
class SessionPlan:
    session_id: str
    condition: str                 # "X" or "not_X"
    steps: list[Step]
    meta: dict[str, Any] = field(default_factory=dict)


@dataclass
class Trace:
    """Ground-truth internal record of a session, serialized to traces/."""
    session_id: str
    agent: str
    llm: str
    condition: str
    urls: list[str] = field(default_factory=list)
    actions: list[Any] = field(default_factory=list)
    thoughts: list[Any] = field(default_factory=list)
    final_result: str | None = None
    errors: list[Any] = field(default_factory=list)
    duration_s: float | None = None
    raw: dict[str, Any] = field(default_factory=dict)
    error: str | None = None       # harness-level failure, if any


class AgentRunner(ABC):
    """Drive an agent through a SessionPlan and return a Trace."""

    name: str = "abstract"

    @abstractmethod
    def run_session(self, plan: SessionPlan, llm_key: str, seed: int | None = None) -> Trace:
        ...