You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51-35Lines changed: 51 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -335,71 +335,88 @@ We can place AI flows into the:
335
335
336
336
### Structure
337
337
338
-
To keep AI flows as flexible as possible, we avoid limiting the output structure by implementing a base `AITask` class that can be extended for specific task types.
338
+
To keep AI flows as flexible as possible, we avoid limiting the output structure by implementing a base `AIResult` class that can be extended for specific result types.
339
339
340
-
The base `AITask` class provides a foundation for any AI-powered task:
340
+
The base `AIResult` class provides a foundation for any AI workflow result:
341
341
342
342
```python
343
-
classAITask(ABC):
344
-
"""Base class for AI tasks that run autonomously and return results.
345
-
346
-
This class provides the foundation for various AI-powered tasks like:
347
-
- Security audits
348
-
- Code quality analysis
349
-
- Gas optimization
350
-
- Documentation generation
351
-
- Any custom analysis
343
+
classAIResult(ABC):
344
+
"""Base class for AI workflow results.
345
+
346
+
Any result type that implements these methods can be used by the AI CLI.
347
+
This allows each workflow to define its own result structure and formatting.
352
348
"""
353
349
350
+
@classmethod
354
351
@abstractmethod
355
-
defget_task_type(self) -> str:
356
-
"""Return the task type identifier (e.g., 'security-audit', 'code-quality')."""
"""Print results in a human-readable format to the console."""
366
+
"""Print the result in a human-readable format to the console."""
362
367
...
363
368
364
369
@abstractmethod
365
370
defto_dict(self) -> Dict[str, Any]:
366
-
"""Convert results to dictionary format for serialization."""
371
+
"""Convert the result to a dictionary for JSON serialization."""
367
372
...
368
373
369
374
defexport_json(self, path: Path) -> None:
370
-
"""Export results to JSON file.
375
+
"""Export the result to a JSON file.
371
376
372
-
Default implementation uses to_dict(), but can be overridden.
377
+
Default implementation uses to_dict(), but can be overridden
378
+
for custom export formats.
373
379
"""
374
-
import json
375
-
376
380
data =self.to_dict()
377
381
path.parent.mkdir(parents=True, exist_ok=True)
378
382
path.write_text(json.dumps(data, indent=2))
379
383
```
380
384
381
-
By implementing the `to_dict()` and `pretty_print()` methods, tasks can easily export results to dictionaries and display them in the console.
385
+
By implementing the `from_working_dir()`, `to_dict()` and `pretty_print()` methods, results can be parsed from workflow outputs, exported to dictionaries and displayed in the console.
382
386
383
-
#### Example: Detection-Specific Task
387
+
#### Example: Detection-Specific Result
384
388
385
-
Here's an example of a specialized task mimicking detectors:
389
+
Here's an example of a specialized result class for detection-style outputs:
386
390
387
391
```python
388
392
389
-
classDetectionTask(AITask):
390
-
"""Base class for AI tasks that produce detection-style results.
393
+
classAIDetectionResult(AIResult):
394
+
"""Detection result specifically for security audit workflows."""
391
395
392
-
This is a specialized AITask for security audits, bug detection,
393
-
and similar tasks that produce a list of findings/detections.
"""Print detections using the detection printer."""
@@ -418,7 +435,6 @@ class DetectionTask(AITask):
418
435
defto_dict(self) -> Dict[str, Any]:
419
436
"""Convert all detections to dictionary format."""
420
437
return {
421
-
"task_type": self.get_task_type(),
422
438
"detections": [
423
439
{
424
440
"detector": detector_name,
@@ -438,7 +454,7 @@ class DetectionTask(AITask):
438
454
439
455
The core runner handles output by calling either `pretty_print()` or `to_dict()` based on whether the user wants console output or has specified the `--export` flag.
440
456
441
-
This flexible architecture allows us to define new task types (e.g., fuzzing) that can have different output formats. For example, `wake ai fuzz` could return specialized fuzzing results or simply print to the console, and export functionality can be customized or disabled for specific task types.
457
+
This flexible architecture allows us to define new result types (e.g., fuzzing results, optimization reports) that can have different output formats. For example, `wake ai fuzz` could return specialized fuzzing results with its own `FuzzingResult` class, and export functionality can be customized or disabled for specific result types.
442
458
443
459
444
460
## Todo
@@ -448,7 +464,7 @@ This flexible architecture allows us to define new task types (e.g., fuzzing) th
448
464
-[ ] Enable defining AI flows in `wake_ai` folder under private repo
449
465
-[ ] Reach consensus on AI framework name
450
466
-***Trace*** – simple, clean, post-hoc or live path tracking; modern and very product-ready.
451
-
-***Tasks*** - simple, could also bre well marketed, i.e. we are introducing wake tasks
467
+
-***Tasks*** - simple, could also be well marketed, i.e. we are introducing wake tasks
452
468
- alternatively we could just swap `wake ai` for `wake task`, looks nice
453
469
-***Shikoro*** – "reasoning in motion"; also sounds a bit like a stylized Japanese name.
454
470
-***Michi*** – philosophical, elegant, the Way (道); perfect for a framework guiding agents.
0 commit comments