blockether.vis.engine
Synchronous agent, session, execution-layer and Council APIs.
For installation, workflows and lifecycle choices, use the Python SDK guide.
Run one conversation, with optional application-owned tools.
Choose this entry point for sequential requests that should share history.
Use send to get a blockether.vis.engine.Turn immediately, or run to wait
for its result. Access session for transcripts, attachments and progress.
Arguments:
- project: Project directory. Local execution resolves an existing directory immediately; gateway execution requires an absolute path on the gateway.
- execution_layer: A
blockether.vis.engine.LocalEngineorblockether.vis.engine.GatewayClientto borrow. When omitted, the agent creates and owns a local engine. Configure executable, credentials and transport timeouts on an explicit layer. - extensions: Iterable of
blockether.vis.extension.Extensiondeclarations. Their Python callables stay in your application and execute on the calling thread while you read, wait or iterate events.
Construction does not start a process or connect. Session access, context
entry, send or run starts the conversation. Closing the default agent stops
its private process and discards its temporary session database, not file edits.
An explicitly supplied layer is borrowed: you must close it yourself, after
all agents using it have finished. An agent cannot be reused after close.
Raises:
- TypeError: The supplied layer does not implement
blockether.vis.engine.ExecutionLayer, or an extension is unsupported. - ValueError: A project or extension declaration is invalid.
- FileNotFoundError: The local project does not exist.
- NotADirectoryError: The local project is not a directory.
Add an application-owned Extension before this Agent's first request.
Callables keep their Python objects and execute on the SDK calling thread while you read, wait or iterate events. No code or closures are uploaded. Host-only extension fields are refused before connecting.
Submit a request without waiting for the model to finish.
Arguments:
- request: User message or an explicit slash command.
- **options: Forwarded to
blockether.vis.engine.Session.send, includingprovider,model,attachmentsandidempotency_key.
Returns:
A
blockether.vis.engine.Turnbound to this conversation. Call itsread,waitorcancelmethod to track or control this request. Further calls reuse the same conversation and its history.
Submission can make network calls and raise transport or gateway errors. No mutation is automatically retried. If you retry an uncertain submission, reuse an explicit idempotency key rather than accidentally starting it twice.
Submit a request and return its final or suspended turn record.
Arguments:
- request: User message or slash command, as for
send. - timeout: Positive finite wait deadline in seconds; defaults to 300. This is separate from the layer's transport timeout.
- **options: Submission options forwarded to
send.
Returns:
The canonical turn dictionary, not a string. Inspect
status:completed,failed,cancelled,suspendedanderrorall end the wait. Failed model work is returned as a record, not raised as an exception by this method.
Raises:
- blockether.vis.engine.VisTimeout: The wait deadline expired. The turn
was not cancelled; use
sendfollowed byTurn.waitwhen you need to retain a handle for cancellation or a later wait.
Transport and gateway errors also propagate. Closing this agent stops unfinished work only when it owns the default local engine.
Detach callbacks and release only resources owned by this agent.
Repeated calls are safe. The default local engine is stopped and its
temporary session database removed; project file edits remain. A borrowed
execution layer and other agents using it remain open. Requests through
this agent after closing raise blockether.vis.engine.TransportError.
Communicate with other Vis sessions.
Obtain this handle with Session.council, rather than constructing it with
internal binding fields. The handle captures its session's group and current
activation when acquired; it is not a live alias for whichever run is latest.
Use members to discover active peers, publish to send a message and get
to inspect replies. Publication, delivery and a completed answer are separate
states. threads and read return cursor-based pages of conversation history.
Communication requires an available Council group. A disabled or missing
group is reported when a communication operation or group_id needs it.
Publish a message, optionally requesting replies from selected sessions.
Arguments:
- content: Message text. Keep secrets and private data out of messages.
- kind:
coordinationfor work and questions,informationalfor findings, orcomplainfor failures and concrete improvements. Complaints enter the persistent improve register, not an external issue tracker. Include sanitized evidence, expected versus actual behavior, impact and a workaround; distinguish facts from guesses. - thread_id: Existing thread to continue; omit to start a new thread.
- title: Optional readable title for the message.
- ping: Session IDs,
"all"for active peers, or no recipients. Explicit IDs wake only eligible managed teammates, not independent leaders. - idempotency_key: Reuse this key when retrying uncertain IO. The same publication is returned without notifying recipients twice.
- reply_required: Track an answer obligation for each addressed recipient.
- reply_to: Explicit unanswered request to answer. A no-ping thread continuation otherwise answers only the latest addressed entry if it is an unanswered request; it never falls back to older requests.
Returns:
CouncilEntrywith its entry/thread IDs and per-recipientreplies. Pending, delivered and unavailable states are not completed answers. Inspect the entry later withgetto see replies and their states.
Each message owns its kind and host-generated source_ref. That reference
identifies this publication, not a reported incident: include the original
session and turn/iteration/form when reporting one. Failed Python tool
executions already have an autocomplain entry; enrich its thread instead
of duplicating it. Follow-ups and acknowledgements do not grant wake rights.
Typed envelope yielded by Events; payload fields depend on type.
Attributes:
- type: Event name identifying how to interpret the payload.
- session_id: Conversation that emitted the event.
- seq: Sequence number for a journal event, when supplied.
- cursor: Replay position from a subscription control event, when supplied.
- turn_id: Request associated with this event, or
Nonefor session events. - data: Event-specific dictionary; not a final turn result by itself.
- activity: Validated activity projection, when this event carries one.
- view: Validated view event, when this event carries one.
Stream readers validate wire records through from_wire. Use Turn.read or
Turn.wait for a request's canonical result instead of treating each event as
a completed response.
Iterate typed session events, with replay and bounded reconnection.
Obtain a stream from Session.events. It yields Event objects; inspect
type, turn_id and the event-specific data rather than parsing raw SSE.
The stream covers the whole conversation and does not stop when one turn
completes. Use it in a with block or call close when done.
Arguments:
- session: Conversation whose events you want to follow.
- cursor: Nonnegative replay position, normally a saved cursor or the
cursor from
Session.send. Defaults to 0. - **options:
reconnectsbounds retries (default 3);retry_delayis a nonnegative finite delay in seconds (default 0.2).
Duplicate events are suppressed. subscription.ready resets the cursor,
including after a daemon restart, so persist the stream's current cursor
rather than assuming it is always increasing. The idle timeout is the
client's timeout. Closing the stream never cancels a turn. Invalid replay
options raise ValueError; malformed events raise ProtocolError.
Inherited methods and attributes
Shared session API for local processes and explicit gateway connections.
Applications normally choose blockether.vis.engine.LocalEngine or
blockether.vis.engine.GatewayClient, then use create_session to start a
conversation or session to attach to an existing session ID. Agent wraps
this API when you only need one conversation.
The named HTTP methods below expose lower-level engine routes. Their body
and query values use the gateway's canonical wire schema, not arbitrary
Python objects. Prefer Session and Turn methods for ordinary workflows.
Route failures raise GatewayError; IO and malformed replies raise
TransportError or its subclasses. Mutations are not automatically retried.
Arguments:
- timeout: Positive finite transport timeout in seconds; defaults to 30. This is independent of a turn's wait deadline.
Use each layer and its session handles on one calling thread. Context entry
calls connect; context exit calls close. A custom transport implements
connect, close, session_options and _open. The latter returns a
context-managed binary response with status and headers. Path and channel
defaults belong to the layer, not to Agent.
Release this layer's resources without deleting remote sessions.
Validate a project and return its wire-ready session creation options.
Return a lightweight handle for an existing session ID.
This does not fetch or validate the remote session. Use Session.read
to retrieve its state; a missing session is reported by that request.
The handle borrows this layer and does not own its lifetime.
Create a conversation and return a Session handle.
Arguments:
- timeout: Optional timeout in seconds for this creation request.
- **options: Canonical session creation fields. For a project path,
pass
**layer.session_options(project)so local and gateway path rules and channel defaults are applied correctly.
This sends a creation request immediately. Unlike session, it creates
a new record; use the returned handle's id to attach to it later.
PUT /v1/sessions/:sid/client-extensions — bind client-owned declarations.
DELETE /v1/sessions/:sid/client-extensions — detach owned callbacks.
GET /v1/sessions/:sid/client-calls — retrieve pending owned calls.
POST /v1/sessions/:sid/client-calls/:call_id/result — acknowledge one call.
POST /v1/sessions/:sid/client-calls/:call_id/activity — publish presentation.
Return one page including next_cursor; no hidden full-fleet fetch.
GET /v1/capabilities — json response.
GET /v1/devices — json response.
POST /v1/devices — json response.
DELETE /v1/devices/:token — json response.
POST /v1/devices/actions/test — json response.
GET /v1/fs — json response.
POST /v1/fs/actions/mkdir — json response.
GET /v1/improve — json response.
POST /v1/improve — json response.
GET /v1/improve/settings — json response.
PATCH /v1/improve/settings — json response.
POST /v1/improve/review — json response.
GET /v1/improve/:id — json response.
PATCH /v1/improve/:id — json response.
GET /v1/mcp/servers — json response.
POST /v1/mcp/servers — json response.
DELETE /v1/mcp/servers/:name — json response.
PUT /v1/mcp/servers/:name — json response.
POST /v1/mcp/servers/:name/actions/enable — json response.
POST /v1/mcp/servers/:name/actions/kill — json response.
POST /v1/mcp/servers/:name/actions/start — json response.
POST /v1/mcp/servers/:name/auth/cancel — json response.
POST /v1/mcp/servers/:name/auth/complete — json response.
POST /v1/mcp/servers/:name/auth/logout — json response.
POST /v1/mcp/servers/:name/auth/poll — json response.
POST /v1/mcp/servers/:name/auth/start — json response.
POST /v1/mcp/servers/actions/test — json response.
GET /v1/models — json response.
GET /v1/projects — json response.
POST /v1/projects — json response.
DELETE /v1/projects/:pid — empty response.
GET /v1/projects/:pid — json response.
PATCH /v1/projects/:pid — json response.
PATCH /v1/projects/:pid/sessions — json response.
POST /v1/projects/actions/ensure — json response.
GET /v1/projects/overview — json response.
GET /v1/provider-presets — json response.
POST /v1/providers — json response.
DELETE /v1/providers/:provider-id — json response.
POST /v1/providers/:provider-id/auth/cancel — json response.
POST /v1/providers/:provider-id/auth/complete — json response.
POST /v1/providers/:provider-id/auth/poll — json response.
POST /v1/providers/:provider-id/auth/start — json response.
GET /v1/providers/:provider-id/limits — json response.
POST /v1/providers/:provider-id/reset-credits/consume — json response.
POST /v1/providers/:provider-id/logout — json response.
GET /v1/providers/:provider-id/models — json response.
GET /v1/providers/:provider-id/status — json response.
GET /v1/router — json response.
PATCH /v1/router — json response.
GET /v1/sessions — json response.
POST /v1/sessions — json response.
DELETE /v1/sessions/:sid — empty response.
GET /v1/sessions/:sid — json response.
PATCH /v1/sessions/:sid — json response.
GET /v1/sessions/:sid/activity/:aid — a bounded page of complete Activity records.
Query with after, limit and q. Follow history.next_after until null; reject a changed revision when combining pages into one copy.
GET /v1/sessions/:sid/activity/:aid/export — complete unfiltered Activity text.
The gateway streams this response; the returned Response buffers its bytes. Supply revision to reject a changed history before the export starts. Raises ProtocolError if a concurrent change marks the export incomplete.
GET /v1/sessions/:sid/artifacts — json response.
POST /v1/sessions/:sid/attachments — json response.
POST /v1/sessions/:sid/cancel-current — json response.
GET /v1/sessions/:sid/context — json response.
POST /v1/sessions/:sid/drain-queue — json response.
GET /v1/sessions/:sid/events-since — json response.
GET /v1/sessions/:sid/forks — json response.
POST /v1/sessions/:sid/forks — json response.
POST /v1/sessions/:sid/iterations/:iid/attachments — json response.
GET /v1/sessions/:sid/iterations/:iid/attachments/:idx — binary response.
GET /v1/sessions/:sid/model — json response.
PATCH /v1/sessions/:sid/model — json response.
POST /v1/sessions/:sid/release — empty response.
GET /v1/sessions/:sid/resources — json response.
GET /v1/sessions/:sid/resources/logs — json response.
POST /v1/sessions/:sid/resources/stop — json response.
POST /v1/sessions/:sid/resume-queue — json response.
GET /v1/sessions/:sid/seq — json response.
GET /v1/sessions/:sid/slashes — json response.
POST /v1/sessions/:sid/speech — json response.
DELETE /v1/sessions/:sid/speech/jobs/:job-id — json response.
GET /v1/sessions/:sid/speech/jobs/:job-id — json response.
GET /v1/sessions/:sid/speech/jobs/:job-id/audio — binary response.
GET /v1/sessions/:sid/suggest — json response.
GET /v1/sessions/:sid/transcript — json response.
GET /v1/sessions/:sid/transcript.html — html response.
GET /v1/sessions/:sid/transcript.md — markdown response.
GET /v1/sessions/:sid/turns — json response.
POST /v1/sessions/:sid/turns — json response.
DELETE /v1/sessions/:sid/turns/:tid — json response.
GET /v1/sessions/:sid/turns/:tid — json response.
PATCH /v1/sessions/:sid/turns/:tid — json response.
GET /v1/sessions/:sid/turns/:tid/attachments — json response.
POST /v1/sessions/:sid/turns/:tid/cancel — json response.
GET /v1/sessions/:sid/turns/:tid/trace — json response.
GET /v1/sessions/:sid/usage — json response.
POST /v1/sessions/:sid/views/:view-id/actions — json response.
GET /v1/sessions/:sid/views/input — json response.
GET /v1/sessions/:sid/views/live — json response.
GET /v1/sessions/:sid/views/live/:view-id/log/:node-id — json response.
POST /v1/sessions/:sid/voice — json response.
DELETE /v1/sessions/:sid/voice/jobs/:job-id — json response.
GET /v1/sessions/:sid/voice/jobs/:job-id — json response.
GET /v1/sessions/:sid/workspace — json response.
PATCH /v1/sessions/:sid/workspace/root — json response.
GET /v1/sessions/actions/search — json response.
POST /v1/machines/order — register gateway IDs and return their durable order.
GET /v1/settings — json response.
POST /v1/settings — json response.
GET /v1/settings/:id — json response.
POST /v1/speech — json response.
DELETE /v1/speech/jobs/:job-id — json response.
GET /v1/speech/jobs/:job-id — json response.
GET /v1/speech/jobs/:job-id/audio — binary response.
GET /v1/speech/model — json response.
POST /v1/speech/model — json response.
GET /v1/speech/voices — json response.
POST /v1/speech/voices — json response.
DELETE /v1/speech/voices/:voice-id — json response.
GET /v1/speech/voices/:voice-id/sample — binary response.
POST /v1/voice — json response.
DELETE /v1/voice/jobs/:job-id — json response.
GET /v1/voice/jobs/:job-id — json response.
GET /v1/voice/model — json response.
POST /v1/voice/model — json response.
Use an existing Vis gateway through an explicit HTTP(S) origin.
Choose this layer when sessions should outlive your Python process or the engine runs on another machine. It never starts or discovers a gateway and never reads locally saved credentials. Obtain an authorized gateway URL and token separately; keep tokens out of source code and logs.
Arguments:
- url: HTTP(S) origin such as
https://gateway.example.com, without a path, query, fragment or embedded credentials. - token: Optional bearer token supplied by your application.
- timeout: Positive finite transport timeout in seconds; defaults to 30.
Construction makes no network request. Context entry calls connect to
check protocol compatibility and acquire a client lease. Closing releases
this client's lease and streams, not the gateway or its stored sessions.
Reuse the same layer for multiple agents, then close it after those agents.
import os
from blockether.vis.engine import Agent, GatewayClient
with GatewayClient(
"https://gateway.example.com", token=os.environ["VIS_GATEWAY_TOKEN"]
) as layer:
with Agent(project="/workspace/project", execution_layer=layer) as agent:
result = agent.run("Summarize this project without changing files.")
print(result["status"])
The project path is absolute and belongs to the gateway machine, not this
Python process. TLS certificate verification is enabled; redirects are
refused so credentials cannot follow them to another origin. Each instance
and its session handles use one calling thread. HTTP failures raise
GatewayError; connection, deadline and protocol failures use the
TransportError exception family.
Check protocol compatibility and acquire this client's lease once.
Return this client. Repeated calls reuse its lease. An incompatible
gateway raises ProtocolError; authentication and other HTTP failures
raise GatewayError. A failed keepalive requires a new client rather
than silently resuming work under a different lease.
Close streams and release this client's lease without stopping the gateway.
Stored remote sessions are not deleted. Repeated calls are safe, but
this closed client cannot be reused. Use Turn.cancel when you need
explicit cancellation rather than merely detaching a client.
Prepare an app-channel session using a path on the gateway machine.
Inherited methods and attributes
Inherited from ExecutionLayer.timeout.
Inherited from ExecutionLayer.session.
Inherited from ExecutionLayer.create_session.
Inherited from ExecutionLayer.put_session_client_extensions.
Inherited from ExecutionLayer.delete_session_client_extensions.
Inherited from ExecutionLayer.get_session_client_calls.
Inherited from ExecutionLayer.post_session_client_call_result.
Inherited from ExecutionLayer.post_session_client_call_activity.
Inherited from ExecutionLayer.list_sessions.
Inherited from ExecutionLayer.get_capabilities.
Inherited from ExecutionLayer.get_devices.
Inherited from ExecutionLayer.post_devices.
Inherited from ExecutionLayer.delete_device.
Inherited from ExecutionLayer.post_devices_test.
Inherited from ExecutionLayer.get_fs.
Inherited from ExecutionLayer.post_fs_mkdir.
Inherited from ExecutionLayer.get_improve.
Inherited from ExecutionLayer.post_improve.
Inherited from ExecutionLayer.get_improve_settings.
Inherited from ExecutionLayer.patch_improve_settings.
Inherited from ExecutionLayer.post_improve_review.
Inherited from ExecutionLayer.get_improve_entry.
Inherited from ExecutionLayer.patch_improve_entry.
Inherited from ExecutionLayer.get_mcp_servers.
Inherited from ExecutionLayer.post_mcp_servers.
Inherited from ExecutionLayer.delete_mcp_server.
Inherited from ExecutionLayer.put_mcp_server.
Inherited from ExecutionLayer.post_mcp_server_enable.
Inherited from ExecutionLayer.post_mcp_server_kill.
Inherited from ExecutionLayer.post_mcp_server_start.
Inherited from ExecutionLayer.post_mcp_server_auth_cancel.
Inherited from ExecutionLayer.post_mcp_server_auth_complete.
Inherited from ExecutionLayer.post_mcp_server_auth_logout.
Inherited from ExecutionLayer.post_mcp_server_auth_poll.
Inherited from ExecutionLayer.post_mcp_server_auth_start.
Inherited from ExecutionLayer.post_mcp_servers_test.
Inherited from ExecutionLayer.get_models.
Inherited from ExecutionLayer.get_projects.
Inherited from ExecutionLayer.post_projects.
Inherited from ExecutionLayer.delete_project.
Inherited from ExecutionLayer.get_project.
Inherited from ExecutionLayer.patch_project.
Inherited from ExecutionLayer.patch_project_sessions.
Inherited from ExecutionLayer.post_projects_ensure.
Inherited from ExecutionLayer.get_projects_overview.
Inherited from ExecutionLayer.get_provider_presets.
Inherited from ExecutionLayer.post_providers.
Inherited from ExecutionLayer.delete_provider.
Inherited from ExecutionLayer.post_provider_auth_cancel.
Inherited from ExecutionLayer.post_provider_auth_complete.
Inherited from ExecutionLayer.post_provider_auth_poll.
Inherited from ExecutionLayer.post_provider_auth_start.
Inherited from ExecutionLayer.get_provider_limits.
Inherited from ExecutionLayer.post_provider_reset_credits_consume.
Inherited from ExecutionLayer.post_provider_logout.
Inherited from ExecutionLayer.get_provider_models.
Inherited from ExecutionLayer.get_provider_status.
Inherited from ExecutionLayer.get_router.
Inherited from ExecutionLayer.patch_router.
Inherited from ExecutionLayer.get_sessions.
Inherited from ExecutionLayer.post_sessions.
Inherited from ExecutionLayer.delete_session.
Inherited from ExecutionLayer.get_session.
Inherited from ExecutionLayer.patch_session.
Inherited from ExecutionLayer.get_session_activity.
Inherited from ExecutionLayer.get_session_activity_export.
Inherited from ExecutionLayer.get_session_artifacts.
Inherited from ExecutionLayer.post_session_attachments.
Inherited from ExecutionLayer.post_session_cancel_current.
Inherited from ExecutionLayer.get_session_context.
Inherited from ExecutionLayer.post_session_drain_queue.
Inherited from ExecutionLayer.get_session_events_since.
Inherited from ExecutionLayer.get_session_forks.
Inherited from ExecutionLayer.post_session_forks.
Inherited from ExecutionLayer.post_session_iteration_attachments.
Inherited from ExecutionLayer.get_session_iteration_attachments.
Inherited from ExecutionLayer.get_session_model.
Inherited from ExecutionLayer.patch_session_model.
Inherited from ExecutionLayer.post_session_release.
Inherited from ExecutionLayer.get_session_resources.
Inherited from ExecutionLayer.get_session_resources_logs.
Inherited from ExecutionLayer.post_session_resources_stop.
Inherited from ExecutionLayer.post_session_resume_queue.
Inherited from ExecutionLayer.get_session_seq.
Inherited from ExecutionLayer.get_session_slashes.
Inherited from ExecutionLayer.post_session_speech.
Inherited from ExecutionLayer.delete_session_speech_job.
Inherited from ExecutionLayer.get_session_speech_job.
Inherited from ExecutionLayer.get_session_speech_job_audio.
Inherited from ExecutionLayer.get_session_suggest.
Inherited from ExecutionLayer.get_session_transcript.
Inherited from ExecutionLayer.get_session_transcript_html.
Inherited from ExecutionLayer.get_session_transcript_md.
Inherited from ExecutionLayer.get_session_turns.
Inherited from ExecutionLayer.post_session_turns.
Inherited from ExecutionLayer.delete_session_turn.
Inherited from ExecutionLayer.get_session_turn.
Inherited from ExecutionLayer.patch_session_turn.
Inherited from ExecutionLayer.get_session_turn_attachments.
Inherited from ExecutionLayer.post_session_turn_cancel.
Inherited from ExecutionLayer.get_session_turn_trace.
Inherited from ExecutionLayer.get_session_usage.
Inherited from ExecutionLayer.post_session_view.
Inherited from ExecutionLayer.get_session_views_input.
Inherited from ExecutionLayer.get_session_views_live.
Inherited from ExecutionLayer.get_session_views_live_log.
Inherited from ExecutionLayer.post_session_voice.
Inherited from ExecutionLayer.delete_session_voice_job.
Inherited from ExecutionLayer.get_session_voice_job.
Inherited from ExecutionLayer.get_session_workspace.
Inherited from ExecutionLayer.patch_session_workspace_root.
Inherited from ExecutionLayer.get_sessions_search.
Inherited from ExecutionLayer.post_machines_order.
Inherited from ExecutionLayer.get_settings.
Inherited from ExecutionLayer.post_settings.
Inherited from ExecutionLayer.get_setting.
Inherited from ExecutionLayer.post_speech.
Inherited from ExecutionLayer.delete_speech_job.
Inherited from ExecutionLayer.get_speech_job.
Inherited from ExecutionLayer.get_speech_job_audio.
Inherited from ExecutionLayer.get_speech_model.
Inherited from ExecutionLayer.post_speech_model.
Inherited from ExecutionLayer.get_speech_voices.
Inherited from ExecutionLayer.post_speech_voices.
Inherited from ExecutionLayer.delete_speech_voice.
Inherited from ExecutionLayer.get_speech_voice_sample.
Inherited from ExecutionLayer.post_voice.
Inherited from ExecutionLayer.delete_voice_job.
Inherited from ExecutionLayer.get_voice_job.
Inherited from ExecutionLayer.get_voice_model.
Inherited from ExecutionLayer.post_voice_model.
Inherited from ExecutionLayer.speech_events.
Inherited from ExecutionLayer.voice_events.
Inherited from ExecutionLayer.session_speech_events.
Inherited from ExecutionLayer.session_voice_events.
HTTP failure; status and code are safe to inspect without logging bodies.
Current speech job snapshot, not a session event or a replay cursor.
Snapshot-first job SSE; reconnect rereads state, terminal is_done ends it.
Job streams have no cursor and make no exactly-once claim. Identical snapshots are suppressed within this iterator. Remaining fields retain the canonical JSON.
Inherited methods and attributes
Own a private Vis process without starting an HTTP server.
Use this layer when you need to choose an executable, share one local process between agents, or call the session API directly. The Vis executable must be installed separately; this class never downloads it or discovers a gateway. Supported platforms are Linux and macOS.
Arguments:
- executable: Executable path/name or nonempty argument sequence. The SDK
appends
sdk-stdio; no shell command parsing is performed. - root: Existing local working directory, resolved at construction.
- timeout: Positive finite timeout in seconds for each transport operation.
- startup_timeout: Positive finite deadline in seconds for initial boot.
Construction is lazy. connect or context entry starts the subprocess;
repeated connection calls reuse it. close stops only this owned process and
discards its temporary session database. It does not revert project edits or
stop any separately running Vis server. Explicitly injected agents borrow this
layer, so close those agents before leaving the layer's context.
from blockether.vis.engine import Agent, LocalEngine
with LocalEngine(executable="vis-agent", root=".") as layer:
with Agent(project=".", execution_layer=layer) as agent:
result = agent.run("Summarize this project without changing files.")
print(result["status"])
A pipe timeout stops the process: a late reply must never be mistaken for the
next request's answer. This differs from a blockether.vis.engine.Turn.wait
deadline, which does not itself request cancellation. Startup, protocol and
transport failures propagate as the corresponding engine exception.
Resolve an existing local directory before the caller changes directory.
Start the owned process once and validate its protocol handshake.
Return this layer for chaining. A closed layer cannot be restarted; create a new one after failure or closure. Startup failure cleans up the process and temporary database before propagating the error.
Return a lightweight handle for an existing session ID.
This does not fetch or validate the remote session. Use Session.read
to retrieve its state; a missing session is reported by that request.
The handle borrows this layer and does not own its lifetime.
Stop this process, close its streams and remove its temporary database.
Repeated calls are safe, including retrying cleanup after a signal fails. A failed close still prevents new requests. Unfinished local work cannot continue after the process stops. File edits and separately running gateways are untouched.
Inherited methods and attributes
Inherited from ExecutionLayer.timeout.
Inherited from ExecutionLayer.create_session.
Inherited from ExecutionLayer.put_session_client_extensions.
Inherited from ExecutionLayer.delete_session_client_extensions.
Inherited from ExecutionLayer.get_session_client_calls.
Inherited from ExecutionLayer.post_session_client_call_result.
Inherited from ExecutionLayer.post_session_client_call_activity.
Inherited from ExecutionLayer.list_sessions.
Inherited from ExecutionLayer.get_capabilities.
Inherited from ExecutionLayer.get_devices.
Inherited from ExecutionLayer.post_devices.
Inherited from ExecutionLayer.delete_device.
Inherited from ExecutionLayer.post_devices_test.
Inherited from ExecutionLayer.get_fs.
Inherited from ExecutionLayer.post_fs_mkdir.
Inherited from ExecutionLayer.get_improve.
Inherited from ExecutionLayer.post_improve.
Inherited from ExecutionLayer.get_improve_settings.
Inherited from ExecutionLayer.patch_improve_settings.
Inherited from ExecutionLayer.post_improve_review.
Inherited from ExecutionLayer.get_improve_entry.
Inherited from ExecutionLayer.patch_improve_entry.
Inherited from ExecutionLayer.get_mcp_servers.
Inherited from ExecutionLayer.post_mcp_servers.
Inherited from ExecutionLayer.delete_mcp_server.
Inherited from ExecutionLayer.put_mcp_server.
Inherited from ExecutionLayer.post_mcp_server_enable.
Inherited from ExecutionLayer.post_mcp_server_kill.
Inherited from ExecutionLayer.post_mcp_server_start.
Inherited from ExecutionLayer.post_mcp_server_auth_cancel.
Inherited from ExecutionLayer.post_mcp_server_auth_complete.
Inherited from ExecutionLayer.post_mcp_server_auth_logout.
Inherited from ExecutionLayer.post_mcp_server_auth_poll.
Inherited from ExecutionLayer.post_mcp_server_auth_start.
Inherited from ExecutionLayer.post_mcp_servers_test.
Inherited from ExecutionLayer.get_models.
Inherited from ExecutionLayer.get_projects.
Inherited from ExecutionLayer.post_projects.
Inherited from ExecutionLayer.delete_project.
Inherited from ExecutionLayer.get_project.
Inherited from ExecutionLayer.patch_project.
Inherited from ExecutionLayer.patch_project_sessions.
Inherited from ExecutionLayer.post_projects_ensure.
Inherited from ExecutionLayer.get_projects_overview.
Inherited from ExecutionLayer.get_provider_presets.
Inherited from ExecutionLayer.post_providers.
Inherited from ExecutionLayer.delete_provider.
Inherited from ExecutionLayer.post_provider_auth_cancel.
Inherited from ExecutionLayer.post_provider_auth_complete.
Inherited from ExecutionLayer.post_provider_auth_poll.
Inherited from ExecutionLayer.post_provider_auth_start.
Inherited from ExecutionLayer.get_provider_limits.
Inherited from ExecutionLayer.post_provider_reset_credits_consume.
Inherited from ExecutionLayer.post_provider_logout.
Inherited from ExecutionLayer.get_provider_models.
Inherited from ExecutionLayer.get_provider_status.
Inherited from ExecutionLayer.get_router.
Inherited from ExecutionLayer.patch_router.
Inherited from ExecutionLayer.get_sessions.
Inherited from ExecutionLayer.post_sessions.
Inherited from ExecutionLayer.delete_session.
Inherited from ExecutionLayer.get_session.
Inherited from ExecutionLayer.patch_session.
Inherited from ExecutionLayer.get_session_activity.
Inherited from ExecutionLayer.get_session_activity_export.
Inherited from ExecutionLayer.get_session_artifacts.
Inherited from ExecutionLayer.post_session_attachments.
Inherited from ExecutionLayer.post_session_cancel_current.
Inherited from ExecutionLayer.get_session_context.
Inherited from ExecutionLayer.post_session_drain_queue.
Inherited from ExecutionLayer.get_session_events_since.
Inherited from ExecutionLayer.get_session_forks.
Inherited from ExecutionLayer.post_session_forks.
Inherited from ExecutionLayer.post_session_iteration_attachments.
Inherited from ExecutionLayer.get_session_iteration_attachments.
Inherited from ExecutionLayer.get_session_model.
Inherited from ExecutionLayer.patch_session_model.
Inherited from ExecutionLayer.post_session_release.
Inherited from ExecutionLayer.get_session_resources.
Inherited from ExecutionLayer.get_session_resources_logs.
Inherited from ExecutionLayer.post_session_resources_stop.
Inherited from ExecutionLayer.post_session_resume_queue.
Inherited from ExecutionLayer.get_session_seq.
Inherited from ExecutionLayer.get_session_slashes.
Inherited from ExecutionLayer.post_session_speech.
Inherited from ExecutionLayer.delete_session_speech_job.
Inherited from ExecutionLayer.get_session_speech_job.
Inherited from ExecutionLayer.get_session_speech_job_audio.
Inherited from ExecutionLayer.get_session_suggest.
Inherited from ExecutionLayer.get_session_transcript.
Inherited from ExecutionLayer.get_session_transcript_html.
Inherited from ExecutionLayer.get_session_transcript_md.
Inherited from ExecutionLayer.get_session_turns.
Inherited from ExecutionLayer.post_session_turns.
Inherited from ExecutionLayer.delete_session_turn.
Inherited from ExecutionLayer.get_session_turn.
Inherited from ExecutionLayer.patch_session_turn.
Inherited from ExecutionLayer.get_session_turn_attachments.
Inherited from ExecutionLayer.post_session_turn_cancel.
Inherited from ExecutionLayer.get_session_turn_trace.
Inherited from ExecutionLayer.get_session_usage.
Inherited from ExecutionLayer.post_session_view.
Inherited from ExecutionLayer.get_session_views_input.
Inherited from ExecutionLayer.get_session_views_live.
Inherited from ExecutionLayer.get_session_views_live_log.
Inherited from ExecutionLayer.post_session_voice.
Inherited from ExecutionLayer.delete_session_voice_job.
Inherited from ExecutionLayer.get_session_voice_job.
Inherited from ExecutionLayer.get_session_workspace.
Inherited from ExecutionLayer.patch_session_workspace_root.
Inherited from ExecutionLayer.get_sessions_search.
Inherited from ExecutionLayer.post_machines_order.
Inherited from ExecutionLayer.get_settings.
Inherited from ExecutionLayer.post_settings.
Inherited from ExecutionLayer.get_setting.
Inherited from ExecutionLayer.post_speech.
Inherited from ExecutionLayer.delete_speech_job.
Inherited from ExecutionLayer.get_speech_job.
Inherited from ExecutionLayer.get_speech_job_audio.
Inherited from ExecutionLayer.get_speech_model.
Inherited from ExecutionLayer.post_speech_model.
Inherited from ExecutionLayer.get_speech_voices.
Inherited from ExecutionLayer.post_speech_voices.
Inherited from ExecutionLayer.delete_speech_voice.
Inherited from ExecutionLayer.get_speech_voice_sample.
Inherited from ExecutionLayer.post_voice.
Inherited from ExecutionLayer.delete_voice_job.
Inherited from ExecutionLayer.get_voice_job.
Inherited from ExecutionLayer.get_voice_model.
Inherited from ExecutionLayer.post_voice_model.
Inherited from ExecutionLayer.speech_events.
Inherited from ExecutionLayer.voice_events.
Inherited from ExecutionLayer.session_speech_events.
Inherited from ExecutionLayer.session_voice_events.
Peer is incompatible or returned malformed protocol data.
Response bytes with their status and headers, before content decoding.
Returned by binary and transcript APIs. Use content directly for files,
inspect headers for their media type, or call json for JSON transcripts.
json raises ProtocolError for malformed or non-JSON content.
A conversation handle bound to one execution layer and session ID.
Obtain it from Agent.session, ExecutionLayer.create_session or
ExecutionLayer.session. Constructing a handle does not read the session.
It borrows the layer; keep the layer open while using it.
Use send for a new turn and turns for history. read fetches current
session state. events follows progress; input_views and answer let your
application handle pending human input. transcript, artifacts, upload
and download_attachment cover content exchange. council binds messaging
and managed-agent controls to this conversation.
Requests return canonical dictionaries unless a method documents a typed
handle or Response. HTTP errors raise GatewayError, including missing
or inaccessible session IDs; no method automatically retries mutations.
Bind communication to the current run without blocking session-only controls.
Disabled or unavailable Council groups are reported when using communication or group_id. Successful bindings retain their acquisition-time activation.
Fetch the current canonical session record as a dictionary.
Pending application-owned tool calls are serviced on the calling thread before fetching state. This is a fresh read, not a cached snapshot.
Patch canonical session fields and return the engine's JSON response.
Field names and validation follow the gateway session-update contract; unknown or invalid fields are rejected by the engine.
Ask the engine to delete this conversation and return its response.
This is a destructive session operation, not a connection close. It does not undo changes already made to project files. Do not use this handle for further conversation requests after successful deletion.
Return the gateway's artifact inventory without downloading its bytes.
Upload bytes; pass the returned upload_id in send(attachments=[...]).
Submit an explicit goal through /goal and return its execution Turn.
No goal is inferred from ordinary messages. Read its state in read()['goal']. Pause/resume/cancel use send('/goal --pause'), --resume or --cancel. The optional budget counts loop iterations, including prose and empty replies. The last iteration may run its tools; the limit blocks the next model request. Token usage is recorded only as a statistic.
Submit a user message or slash command and return its Turn handle.
Arguments:
- request: Message text sent to this conversation.
- idempotency_key: Stable key for retrying the same submission after uncertain IO. Omission creates a new key for each call.
- **options: Canonical turn submission fields such as
provider,modelandattachments. Upload attachment bytes first withuploadand pass the returned upload IDs inattachments.
Return does not mean the model has finished: use Turn.wait or
Turn.read. The returned cursor marks the event position before this
submission; pass it to events to follow subsequent progress.
Model requests may incur costs and change project files. Submission
failures propagate; the SDK never automatically retries this mutation.
Read pending input requests as typed blockether.vis.views.InputView records.
Use their view IDs with answer to submit values. An empty list means no
input requests were returned in this snapshot.
Read current live views as typed blockether.vis.views.LiveView records.
This fetches a snapshot rather than subscribing to future updates; use
events to follow view events. Malformed view data raises ProtocolError.
Send an operator action to a view and return the engine's JSON response.
values supplies the action-specific fields of the canonical operator
action schema. The request is validated before submission. Use answer
for the common case of submitting input values.
Submit input values to a view, returning the engine's response.
Pass a view ID from input_views and values matching that input request.
This is shorthand for view_action(view_id, "submit", values=values).
Follow this conversation's progress as an iterable of Event records.
Options are cursor (nonnegative replay position, default 0),
reconnects (default 3) and retry_delay (seconds, default 0.2).
Use a context manager to close the stream when you stop iterating.
The stream spans the conversation, not just one turn; filter turn_id
when tracking a specific request. Closing it does not cancel work.
Gateway sessions normally use SSE. Local execution and application-owned callbacks use finite event-page polling so Python callbacks run on the calling thread. Both expose the same event interface.
Connection failed or the client has been closed.
Handle for one submitted request, independent of other session turns.
Returned by Agent.send or Session.send. id identifies this request;
cursor is the session event position captured before submission. The handle
borrows its session and execution layer. Keep that layer open while calling
read, wait or cancel.
Fetch this turn's current canonical record, including its status.
timeout optionally overrides this request's transport deadline in
seconds. Application-owned callbacks are serviced before reading state.
Poll this turn until it finishes or suspends, returning its record.
Arguments:
- timeout: Positive finite overall wait deadline in seconds.
Returns:
A canonical dictionary whose
statusiscompleted,failed,cancelled,suspendedorerror. A failure status is data, not a raised model-work exception; inspect it before using the result.
Raises:
- VisTimeout: The deadline expired. This method does not request
cancellation; you can wait again or explicitly call
cancel.
Transport and HTTP errors also propagate. For a local engine, a timeout of the underlying pipe operation closes that process to prevent replies getting out of order; this is distinct from merely ending the poll loop.
Deadline expired; the remote operation may still be running.