Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/docs/exosphere/create-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ The `Runtime` class is the core component that manages the execution environment

## Runtime Setup

Before creating a runtime, you need to set up the state manager and configure your environment variables.

### Prerequisites

1. **Start the State Manager**: Run the state manager using Docker Compose:
```bash
docker-compose up -d
```
For detailed setup instructions, see [State Manager Setup](./state-manager-setup.md).

2. **Set Environment Variables**: Configure your authentication:
```bash
export EXOSPHERE_STATE_MANAGER_URI="your-state-manager-uri"
export EXOSPHERE_API_KEY="your-api-key"
```

Or create a `.env` file:
```bash
EXOSPHERE_STATE_MANAGER_URI=your-state-manager-uri
EXOSPHERE_API_KEY=your-api-key
```

Comment on lines +7 to +28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Prereqs: prefer “docker compose” and fix markdownlint issues around fences.

  • Use modern Compose syntax.
  • Add blank lines around fenced blocks and after lists per MD031; remove trailing spaces.
-   ```bash
-   docker-compose up -d
-   ```
-   For detailed setup instructions, see [State Manager Setup](./state-manager-setup.md).
+   
+   ```bash
+   docker compose up -d
+   ```
+
+   For detailed setup instructions, see [State Manager Setup](./state-manager-setup.md).
@@
-   ```bash
-   export EXOSPHERE_STATE_MANAGER_URI="your-state-manager-uri"
-   export EXOSPHERE_API_KEY="your-api-key"
-   ```
-   
-   Or create a `.env` file:
-   ```bash
-   EXOSPHERE_STATE_MANAGER_URI=your-state-manager-uri
-   EXOSPHERE_API_KEY=your-api-key
-   ```
+   
+   ```bash
+   export EXOSPHERE_STATE_MANAGER_URI="your-state-manager-uri"
+   export EXOSPHERE_API_KEY="your-api-key"
+   ```
+
+   Or create a `.env` file:
+
+   ```bash
+   EXOSPHERE_STATE_MANAGER_URI=your-state-manager-uri
+   EXOSPHERE_API_KEY=your-api-key
+   ```
🧰 Tools
🪛 LanguageTool

[grammar] ~7-~7: Use correct spacing
Context: ...nd configure your environment variables. ### Prerequisites 1. **Start the State Mana...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~9-~9: Use correct spacing
Context: ...nvironment variables. ### Prerequisites 1. Start the State Manager: Run the state...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~11-~11: Use correct spacing
Context: ... the state manager using Docker Compose: bash docker-compose up -d For detailed setup instructions, see [St...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~15-~15: Use correct spacing
Context: ...anager Setup](./state-manager-setup.md). 2. Set Environment Variables: Configure y...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~17-~17: Use correct spacing
Context: ...iables**: Configure your authentication: bash export EXOSPHERE_STATE_MANAGER_URI="your-state-manager-uri" export EXOSPHERE_API_KEY="your-api-key" Or create a .env file: ```bash E...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~23-~23: Use correct spacing
Context: ..." Or create a `.env` file: bash EXOSPHERE_STATE_MANAGER_URI=your-state-manager-uri EXOSPHERE_API_KEY=your-api-key ### Creating a Runtime === "Basic" p...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🪛 markdownlint-cli2 (0.17.2)

12-12: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


14-14: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


18-18: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


22-22: Trailing spaces
Expected: 0 or 2; Actual: 3

(MD009, no-trailing-spaces)


24-24: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

🤖 Prompt for AI Agents
In docs/docs/exosphere/create-runtime.md around lines 7 to 28, replace legacy
docker-compose usage with the modern "docker compose" command and fix
markdownlint MD031 issues by ensuring there is a blank line before and after
each fenced code block and after list items, remove any trailing spaces, and
keep the fenced code block language labels (e.g., ```bash) directly on the
opening fence; update the two blocks shown to use "docker compose up -d" and add
the required blank lines around the ```bash blocks and the ".env" section as
described.

🧹 Nitpick (assertive)

Code snippet variables vs env: avoid NameError in later examples.

Advanced example uses EXOSPHERE_STATE_MANAGER_URI/EXOSPHERE_API_KEY as Python names. Recommend showing os.getenv(...) or load_dotenv() usage explicitly before they are referenced.

Offer to patch if you confirm desired style (os.getenv vs dotenv).

🧰 Tools
🪛 LanguageTool

[grammar] ~7-~7: Use correct spacing
Context: ...nd configure your environment variables. ### Prerequisites 1. **Start the State Mana...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~9-~9: Use correct spacing
Context: ...nvironment variables. ### Prerequisites 1. Start the State Manager: Run the state...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~11-~11: Use correct spacing
Context: ... the state manager using Docker Compose: bash docker-compose up -d For detailed setup instructions, see [St...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~15-~15: Use correct spacing
Context: ...anager Setup](./state-manager-setup.md). 2. Set Environment Variables: Configure y...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~17-~17: Use correct spacing
Context: ...iables**: Configure your authentication: bash export EXOSPHERE_STATE_MANAGER_URI="your-state-manager-uri" export EXOSPHERE_API_KEY="your-api-key" Or create a .env file: ```bash E...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~23-~23: Use correct spacing
Context: ..." Or create a `.env` file: bash EXOSPHERE_STATE_MANAGER_URI=your-state-manager-uri EXOSPHERE_API_KEY=your-api-key ### Creating a Runtime === "Basic" p...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🪛 markdownlint-cli2 (0.17.2)

12-12: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


14-14: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


18-18: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)


22-22: Trailing spaces
Expected: 0 or 2; Actual: 3

(MD009, no-trailing-spaces)


24-24: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

🤖 Prompt for AI Agents
In docs/docs/exosphere/create-runtime.md around lines 7 to 28, the tutorial
references EXOSPHERE_STATE_MANAGER_URI and EXOSPHERE_API_KEY as Python variables
later which can cause NameError; update the doc to explicitly show how to load
those values (either via os.getenv or via python-dotenv's load_dotenv) before
they are referenced, e.g. add a short Python snippet that imports os (and
dotenv.load_dotenv if using .env), calls load_dotenv() when appropriate, and
assigns state_manager_uri = os.getenv("EXOSPHERE_STATE_MANAGER_URI") and api_key
= os.getenv("EXOSPHERE_API_KEY") so later examples use those variables safely;
choose one style (os.getenv alone or dotenv + os.getenv) and keep examples
consistent, and confirm if you want me to patch the file with the chosen style.

### Creating a Runtime
=== "Basic"

```python hl_lines="17-22"
Expand Down Expand Up @@ -68,6 +91,21 @@ The `Runtime` class is the core component that manages the execution environment

```

!!! warning "Blocking Operation"
`Runtime.start()` is a blocking operation that runs indefinitely. In interactive environments like Jupyter notebooks, consider running it in a background thread:

```python
import threading

def run_runtime():
runtime.start()

thread = threading.Thread(target=run_runtime, daemon=True)
thread.start()
```

See the [Getting Started guide](../getting-started.md#important-blocking-behavior) for more alternatives.

Comment on lines +94 to +108
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Blocking warning: ensure fenced code block renders (not indented-code).

Markdownlint flagged MD046. Keep fenced code inside the admonition with 4-space indentation (MkDocs Material), but avoid extra leading spaces that turn it into an indented block.

-    ```python
-    import threading
-    
-    def run_runtime():
-        runtime.start()
-    
-    thread = threading.Thread(target=run_runtime, daemon=True)
-    thread.start()
-    ```
+    ```python
+    import threading
+
+    def run_runtime():
+        runtime.start()
+
+    thread = threading.Thread(target=run_runtime, daemon=True)
+    thread.start()
+    ```

Also, consider adding a line noting how to stop the runtime cleanly (mirroring Getting Started).

🧰 Tools
🪛 LanguageTool

[grammar] ~94-~94: Use correct spacing
Context: ... ``` !!! warning "Blocking Operation" Runtime.start() is a blocking operatio...

(QB_NEW_EN_OTHER_ERROR_IDS_5)


[grammar] ~95-~95: Use correct spacing
Context: ...sider running it in a background thread: python import threading def run_runtime(): runtime.start() thread = threading.Thread(target=run_runtime, daemon=True) thread.start() See the Getting Started guide for more alternatives. ## Runtime Parameters ### Required Paramet...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🪛 markdownlint-cli2 (0.17.2)

96-96: Trailing spaces
Expected: 0 or 2; Actual: 4

(MD009, no-trailing-spaces)


97-97: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)

🤖 Prompt for AI Agents
In docs/docs/exosphere/create-runtime.md around lines 94 to 108, the fenced
Python code inside the admonition is accidentally treated as an indented code
block which triggers MD046; convert it to a proper fenced code block by ensuring
the triple backticks with the language marker are inside the admonition and not
prefixed by extra leading spaces (remove the stray indented opening/closing
backticks and place ```python before the code and ``` after), and while there,
add a brief one-line note after the code snippet explaining how to stop the
runtime cleanly (e.g., a short sentence referencing the Getting Started guide or
suggesting runtime.stop() / interrupt handling).

## Runtime Parameters

### Required Parameters
Expand Down
80 changes: 72 additions & 8 deletions docs/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,74 @@ Runtime(
).start()
```

## Important: Blocking Behavior
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Fix minor spacing/markdownlint nits around headings and fences.

Ensure a single blank line before/after headings and fenced code blocks; remove double spaces flagged by LanguageTool/MD031.

Also applies to: 91-91, 93-93, 95-95, 97-97, 120-120, 142-142

🧰 Tools
🪛 LanguageTool

[grammar] ~89-~89: Use correct spacing
Context: ...t() ``` ## Important: Blocking Behavior Note: Runtime.start() is a blocking ...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

🤖 Prompt for AI Agents
In docs/docs/getting-started.md around lines 89 (and also 91, 93, 95, 97, 120,
142), headings and fenced code blocks violate markdownlint/MD031 and spacing
rules: ensure there is exactly one blank line before and after each heading and
each fenced code block, remove any trailing double spaces flagged by
LanguageTool, and normalize surrounding blank lines so there are no consecutive
blank lines; update those specific lines so headings have a single preceding and
following blank line and fenced blocks are separated by one blank line on both
sides.


**Note**: `Runtime.start()` is a blocking operation that will run indefinitely until stopped. This can be problematic in interactive environments like Jupyter notebooks or Python REPLs.

### For Interactive Environments

If you're working in a Jupyter notebook or Python REPL, consider these alternatives:

=== "Background Thread"

```python
import threading

# Create the runtime
runtime = Runtime(
namespace="MyProject",
name="DataProcessor",
nodes=[SampleNode]
)

# Run in a background thread
def run_runtime():
runtime.start()

thread = threading.Thread(target=run_runtime, daemon=True)
thread.start()

# Your interactive session continues here
print("Runtime is running in the background!")
```
Comment on lines +99 to +118
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Background-thread pattern: add a minimal shutdown note.

Daemon threads exit abruptly on interpreter shutdown. Recommend documenting how to stop the runtime (e.g., a stop() API or signal handling) to avoid partial work loss.

-    thread = threading.Thread(target=run_runtime, daemon=True)
+    thread = threading.Thread(target=run_runtime, daemon=True)
     thread.start()
     
-    # Your interactive session continues here
+    # Your interactive session continues here. To stop cleanly, prefer a provided
+    # `runtime.stop()` or send KeyboardInterrupt in terminals if supported.
     print("Runtime is running in the background!")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```python
import threading
# Create the runtime
runtime = Runtime(
namespace="MyProject",
name="DataProcessor",
nodes=[SampleNode]
)
# Run in a background thread
def run_runtime():
runtime.start()
thread = threading.Thread(target=run_runtime, daemon=True)
thread.start()
# Your interactive session continues here
print("Runtime is running in the background!")
```
thread = threading.Thread(target=run_runtime, daemon=True)
thread.start()
# Your interactive session continues here. To stop cleanly, prefer a provided
# `runtime.stop()` or send KeyboardInterrupt in terminals if supported.
print("Runtime is running in the background!")
🤖 Prompt for AI Agents
In docs/docs/getting-started.md around lines 99 to 118, the background-thread
example uses a daemon thread but lacks guidance for graceful shutdown; add a
short note instructing users to stop the runtime explicitly to avoid abrupt
termination—describe calling runtime.stop() (or a provided shutdown API),
optionally sending a termination signal (SIGINT/SIGTERM) handled by the runtime,
and joining the thread (thread.join(timeout)) to wait for cleanup; include a
one- or two-sentence example pattern and a warning that daemon threads may
terminate mid-work if not shut down properly.


=== "Asyncio Task"

```python
import asyncio

# Create the runtime
runtime = Runtime(
namespace="MyProject",
name="DataProcessor",
nodes=[SampleNode]
)

# In an async context (like a Jupyter notebook),
# runtime.start() returns a task that runs in the background.
runtime_task = runtime.start()

# Your interactive session can continue.
print("Runtime is running in the background!")

# You can now do other async work while the runtime runs.
# For example:
# await asyncio.sleep(10)
# print("Finished waiting.")
```

=== "Production Script"

```python
# For production scripts, the blocking behavior is usually desired
if __name__ == "__main__":
Runtime(
namespace="MyProject",
name="DataProcessor",
nodes=[SampleNode]
).start() # Blocks and runs forever
```

## Next Steps

Now that you have the basics, explore:
Expand All @@ -107,14 +175,10 @@ Now that you have the basics, explore:

## Architecture

```
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Your Nodes │ │ Runtime │ │ State Manager │
│ │◄──►│ │◄──►│ │
│ - Inputs │ │ - Registration │ │ - Orchestration │
│ - Outputs │ │ - Execution │ │ - State Mgmt │
│ - Secrets │ │ - Error Handling │ │ - Dashboard │
└─────────────────┘ └──────────────────┘ └─────────────────┘
```mermaid
graph LR
A["Your Nodes<br/>- Inputs<br/>- Outputs<br/>- Secrets"] <--> B["Runtime<br/>- Registration<br/>- Execution<br/>- Error Handling"]
B <--> C["State Manager<br/>- Orchestration<br/>- State Mgmt<br/>- Dashboard"]
```

## Data Model (v1)
Expand Down
5 changes: 4 additions & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ Runtime(
namespace="MyProject",
name="HelloWorld",
nodes=[HelloWorldNode]
).start()
).start() # Note: This blocks the main thread
```

!!! info "Interactive Environments"
If you're using Jupyter notebooks or Python REPLs, `Runtime.start()` will block your session. See the [Getting Started guide](./getting-started.md#important-blocking-behavior) for non-blocking alternatives.

### Run it

Run the server with:
Expand Down