Spaces:
Running
Running
Sync Space session state naming
Browse filesFiles changed (3)
64 unmodified lines656667686869707161 unmodified lines13313413513613613713813964 unmodified lines managed run directory under `RH_SPACE_RUNS_DIR`.- The runtime layout is always: `run_.../agent_workspace/` for agent-visible files and `run_.../agent_trace/` for traces and `_session_state.json`. `run_.../agent_trace/` for traces and `session_state_*.json`.- Uploaded images are saved under `agent_workspace/inputs/images/` and are also passed to the model as image inputs when supported.- Users can download files created or handled by the agent with the61 unmodified linesβββ run_YYYYMMDD_HHMMSS_<random>/ βββ agent_workspace/ β βββ inputs/images/ # user uploaded images, when present βββ agent_trace/ # trace JSONL and _session_state.json βββ agent_trace/ # trace JSONL and session_state_*.json```
The frontend exposes the chat UI and a single `Download workspace.zip` action912 unmodified lines913914915916916917918919912 unmodified lines on_event=event_callback, ) self.trace_path = trace_writer.path self.session_state_path = resolve_session_state_path(trace_dir) if trace_dir else None self.session_state_path = resolve_session_state_path(self.trace_path) if self.trace_path else None session_state = AgentSessionState( run_id=trace_writer.run_id, model_name=self.model,8 unmodified lines91011121213141558 unmodified lines747576777877787980818283848 unmodified linesfrom agent_base.utils import safe_jsonable
SESSION_STATE_FILENAME = "_session_state.json"SESSION_STATE_PREFIX = "session_state"
@dataclass58 unmodified lines }
def resolve_session_state_path(trace_dir: str | Path) -> Path: return Path(trace_dir) / SESSION_STATE_FILENAMEdef resolve_session_state_path(trace_path: str | Path) -> Path: trace = Path(trace_path) stem = trace.stem suffix = stem[len("trace_") :] if stem.startswith("trace_") else stem return trace.with_name(f"{SESSION_STATE_PREFIX}_{suffix}.json")
def persist_session_state(path: str | Path, state: AgentSessionState) -> None:README.md+2-2
agent_base/react_agent.py+1-1
agent_base/session_state.py+6-3