App¶
The App class is the top-level container for workflows in the Virtualitics AI Platform.
App Class¶
App
¶
App(name: str, description: str, image_path: Optional[str] = None, is_shareable: bool = False, sort_key: Optional[str] = None, agent: Optional[DispatcherAgentInterface] = None, iris_config: Optional[IrisConfig] = None)
An App represent a workflow in the Virtualitics AI Platform. An App can contain many :class:~virtualitics_sdk.flow.step.Step's that can
get inputs, run computation, and show results.
Parameters:
-
name(str) –The name of the App.
-
description(str) –The App description
-
image_path(Optional[str], default:None) –The base64 encoding of an image or a public link to an image, defaults to None
-
is_shareable(bool, default:False) –Whether a given App is shareable, defaults to False
-
sort_key(Optional[str], default:None) –An optional value to sort the App by, this controls the sort order of Apps on the home page
-
agent(Optional[DispatcherAgentInterface], default:None) –EXAMPLE:
# Imports from virtualitics_sdk import App... # Example usage tile_image_link = "https://example-image.jpeg" example_flow = App(name="Example App", description="Simple example for using App class", image_path=tile_image_link)
Flow Metadata¶
FlowMetadata
¶
Usage Example¶
from virtualitics_sdk import App, Step, StepType, Page, Section
# Create an app
my_app = App(
name="My Application",
description="An example application",
is_shareable=True
)
# Add steps using chain()
my_app.chain([
step1,
step2,
step3
], lock=True)
Key Methods¶
chain()¶
The chain() method is the primary way to add steps to your app. It takes a list of steps in execution order and locks the app by default.
SingletonApp¶
SingletonApp is a variant of App that ensures only one active instance exists at a time. Useful for monitoring dashboards and shared resources.
SingletonApp
¶
SingletonApp(name: str, description: str, image_path: Optional[str] = None, is_shareable: bool = False, sort_key: Optional[str] = None, agent: Optional[DispatcherAgentInterface] = None, trigger: Optional[Trigger] = None, iris_config: Optional[IrisConfig] = None)
from virtualitics_sdk import SingletonApp
app = SingletonApp(
name="System Monitor",
description="Live monitoring dashboard — single instance only"
)
app.chain([monitor_step])
When to Use SingletonApp¶
- Live dashboards where multiple instances would be redundant
- Shared resource monitors (database status, cluster health)
- Admin tools that should only run once at a time
LLM Configuration¶
Apps can configure IRIS integration with hooks and default prompts:
async def on_llm_request(request_data, link, flow_metadata):
"""Add context before sending to LLM."""
request_data["context"] = {"app_data": "..."}
return request_data
app = App(
name="AI Analysis",
description="AI-powered analysis",
on_llm_request=on_llm_request,
default_prompts=[
"What are the key trends?",
"Summarize the data"
]
)
See the LLM Integration guide for details.
Best Practices¶
- Give descriptive names: App names appear in the UI, make them clear
- Set descriptions: Help users understand what your app does
- Use shareable flag: Enable sharing if users should be able to share instances
- Order matters: Steps execute in the order they're added via
chain() - Lock your app: The
lock=Trueparameter (default) prevents accidental modifications - Use SingletonApp for dashboards and monitors that shouldn't have multiple instances
See Also¶
- Step - Building blocks of apps
- Page - UI for each step
- Triggers - Automated flow execution
- Getting Started - Build your first app