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
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ name: Python API Server Tests
on:
push:
branches: [main]
paths:
- 'api-server/**'
pull_request:
branches: [main]
paths:
- 'api-server/**'

jobs:
test:
Expand Down
4 changes: 2 additions & 2 deletions python-sdk/exospherehost/node/BaseNode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import ABC, abstractmethod
from typing import Optional, Any
from typing import Optional, Any, List


class BaseNode(ABC):
Expand All @@ -8,7 +8,7 @@ def __init__(self, unique_name: Optional[str] = None):
self.unique_name: Optional[str] = unique_name

@abstractmethod
async def execute(self, inputs: dict[str, Any]) -> dict[str, Any]:
async def execute(self, inputs: dict[str, Any]) -> dict[str, Any] | List[dict[str, Any]]:
pass

def get_unique_name(self) -> str:
Expand Down
10 changes: 9 additions & 1 deletion python-sdk/exospherehost/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def _enqueue(self):

await sleep(self._poll_interval)

async def _notify_executed(self, state_id: str, outputs: dict[str, Any]):
async def _notify_executed(self, state_id: str, outputs: List[dict[str, Any]]):
async with ClientSession() as session:
endpoint = self._get_executed_endpoint(state_id)
body = {"outputs": outputs}
Expand Down Expand Up @@ -112,7 +112,15 @@ async def _worker(self):
try:
node = self._node_mapping[state["node_name"]]
outputs = await node.execute(state["inputs"]) # type: ignore

if outputs is None:
outputs = []

if isinstance(outputs, dict):
outputs = [outputs]

await self._notify_executed(state["state_id"], outputs)

except Exception as e:
await self._notify_errored(state["state_id"], str(e))

Expand Down
4 changes: 2 additions & 2 deletions state-manager/app/models/executed_models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from pydantic import BaseModel, Field
from typing import Any
from typing import Any, List
from .state_status_enum import StateStatusEnum

class ExecutedRequestModel(BaseModel):
outputs: dict[str, Any] = Field(..., description="Outputs of the state")
outputs: List[dict[str, Any]] = Field(..., description="Outputs of the state")
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 3, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Breaking change: Consider versioning and documentation updates.

The type change from dict[str, Any] to List[dict[str, Any]] is a breaking change for API consumers. Consider:

  1. API versioning: This change breaks backward compatibility
  2. Field description: Update the description to reflect that outputs are now a list of dictionaries
  3. Migration strategy: Ensure consumers are updated accordingly
-    outputs: List[dict[str, Any]] = Field(..., description="Outputs of the state")
+    outputs: List[dict[str, Any]] = Field(..., description="List of output dictionaries from the state execution")
📝 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
outputs: List[dict[str, Any]] = Field(..., description="Outputs of the state")
outputs: List[dict[str, Any]] = Field(..., description="List of output dictionaries from the state execution")
🤖 Prompt for AI Agents
In state-manager/app/models/executed_models.py at line 6, the type of the
outputs field was changed to a list of dictionaries, which is a breaking change.
Update the API version to indicate this breaking change, revise the field
description to clearly state that outputs is now a list of dictionaries, and
coordinate with API consumers to implement a migration strategy so they can
handle the new data structure properly.

Copy link
Member Author

Choose a reason for hiding this comment

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

not needed as we are in beta

Copy link
Contributor

Choose a reason for hiding this comment

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

@NiveditJain, understood! You're absolutely right - breaking changes are expected and acceptable during beta phase. API stability guarantees don't typically apply until a stable release. Thanks for clarifying the project's current development stage.


✏️ Learnings added
Learnt from: NiveditJain
PR: exospherehost/exospherehost#131
File: state-manager/app/models/executed_models.py:0-0
Timestamp: 2025-08-03T04:26:00.112Z
Learning: The exospherehost project is currently in beta phase, so breaking changes in APIs are acceptable and don't require versioning or migration strategies.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.



class ExecutedResponseModel(BaseModel):
Expand Down