Skip to content

Feature: Session‑based Code Interpreter with Persistent State #138

@JakobStadlhuber

Description

@JakobStadlhuber

Title: Feature: Session‑based Code Interpreter with Persistent State

Is your feature request related to a problem? Please describe.

  • Multi‑step workflows: Today, each call to the interpreter is stateless, so variables, installed packages, and files are lost between calls.
  • Re-initialization cost: Re-importing libraries, re-downloading datasets, and re-establishing context slows iteration.
  • Brittle context passing: Manually re-sending prior outputs or code increases token usage and error risk.

Describe the solution you'd like

  • Durable sessions: A session ID that pins execution to an isolated runtime where variables, files, and package state persist across calls.
  • Session lifecycle: Create, resume, pause, checkpoint, restore, reset, and close; configurable TTL and resource limits.
  • State persistence: Persist working directory, installed packages/cache, environment variables, and execution history.
  • Observability & control: Streaming stdout/stderr, per-call metadata, resource usage, and session‑scoped logs.
  • Portability: Export session as archive (code + env + files) for reproducibility; optional snapshot/restore.
  • Runtimes: Python first; R/JS as follow‑ups, matching repository goals; kernel-like interactive behavior.

Describe alternatives you've considered

  • Pass all context every call: Increases token usage, latency, and failure risk; doesn’t persist file system or package state.
  • External storage + reload: Requires manual synchronization, is brittle, and still redoes environment setup each call.
  • Long-running single job: Resource‑heavy, harder to isolate/secure, and fragile across timeouts or outages.

Additional context

Acceptance criteria

  • Persistence: Variables, files, and installed packages remain available across multiple execute calls within the same session.
  • Lifecycle controls: Create, resume, pause, reset, checkpoint, restore, and close function reliably with clear statuses.
  • Reproducibility: Export/import yields the same environment and results on a fresh backend.
  • Performance: Time‑to‑first‑execute ≤ N seconds; subsequent executes are faster due to cached state.
  • Safety: Enforced isolation, quotas, timeouts, and configurable egress by preset; sessions auto‑clean after TTL.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions