#198 Apps: Implement App base class and @action decorator
Description
Edit## Parent Epic: #195
## Description
Create the App base class and @action decorator for defining apps.
## Location
engine/apps/sdk/base.py
## App Base Class
### Required Class Attributes
- name: str (unique identifier)
- version: str (semver)
### Optional Class Attributes
- display_name: str
- description: str
- category: str (communication, storage, integration, utility)
### Class Methods
- get_manifest() -> dict
- Generates JSON manifest from class definition
- Includes all actions with parameters/returns schemas
### Instance Methods
- execute_action(ctx: AppContext, action_name: str, **kwargs) -> Any
- Dispatches to action method
- Validates action exists
## @action Decorator
### Parameters
- description: str
- parameters: dict (JSON Schema)
- returns: dict (JSON Schema)
- waits_for_event: bool = False
### Behavior
- Attaches ActionDefinition to method
- Used by get_manifest() to generate schema
## ActionDefinition Dataclass
- name, description
- parameters, returns (JSON Schema)
- waits_for_event
## @app Class Decorator
- Auto-collects all @action methods
- Validates required attributes exist
## Example Usage
```python
@app
class MyApp(App):
name = 'my_app'
version = '1.0.0'
@action(
description='Do something',
parameters={'type': 'object', 'properties': {...}},
returns={'type': 'object'}
)
def my_action(self, ctx: AppContext, param1: str) -> dict:
return {'result': param1}
```
## Testing
- Test manifest generation
- Test action execution
- Test validation errors
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...