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. Pass response_model to run for a validated Pydantic model.
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. - tools: Optional iterable of Vis extension tool names for the conversation.
Names such as
"py.lint_code"or"py.repl_*"keep only those tools of the extensions they name. Names such as"-py.repl_stop"turn tools off. Do not mix the two forms. The gateway refuses an unknown name.
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, an extension is unsupported, ortoolsis not an iterable of strings. - 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 wait for its result in the same conversation.
Without response_model, return the turn dictionary in contract form. Check its
status. Completed, failed, cancelled, suspended and error all end the wait.
Failed model work is returned as a record, not raised.
With a Pydantic BaseModel subclass, the request includes its validation JSON
Schema. The answer is validated against that schema, then by Pydantic with your
Python validators. The call returns the validated instance.
This is a prompt, not provider-enforced JSON mode. The final prose block must be one complete JSON value, without fences or commentary. Other content block types are ignored. Duplicate object members and non-finite numbers are invalid.
An invalid answer starts a correction turn in the same conversation. The
correction lists each problem and repeats the schema. This repeats up to
max_corrections times, and 0 disables corrections. Each correction is another
model call. The agent is asked to keep completed work, but tool calls and file
edits are never undone.
StructuredOutputError reports an unsuccessful turn, an answer that is still
invalid, or a deadline that left no time for a correction. Its errors and
attempts say what went wrong.
timeout is a positive finite wait deadline in seconds for the answer and any
corrections. It is separate from the layer's transport timeout. Submission
options such as provider, model and attachments are passed unchanged to
send. Corrections reuse them, except attachments and idempotency_key.
VisTimeout does not cancel the turn, and transport errors propagate. Closing
an owned local agent stops unfinished work.
Detach callbacks and release only resources owned by this agent.
Repeated calls are safe. The default local engine stops, and its temporary
session database is removed. Project file edits stay. A borrowed execution layer
and other agents that use it stay open. After closing, requests through this
agent raise blockether.vis.engine.TransportError.
Communicate with other Vis sessions.
Get this handle with Session.council. Do not construct it with internal binding
fields. When acquired, the handle captures its session's group and current
activation. It does not follow 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.
- thread_id: Existing thread to continue. Omit it 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 an idle peer of the group or an eligible managed teammate. - 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. Without it, a no-ping thread continuation answers only the latest addressed entry, and only if that entry is an unanswered request. It never falls back to older requests.
- files: File rules for the follow-up task of the one pinged idle child session. They replace the file grant of that child.
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 host-generated source_ref. That reference identifies
this publication, not a reported incident. When you report an incident,
include the original session and turn/iteration/form. Follow-ups and
acknowledgements do not grant wake rights.
Typed envelope that Events yields. 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. It is 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 the final result of a request. Do not treat each event as a
completed response.
Iterate typed session events, with replay and bounded reconnection.
Get a stream from Session.events. It yields Event objects. Inspect
type, turn_id and the event-specific data instead of 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 you are 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:
reconnectslimits retries (default 3).retry_delayis a nonnegative finite delay in seconds (default 0.2).
The stream replays every stored event after cursor, including the progress
of turns that finished before you subscribed. Duplicate events are
suppressed. subscription.ready resets the cursor, also after a daemon
restart. So save the stream's current cursor, and do not assume that it
always increases.
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 wire schema, not any Python object. For
ordinary workflows, use Session and Turn methods. Route failures raise
GatewayError. IO failures 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, and context exit calls close. A custom transport
implements connect, close, session_options and _open. _open
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 get its state. That request reports a missing session. The handle
borrows this layer and does not own its lifetime.
Create a conversation and return a Session handle.
Arguments:
- provider: Optional provider ID from
models. Give it withmodel. - model: Optional model name. The pair pins the model of the session before its first turn.
- timeout: Optional timeout in seconds for this creation request.
- **options: Session creation fields from the gateway contract. For a
project path, pass
**layer.session_options(project). This applies local and gateway path rules and channel defaults correctly.
This sends a creation request immediately. Unlike session, it creates
a new record. To attach to it later, use the returned handle's id.
Restore a session snapshot as a new session and return its handle.
Arguments:
- data: The bytes that
Session.exportreturned, for example read from a.vissnapfile. - root: Optional folder for the restored sessions. Without it, the gateway
uses the project folder of
group_id, else its own folder. - group_id: Optional session group for the restored session.
- key: Optional restore key. A second restore with the same key returns the session of the first restore and creates nothing.
- timeout: Optional timeout in seconds for this request.
Each restored session and child gets a new ID. Your own permissions apply,
not the permissions in the snapshot. A child that was running fails, so you
can resume it. Read the manifest first with snapshot_info.
Read the manifest of session snapshot data without a gateway request.
The manifest gives format_version, vis_version, created_at,
root_session_id, sessions, counts, sizes and payload_sha256.
Raises ValueError when data is not a Vis session snapshot.
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 with next_cursor. It does not fetch every session.
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/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.
Return the models that the gateway pickers show, in picker order.
Arguments:
- provider: Optional provider ID. Only its models are returned.
- is_available: Optional filter. True keeps models of signed-in providers. False keeps the others.
- timeout: Optional timeout in seconds for this request.
Each Model carries its price, billing, capabilities and the limits
report of its provider. The gateway reads provider limits in parallel
and bounds each read, so a slow provider gives an error report.
Return the current limits report of one provider.
Use it to refresh the Model.limits of that provider's models. The
report follows the provider limits schema. A failed read gives an
error report, not an exception.
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/session-groups — the groups of one project, in the human's order.
POST /v1/session-groups — create one group inside a project.
DELETE /v1/session-groups/:gid — drop a group and say what becomes of it.
PATCH /v1/session-groups/:gid — rename, recolour or reorder a group.
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 it is null. When you combine pages into one copy, reject a changed revision.
GET /v1/sessions/:sid/activity/:aid/export — complete unfiltered Activity text.
The gateway streams this response, and 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/alert — the banner text for the latest turn.
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/fs/actions/open — open one file in the editor.
GET /v1/sessions/:sid/fs/file — preview one workspace file by its kind.
PUT /v1/sessions/:sid/group — file this session under a group.
GET /v1/sessions/:sid/iterations/:iid/attachments/:idx — binary response.
PUT /v1/sessions/:sid/iterations/:iid/attachments/:idx/agent-note — set the note of an HTML page for the model.
GET /v1/sessions/:sid/model — json response.
PATCH /v1/sessions/:sid/model — json response.
POST /v1/sessions/:sid/queue/send-now — json response.
PUT /v1/sessions/:sid/read — how far this reader has read the session.
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.
GET /v1/sessions/:sid/keybindings — json response.
POST /v1/sessions/:sid/keybindings/run — json response.
GET /v1/sessions/:sid/snapshot — binary 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 — json response.
GET /v1/sessions/:sid/views/live/:view-id/log — json response.
The node rides the query string: node ids are free text a surface chose
and may hold /, which a path segment cannot carry.
POST /v1/sessions/:sid/apps — 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.
POST /v1/sessions/actions/archive — archive many sessions; skip working ones.
POST /v1/sessions/actions/import — restore a session snapshot.
GET /v1/sessions/actions/search — json response.
POST /v1/machines/order — register gateway IDs and return their durable order.
GET /v1/automations — json response.
POST /v1/automations — json response.
GET /v1/automations/runs — json response.
GET /v1/automations/runs/:run-id — json response.
GET /v1/automations/:automation-id — json response.
PATCH /v1/automations/:automation-id — json response.
DELETE /v1/automations/:automation-id — json response.
POST /v1/automations/:automation-id/run — json response.
POST /v1/automations/:automation-id/secrets — json response.
POST /v1/evals/agreement — json response.
POST /v1/evals/compare — json response.
POST /v1/evals/diagnose — json response.
POST /v1/evals/labels — json response.
POST /v1/evals/leaderboard — json response.
POST /v1/evals/report — json response.
GET /v1/settings — json response.
POST /v1/settings — json response.
PATCH /v1/settings — json response.
GET /v1/settings/:id — json response.
POST /v1/extensions/reload — 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.
PATCH /v1/speech/voices/:voice-id — json response.
GET /v1/speech/voices/:voice-id/sample — binary response.
GET /v1/decisions/models — installed and resident decision versions.
GET /v1/decisions/models/:model-ref — immutable status after upload.
GET /v1/decisions/aliases/:alias — current ref before a CAS update.
PUT /v1/decisions/aliases/:alias — explicit compare-and-swap update.
POST /v1/decisions/training/jobs — train on approved local data.
GET /v1/decisions/training/jobs/:job-id — durable progress.
DELETE /v1/decisions/training/jobs/:job-id — cancel or discard.
POST /v1/systemone — typed decisions from an explicitly named model.
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 must outlive your Python process, or when the engine runs on another machine. It never starts or discovers a gateway, and it never reads locally saved credentials. Get 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.
POST /v1/decisions/models — stream a verified FP32 bundle once.
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 short outage of the gateway does not end the lease. When the gateway
no longer holds the lease, for example after a restart, the client takes
a new lease. A client with registered application extensions cannot move
them to a new lease. It then raises TransportError for each request:
create a new client. A refused keepalive has the same result.
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.speech.
Inherited from ExecutionLayer.session.
Inherited from ExecutionLayer.create_session.
Inherited from ExecutionLayer.restore_session.
Inherited from ExecutionLayer.snapshot_info.
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_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.models.
Inherited from ExecutionLayer.model_limits.
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_session_groups.
Inherited from ExecutionLayer.post_session_groups.
Inherited from ExecutionLayer.delete_session_group.
Inherited from ExecutionLayer.patch_session_group.
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_alert.
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_fs_actions_open.
Inherited from ExecutionLayer.get_session_fs_file.
Inherited from ExecutionLayer.put_session_group.
Inherited from ExecutionLayer.get_session_iteration_attachments.
Inherited from ExecutionLayer.put_session_iteration_attachment_agent_note.
Inherited from ExecutionLayer.get_session_model.
Inherited from ExecutionLayer.patch_session_model.
Inherited from ExecutionLayer.post_session_queue_send_now.
Inherited from ExecutionLayer.put_session_read.
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.get_session_keybindings.
Inherited from ExecutionLayer.post_session_keybindings_run.
Inherited from ExecutionLayer.get_session_snapshot.
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_view.
Inherited from ExecutionLayer.get_session_views_live_log.
Inherited from ExecutionLayer.post_session_apps.
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.post_sessions_archive.
Inherited from ExecutionLayer.post_sessions_import.
Inherited from ExecutionLayer.get_sessions_search.
Inherited from ExecutionLayer.post_machines_order.
Inherited from ExecutionLayer.get_automations.
Inherited from ExecutionLayer.post_automations.
Inherited from ExecutionLayer.get_automation_runs.
Inherited from ExecutionLayer.get_automation_run.
Inherited from ExecutionLayer.get_automation.
Inherited from ExecutionLayer.patch_automation.
Inherited from ExecutionLayer.delete_automation.
Inherited from ExecutionLayer.post_automation_run.
Inherited from ExecutionLayer.post_automation_secrets.
Inherited from ExecutionLayer.post_evals_agreement.
Inherited from ExecutionLayer.post_evals_compare.
Inherited from ExecutionLayer.post_evals_diagnose.
Inherited from ExecutionLayer.post_evals_labels.
Inherited from ExecutionLayer.post_evals_leaderboard.
Inherited from ExecutionLayer.post_evals_report.
Inherited from ExecutionLayer.get_settings.
Inherited from ExecutionLayer.post_settings.
Inherited from ExecutionLayer.patch_settings.
Inherited from ExecutionLayer.get_setting.
Inherited from ExecutionLayer.post_extensions_reload.
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.patch_speech_voice.
Inherited from ExecutionLayer.get_speech_voice_sample.
Inherited from ExecutionLayer.get_decision_models.
Inherited from ExecutionLayer.get_decision_model.
Inherited from ExecutionLayer.get_decision_alias.
Inherited from ExecutionLayer.put_decision_alias.
Inherited from ExecutionLayer.post_decision_training_job.
Inherited from ExecutionLayer.get_decision_training_job.
Inherited from ExecutionLayer.delete_decision_training_job.
Inherited from ExecutionLayer.post_systemone.
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 with a safe code, never the gateway's free-form message.
Decision input-limit errors also expose input_tokens and max_input_tokens.
These are None when the gateway does not supply valid numeric diagnostics.
A refused view action, such as a press on a disconnected app, has its
reason token as code.
The SDK could not find or download the Vis engine.
Current speech job snapshot, not a session event or a replay cursor.
Snapshot-first job SSE.
A reconnect reads the state again. A terminal is_done ends the stream.
Job streams have no cursor and make no exactly-once claim. Identical snapshots are suppressed within this iterator. Other fields stay as the JSON that the contract defines.
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. With the default vis-agent,
connect uses the installed command when it runs this SDK's release. Otherwise it
downloads that release once into $VIS_HOME/sdk and checks it against the release
checksums.
Set VIS_NO_AUTO_INSTALL=1 to turn off the download. This class never discovers
a gateway. Supported platforms are Linux and macOS.
Arguments:
- executable: Executable path/name or nonempty argument sequence. The SDK
appends
stdio. It does not parse shell commands. - 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, and 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. Close those agents
before you leave 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. When the
engine exited by itself or wrote to stderr, the message ends with that exit
status and the last 4 KiB of its stderr.
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. After a failure or close, create a new one. A startup failure cleans up the process and temporary database before the error propagates.
Return a lightweight handle for an existing session ID.
This does not fetch or validate the remote session. Use Session.read
to get its state. That request reports a missing session. 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.speech.
Inherited from ExecutionLayer.create_session.
Inherited from ExecutionLayer.restore_session.
Inherited from ExecutionLayer.snapshot_info.
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_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.models.
Inherited from ExecutionLayer.model_limits.
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_session_groups.
Inherited from ExecutionLayer.post_session_groups.
Inherited from ExecutionLayer.delete_session_group.
Inherited from ExecutionLayer.patch_session_group.
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_alert.
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_fs_actions_open.
Inherited from ExecutionLayer.get_session_fs_file.
Inherited from ExecutionLayer.put_session_group.
Inherited from ExecutionLayer.get_session_iteration_attachments.
Inherited from ExecutionLayer.put_session_iteration_attachment_agent_note.
Inherited from ExecutionLayer.get_session_model.
Inherited from ExecutionLayer.patch_session_model.
Inherited from ExecutionLayer.post_session_queue_send_now.
Inherited from ExecutionLayer.put_session_read.
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.get_session_keybindings.
Inherited from ExecutionLayer.post_session_keybindings_run.
Inherited from ExecutionLayer.get_session_snapshot.
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_view.
Inherited from ExecutionLayer.get_session_views_live_log.
Inherited from ExecutionLayer.post_session_apps.
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.post_sessions_archive.
Inherited from ExecutionLayer.post_sessions_import.
Inherited from ExecutionLayer.get_sessions_search.
Inherited from ExecutionLayer.post_machines_order.
Inherited from ExecutionLayer.get_automations.
Inherited from ExecutionLayer.post_automations.
Inherited from ExecutionLayer.get_automation_runs.
Inherited from ExecutionLayer.get_automation_run.
Inherited from ExecutionLayer.get_automation.
Inherited from ExecutionLayer.patch_automation.
Inherited from ExecutionLayer.delete_automation.
Inherited from ExecutionLayer.post_automation_run.
Inherited from ExecutionLayer.post_automation_secrets.
Inherited from ExecutionLayer.post_evals_agreement.
Inherited from ExecutionLayer.post_evals_compare.
Inherited from ExecutionLayer.post_evals_diagnose.
Inherited from ExecutionLayer.post_evals_labels.
Inherited from ExecutionLayer.post_evals_leaderboard.
Inherited from ExecutionLayer.post_evals_report.
Inherited from ExecutionLayer.get_settings.
Inherited from ExecutionLayer.post_settings.
Inherited from ExecutionLayer.patch_settings.
Inherited from ExecutionLayer.get_setting.
Inherited from ExecutionLayer.post_extensions_reload.
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.patch_speech_voice.
Inherited from ExecutionLayer.get_speech_voice_sample.
Inherited from ExecutionLayer.get_decision_models.
Inherited from ExecutionLayer.get_decision_model.
Inherited from ExecutionLayer.get_decision_alias.
Inherited from ExecutionLayer.put_decision_alias.
Inherited from ExecutionLayer.post_decision_training_job.
Inherited from ExecutionLayer.get_decision_training_job.
Inherited from ExecutionLayer.delete_decision_training_job.
Inherited from ExecutionLayer.post_systemone.
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.
One model with its price, billing, capabilities and provider limits.
pricing gives USD rates for 1M tokens: input, output and the optional
cache_read and cache_write. Each item in pricing["tiers"] applies when
a request uses more than above_tokens input tokens. Turn costs use the same
rates. pricing is None when no price is known.
billing is metered for an API key, subscription for an account
sign-in and local for a provider without credentials. limits is the
limits report of the provider; all models of one provider share it.
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.
Get it from Agent.session, ExecutionLayer.create_session or
ExecutionLayer.session. Constructing a handle does not read the session.
The handle borrows the layer. Keep the layer open while you use the handle.
Use send for a new turn and turns for history. read fetches the
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 dictionaries in contract form, 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 you use communication or group_id. A successful binding keeps the activation that it had when it was acquired.
Fetch the current 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 session fields and return the engine's JSON response.
Field names and validation follow the gateway session-update contract. The engine rejects unknown or invalid fields.
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']. To pause, resume or cancel it, use
send('/goal --pause'), --resume or --cancel.
The optional budget counts loop iterations, including prose and empty replies. The last iteration can run its tools, and then 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. If you omit it, each call creates a new key.
- **options: Turn submission fields such as
provider,modelandattachments. Upload attachment bytes first withupload, and pass the returned upload IDs inattachments.
A return does not mean that 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 later progress. Model requests
can cost money and change project files. Submission failures propagate,
and the SDK never automatically retries this mutation.
Submit a request and wait for its result, as Agent.run does.
Without response_model, return the turn dictionary in contract form.
With a Pydantic model, validate the final answer and return the instance.
An invalid answer starts up to max_corrections correction turns.
Agent.run describes the answer rules, the errors and the timeout.
Pin the provider and model of the next turns, or clear the pin with None.
Get the names from ExecutionLayer.models. The gateway refuses a provider
that it does not serve. A running or queued turn keeps its model. A model
request can cost money; Model.pricing gives the rates.
Copy this conversation into a new independent session and return it.
The fork holds every turn through through_turn_id, or through the last
turn when you omit it. The source session does not change.
Return a snapshot of this session and its managed children as bytes.
Save the bytes as a .vissnap file, and restore them with
ExecutionLayer.restore_session. The snapshot holds turns, attachments
and the Council entries inside the session tree. It does not hold
provider credentials or workspace files. The session_snapshot_limit
setting limits its size.
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 and does not subscribe to future updates. Use
events to follow view events. A placement (inline, panel or
attachment) keeps only those views. archived=True lists only the
archived apps. Malformed view data raises ProtocolError.
Read one live view or app by id, also a closed or restored app.
This is a snapshot, like live_views. 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 operator action
schema. The request is validated before submission. For the common case
of submitting input values, use answer. A refused action of a closed,
disconnected or changed app raises GatewayError with status 409 and the
refusal reason as code, for example disconnected.
Open or adopt an app in this session as owner program owner.
app is a vis.ui.app(...) declaration or an app attachment row. The
engine records the owner as sdk/<owner>; owner uses 1 to 64 characters
of a-z, 0-9, ., _ and -. A declaration with a key adopts the
open app of the same owner and key, so a restarted program gets its app
back. Answers the same LiveAttachment handle that extensions use.
on_event(event) runs on a daemon thread that long-polls the app events,
until the app closes. A callback error is logged and polling goes on. To
serve events on the calling thread, use LiveAttachment.run instead.
Read the TUI key bindings that the extensions of this session declare.
Each binding has key, extension and command with label and
group, run with label and group, or action. The list is in
extension order, then declaration order.
Run the function of one run binding, as if the person pressed its key.
Give the extension, key and group that keybindings() lists. The
run adds no turn. The answer is {"status": "ok" | "error", "title",
"body"}; a function that fails answers status error.
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. To track a specific request,
filter on turn_id. Closing the stream 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.
The model of the next turn of a session.
provider and model are the pin when is_pinned is true, else the
default pair. default_provider and default_model are the pair that the
turns use without a pin; a project configuration can change it.
Manage voices, speak text and transcribe audio with the gateway engines.
Without engine, a call uses the engine that the gateway selected. Voice changes
use the cloning engine pocket-tts-local by default. Long work runs as a gateway
job; these methods wait for it and return the result.
Import a recording of one speaker as a voice and return it.
Use 3 to 30 seconds of clean speech. WAV works everywhere; the gateway converts
other containers when it can. transcript is what the clip says and improves
the clone. A voice with the same id is replaced, so this also replaces the audio
of an existing voice. Raises GatewayError 400 for an unusable recording and
409 for an engine that cannot learn voices.
Change the label, language or clip transcript of an imported voice.
An omitted argument keeps its value; None or "" removes it. The id stays the
same. Raises GatewayError 404 when the engine has no such imported voice.
Delete an imported voice. Return False when the engine has no such voice.
Return a short audio sample of a voice. Raises GatewayError 404 without one.
Return the readiness of a speaking engine; prepare=True starts its download.
Speak text and return the audio, usually 24 kHz mono WAV.
seed selects another take of the same text on engines that sample noise,
such as vibevoice-local and qwen3-tts-local. The gateway speaks at most
20000 characters at once. Raises GatewayError 425 while the engine model is
not ready and VisTimeout when the job takes longer than timeout seconds.
Transcribe a 16-bit PCM WAV recording and return its text.
Engines include parakeet-local and vibevoice-asr-local. Raises GatewayError
400 for audio that is not WAV and VisTimeout after timeout seconds.
Audio that an engine spoke, as the bytes of one file.
No valid structured result: a turn did not complete or answers stayed invalid.
errors lists the problems in the last turn as dictionaries. Each has a
JSONPath-like path ($ is the whole value), a message and a source. The
source is turn, answer, json, schema or pydantic. attempts has one
dictionary per turn. It holds the turn record, the final prose answer (None when
absent) and errors. turn is the last record.
The message lists the first problems. Messages include short scalar values from the
answer, but never whole objects or arrays. If the response model sets Pydantic's
hide_input_in_errors, messages include no answer values.
The text that a transcription engine heard in a recording.
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
you call read, wait or cancel.
Fetch this turn's current 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 dictionary in contract form. Its
statusiscompleted,failed,cancelled,suspendedorerror. A failure status is data, not a raised model-work exception. Inspect it before you use 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. This keeps replies in order. It is different from only ending the poll loop.
Deadline expired. The remote operation can still be running.
One voice that a speaking engine can use.
Return the vis-agent command that matches this SDK, and download it when missing.
An installed vis-agent is used only when it runs the same release as the SDK.
Otherwise the SDK uses, or downloads, its own copy in $VIS_HOME/sdk/<tag>. A
development build of the SDK uses any installed command, or the latest stable
release.
Raises:
- InstallError: The download is turned off with
VIS_NO_AUTO_INSTALL, orinstall()fails.
Return the final answer text of the turn record turn, or None.
A turn record has no answer field. The answer is the Markdown of the last
prose block in turn["content"]. A turn without that block, or with only
blank text in it, gives None.
Download the Vis engine of this SDK now and return its vis-agent path.
Use it to prepare a computer or a container image before the first run. It
downloads into $VIS_HOME/sdk/<tag> even when another Vis is installed, and
reuses a complete download unless force is true. A development build of the
SDK installs the latest stable release. VIS_NO_AUTO_INSTALL does not apply.
Raises:
- InstallError: The platform has no engine, the release has no bundle, or the download fails its checks.