vibesketch.agent.client

A small client for vibe-sketch’s REST API, on the standard library alone.

The MCP server calls the same API the browser does, so an agent’s edit and a human’s go through one revision counter and show up in each other’s view.

Functions

find_server([host, ports])

The address of a vibe-sketch server running on this machine, or None.

start_server([store, host])

Start a vibe-sketch server in a background thread; returns its address.

Classes

RestClient(base_url, *[, timeout])

JSON calls against one vibe-sketch server.

Exceptions

ServerError(status, detail)

The server answered with an error status; detail is its explanation.

class vibesketch.agent.client.RestClient(base_url, *, timeout=300.0)

Bases: object

JSON calls against one vibe-sketch server.

Parameters:
raw(method, path, body=None)

The response body and its content type; raises ServerError.

Parameters:
Return type:

tuple[bytes, str]

call(method, path, body=None)

The decoded JSON response.

Parameters:
Return type:

Any

exception vibesketch.agent.client.ServerError(status, detail)

Bases: RuntimeError

The server answered with an error status; detail is its explanation.

Parameters:
  • status (int)

  • detail (Any)

Return type:

None

vibesketch.agent.client.find_server(host='127.0.0.1', ports=range(8766, 8776))

The address of a vibe-sketch server running on this machine, or None.

serve takes the first free port from 8766, so the search walks the same range and recognises vibe-sketch by its session route.

Parameters:
Return type:

str | None

vibesketch.agent.client.start_server(store=None, host='127.0.0.1')

Start a vibe-sketch server in a background thread; returns its address.

The port is chosen by the operating system and the socket is handed to uvicorn already bound, so no other process can take it in between.

Parameters:
Return type:

str