Skip to content

python: CallbackTransport (registry in a page, loop in Python) - #115

Merged
thorwhalen merged 1 commit into
mainfrom
burn/acture-111b
Nov 30, 2026
Merged

thorwhalen merged 1 commit into
mainfrom
burn/acture-111b

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Closes #111 (item 2 of the proposal; the browser side and docs landed in #114).

What

acture.CallbackTransport(send=...): a client transport with no socket of its own, for an agent loop in Python whose registry lives in a browser page. It is an async context manager yielding (read, write) streams, so it plugs into ActureClient.connect(...) exactly like stdio_transport.

  • Every MCP message the client writes goes out through your send callback as a plain JSON-RPC dict (push it down the stream the page opened).
  • Every message the page posts back goes in through await transport.feed(message).
  • close() ends the read side when the page's stream ends, so pending calls fail at once instead of hanging. A request timeout on the MCP session covers a page that simply goes quiet.

Tests

A real MCP server (standing in for the page) runs behind the two callbacks with a JSON round trip: list, call, and an error result (ActureError with its code) through the transport; the messages that went out are plain JSON-RPC; feed before entering is a clear error. Full Python suite: 25 passed.

README section added. No separate changeset: the Python version follows the core release (lockstep via the release script).

@thorwhalen
thorwhalen merged commit fa21956 into main Nov 30, 2026
2 checks passed
@thorwhalen
thorwhalen deleted the burn/acture-111b branch November 30, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Component: let a page answer MCP tools/list and tools/call for an agent loop that runs elsewhere

1 participant