#206 Apps: Create Hello World example app
Description
Edit## Parent Epic: #195
## Description
Create a simple Hello World app demonstrating the app SDK.
## Location
engine/apps/examples/hello_world.py
## Hello World App
```python
from engine.apps.sdk import App, AppContext, action, app
@app
class HelloWorldApp(App):
'''Simple Hello World app for demonstration.'''
name = 'hello_world'
version = '1.0.0'
display_name = 'Hello World'
description = 'A simple app that greets users'
category = 'utility'
@action(
description='Return a greeting message',
parameters={
'type': 'object',
'properties': {
'name': {'type': 'string', 'description': 'Name to greet'},
},
'required': ['name']
},
returns={
'type': 'object',
'properties': {
'greeting': {'type': 'string'},
'timestamp': {'type': 'string'},
}
}
)
def greet(self, ctx: AppContext, name: str) -> dict:
ctx.info('Generating greeting', name=name)
greeting = f'Hello, {name}!'
return {
'greeting': greeting,
'timestamp': ctx.now.isoformat(),
}
@action(
description='Greet with checkpoint (idempotent)',
parameters={
'type': 'object',
'properties': {
'name': {'type': 'string'},
},
'required': ['name']
},
returns={'type': 'object'}
)
def greet_with_checkpoint(self, ctx: AppContext, name: str) -> dict:
# This is idempotent - returns cached result on replay
greeting = ctx.checkpoint(
'generate_greeting',
lambda: f'Hello, {name}! Generated at {ctx.now.isoformat()}'
)
return {'greeting': greeting}
```
## Lifecycle Test
1. Register app via API
2. Create version and publish
3. Install to tenant
4. Use in workflow
5. Verify execution
6. Update app (new version)
7. Use updated version
8. Deregister app
9. Re-register app
## Workflow Example
```python
builder = WorkflowBuilder('hello_world_demo')
builder.task(
'greet_user',
'apps.hello_world.greet',
kwargs={'name': 'Highway'}
)
```
## Testing
- Unit tests for actions
- Integration test for full lifecycle
- Sandbox test
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...