Skip to main content

Overview

The Interactive Runtime provides a unified core runtime that powers all interactive modes in PraisonAI:
  • praisonai chat - Interactive chat mode
  • praisonai chat - Interactive terminal chat mode
  • praisonai tui launch - Full-screen TUI mode
All modes share the same:
  • Session storage and continuation
  • Tool dispatch and loading
  • Permission/approval semantics
  • Event-based architecture

Installation

Quick Start

When the runtime is consumed via the PraisonAI YAML adapter (rather than constructed directly as above), startup failures now degrade gracefully — agents run without the runtime-backed centric tools instead of crashing the run.

Configuration

RuntimeConfig

Runtime Status

Returns:

Subsystem States

LSP Operations

When LSP is ready, you can use code intelligence:

ACP Operations

When ACP is ready, you can create and apply action plans:

Tracing

Enable tracing to capture all operations:

Graceful Degradation

The runtime handles subsystem failures gracefully:
  • LSP fails: Code intelligence falls back to regex-based extraction
  • ACP fails: Runtime enters read-only mode (no file modifications)

CLI Integration

The runtime integrates with CLI flags:

Lifecycle in YAML runs (framework: praisonai)

Setting config.acp: true or config.lsp: true in YAML triggers the same InteractiveRuntime lifecycle as the Python API:

YAML Runtime Lifecycle

YAML Configuration Details

The YAML route uses default RuntimeConfig values with these settings:
  • Workspace: os.getcwd() (current working directory)
  • Approval Mode: PRAISONAI_APPROVAL_MODE environment variable (default: "prompt")
  • Trace Enabled: Not explicitly set (uses RuntimeConfig default)
The runtime boots on the shared _async_bridge background loop (the same loop already used by ~77 wrapper-side run_sync callers), not on a per-run scoped loop. This is what makes ACP/LSP agent-centric tools safe — every async primitive owned by the runtime stays bound to a loop that is still running when tools re-enter. run_sync() now cancels the runtime startup/shutdown coroutine on timeout (PR #1692), so a hung LSP server or ACP backend no longer leaks.

Full RuntimeConfig Control

For full RuntimeConfig control, use the Python API directly:
For more details on agent-centric tools and InteractiveRuntime integration, see PraisonAI Agents Framework.As of PR #1658 (May 2026), ACP/LSP agent-centric tools work end-to-end in YAML runs. Earlier versions had a premature-teardown bug — upgrade to praisonai ≥ 0.0.58.PR #1692 (May 2026)run_sync() now cancels timed-out tasks on the background loop, and YAML tool_timeout is enforced at the wrapper boundary as well as inside the SDK. Upgrade to praisonai ≥ the release containing this PR for both behaviours.

Operational Notes

Performance

  • Subsystems start in parallel for faster initialization
  • LSP client is lazy-loaded only when enabled
  • ACP session is lightweight (in-process)

Dependencies

  • pylsp (optional) - For Python LSP support
  • pyright (optional) - Alternative Python LSP

Production Caveats

  • LSP startup may take a few seconds for large workspaces
  • Trace files can grow large for long sessions
  • ACP session is in-memory; external storage needed for persistence

Concurrency safety

InteractiveRuntime.start() and .stop() are coroutines. The CLI boots them through the persistent background loop via the Async Bridge, so they are safe to call from sync code (e.g. inside PraisonAI._run_praisonai). Calling PraisonAI.run() from inside a running event loop raises RuntimeError instead of deadlocking — wrap your async caller around the runtime directly instead. Session-store concurrency. The CLI session store (praisonai.cli.session.UnifiedSessionStore) used by TUI, --interactive, and InteractiveCore is safe across processes and threads as of PR #1854. save() reloads the on-disk JSON under an exclusive lock and merges concurrent message appends rather than overwriting them; load() invalidates the in-memory cache when the on-disk file’s mtime has advanced. See CLI Sessions → Concurrent Sessions for the user-facing description.

How sync/async crossings work in the wrapper layer

InteractiveCore (Unified Runtime)

The new InteractiveCore provides a unified runtime for all interactive modes:

CLI Flags

Session Management

Approval Modes

The runtime supports three approval modes: