Skip to main content
GET /v1/agents/runtime/{runtime_id}/files/watch Streams filesystem change notifications as Server-Sent Events. The watch is backed by the guest kernel’s inotify interface, so events are delivered as the kernel observes them rather than by polling: there is no scan interval and no CPU cost while the tree is idle. Use this to react to a build writing artefacts, an agent editing source files, or a long running job dropping results into a directory.

Parameters

Events

Each SSE frame carries one JSON object. The first event is always start. It confirms the watch is armed; only changes that occur after start are guaranteed to be observed. Arm the watch before triggering the work you want to observe.

Behaviour notes

  • Writes are coalesced. A burst of writes to the same file within a short window is reported as a single write, so a large file copy does not produce thousands of events.
  • Renames are paired. A move within the watched tree is reported once as rename with both path and new_path, not as a separate remove and create.
  • The stream is open ended. Iterate for as long as you want notifications and break out to stop watching; the underlying HTTP response and the guest watcher are released when you do.
  • Recursive watches cover new subdirectories. Directories created after the watch is armed are picked up automatically.