plexus.cli.procedure.lua_dsl.runtime module
Lua DSL Runtime - Main execution engine for Lua-based procedures.
Orchestrates: 1. YAML parsing and validation 2. Lua sandbox setup 3. Primitive injection 4. Agent configuration with LLMs and tools 5. Workflow execution
- class plexus.cli.procedure.lua_dsl.runtime.LuaDSLRuntime(procedure_id: str, client, mcp_server, openai_api_key: str | None = None)
Bases:
objectMain execution engine for Lua-based procedure workflows.
Responsibilities: - Parse and validate YAML configuration - Setup sandboxed Lua environment - Create and inject primitives - Configure agents with LLMs and tools - Execute Lua workflow code - Return results
Initialize the Lua DSL runtime.
- Args:
procedure_id: Unique procedure identifier client: PlexusDashboardClient instance mcp_server: MCP server providing tools openai_api_key: Optional OpenAI API key for LLMs
- __init__(procedure_id: str, client, mcp_server, openai_api_key: str | None = None)
Initialize the Lua DSL runtime.
- Args:
procedure_id: Unique procedure identifier client: PlexusDashboardClient instance mcp_server: MCP server providing tools openai_api_key: Optional OpenAI API key for LLMs
- async execute(yaml_config: str, context: Dict[str, Any] | None = None) Dict[str, Any]
Execute a Lua-based procedure workflow.
- Args:
yaml_config: YAML configuration string context: Optional context dict with pre-loaded data
- Returns:
- Execution results dict with:
success: bool
result: Any (return value from Lua workflow)
state: Final state
iterations: Number of iterations
tools_used: List of tool names called
error: Error message if failed
- Raises:
LuaDSLRuntimeError: If execution fails
- get_iteration_count() int
Get current iteration count.
- get_state() Dict[str, Any]
Get current procedure state.
- is_stopped() bool
Check if procedure was stopped.
- exception plexus.cli.procedure.lua_dsl.runtime.LuaDSLRuntimeError
Bases:
ExceptionRaised when Lua DSL runtime encounters an error.