Add persistent workspace shell sessions
Let agents inhabit a workspace across separate calls instead of only submitting one-shot execs. Add workspace shell open/read/write/signal/close across the CLI, Python SDK, and MCP server, with persisted shell records, a local PTY-backed mock implementation, and guest-agent support for real Firecracker workspaces. Mark the 2.5.0 roadmap milestone done, refresh docs/examples and the release metadata, and verify with uv lock, UV_CACHE_DIR=.uv-cache make check, and UV_CACHE_DIR=.uv-cache make dist-check.
This commit is contained in:
parent
2de31306b6
commit
3f8293ad24
28 changed files with 3265 additions and 81 deletions
34
examples/python_shell.py
Normal file
34
examples/python_shell.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import tempfile
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from pyro_mcp import Pyro
|
||||
|
||||
|
||||
def main() -> None:
|
||||
pyro = Pyro()
|
||||
with tempfile.TemporaryDirectory(prefix="pyro-workspace-seed-") as seed_dir:
|
||||
Path(seed_dir, "note.txt").write_text("hello from shell\n", encoding="utf-8")
|
||||
created = pyro.create_workspace(environment="debian:12", seed_path=seed_dir)
|
||||
workspace_id = str(created["workspace_id"])
|
||||
try:
|
||||
opened = pyro.open_shell(workspace_id)
|
||||
shell_id = str(opened["shell_id"])
|
||||
pyro.write_shell(workspace_id, shell_id, input="pwd")
|
||||
deadline = time.time() + 5
|
||||
while True:
|
||||
read = pyro.read_shell(workspace_id, shell_id, cursor=0)
|
||||
output = str(read["output"])
|
||||
if "/workspace" in output or time.time() >= deadline:
|
||||
print(output, end="")
|
||||
break
|
||||
time.sleep(0.1)
|
||||
pyro.close_shell(workspace_id, shell_id)
|
||||
finally:
|
||||
pyro.delete_workspace(workspace_id)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue