KRYSTA WING/NoA Python SDK Reference

NoA Python SDK API Reference

This document provides comprehensive technical details for classes, async context operations, parameter syntax matrices, and Server-Sent Event (SSE) response token objects mapped directly into the krysta runtime engine.


01 / Core Class Architecture

The Noa Client Manager

The primary orchestration proxy used to initialize network pipes and manage execution state boundaries across remote hypervisor clusters.

from krysta.noa import Noa
Constructor Parameters:
gateway_url (str, Optional)

Specifies the explicit system endpoint path of your custom infrastructure deployment. If left blank or omitted, the SDK defaults routing maps automatically back to the hosted Krysta live secure cloud server.


02 / Resource Lifecycle Management

Asynchronous Context Interfaces

The core engine fully implements the native asynchronous context manager specification (__aenter__ / __aexit__). This forces explicit stream safety, teardown automation, and isolates memory allocations dynamically.

# Instantiates secure connection pipes with automatic cleanup limits
async with Noa() as client:
    # Sandboxed MicroVM worker scopes are pinned here
    pass

# Engine channels and sockets are automatically reaped here

03 / Method Reference Maps

Method: execute()

Spawns an isolated evaluation container context on the host network, feeding uncompiled raw source scripts directly into the runtime hypervisor loop.

def execute(
    language: str,
    code: str,
    timeout_ms: int = 5000
) -> AsyncIterator[dict]:
Input Arguments Grid:
language [REQUIRED](str)

Target language compiler image execution runner. Supported parameters: "python", "javascript".

code [REQUIRED](str)

The raw text block payload containing the script source text to compile inside the micro-sandbox pool environment.

timeout_ms (int, Default: 5000)

Strict timing envelope restriction window before a thread hardware interrupts (SIGKILL) the worker. Max threshold limit fallback parameters default to 5000ms.


04 / Response Serialization Schema

Stream Event Payload Blueprint

Returns an AsyncIterator[dict]. Workload events stream frame-by-frame over an async loop mapping output dictionaries directly back to client processes.

{
  "type": "system" | "stdout" | "stderr" | "rules" | "done" | "error",
  "text": "string" | null,
  "timestamp": integer
}

05 / Token Parameters Definition Matrix

Event Type Breakdown

1. type == "system"SCHEDULING ENGINE

Emitted immediately when cloud proxies begin allocating compute memory boundaries or initializing loop tasks.

Text Example: "EXECUTION_STARTED"

2. type == "stdout"STANDARD STREAM OUTPUT

Emitted instantly when uncompiled running instructions write characters directly to the standard terminal output buffers.

Text Content: Plaintext string capturing the output buffer data chunk maps.

3. type == "stderr"RUNTIME EXCEPTION

Emitted instantly when runtime parsing failures, edge memory exceptions, or tracebacks halt code compilation mid-loop.

Text Content: Multiline system trace details and runtime standard logging dumps.

4. type == "rules"VALIDATION POLICIES

Emitted at execution teardown cycles. Evaluates validation schemas across rule layers before confirming memory resets.

Text Contents JSON Structural Schema:
"[{\"rule\": \"ExitCodeZeroRule\", \"result\": \"PASS\" | \"FAIL\", \"reason\": \"...\"}, ...]"
5. type == "done"TERMINATION COMPLETION

Signals that the script loop execution timeline completed its operation cleanly and severed the proxy connections successfully.

Text Content: null

6. type == "error"PLATFORM ROUTING BREAKAGE

Emitted if internal gateway disruptions, cluster routing network drops, or execution sandboxing errors knock threads down.

Text Content: "Job failed during execution"