-
Notifications
You must be signed in to change notification settings - Fork 0
Guide Context Aware Responses
Kris Simon edited this page Mar 1, 2026
·
3 revisions
ARO automatically formats responses and log output based on the execution context. The same code produces different output formats depending on how it's invoked.
ARO recognizes three execution contexts:
| Context | Trigger | Output Format |
|---|---|---|
| Human |
aro run, CLI execution |
Readable text |
| Machine | HTTP API, events | JSON/structured data |
| Developer |
aro test, debug mode |
Detailed diagnostics |
When you run ARO from the command line, output is formatted for readability:
(Application-Start: Example) {
Log "Hello, World!" to the <console>.
Return an <OK: status> for the <startup>.
}
Running with aro run:
[Application-Start] Hello, World!
When code runs via HTTP request or event handler, output is structured data:
{"level":"info","source":"Application-Start","message":"Hello, World!"}During test execution, output is displayed as a formatted table with type annotations:
┌──────────────────────────────────────────┐
│ LOG [console] Application-Start │
├──────────────────────────────────────────┤
│ message: String("Hello, World!") │
└──────────────────────────────────────────┘
The runtime automatically detects context:
| Entry Point | Context |
|---|---|
aro run command |
Human |
aro test command |
Developer |
| HTTP route handler | Machine |
| Event dispatch | Machine |
--debug flag |
Developer |
(getUser: User API) {
Retrieve the <user> from the <user-repository> where id = <id>.
Log "User retrieved" to the <console>.
Return an <OK: status> with <user>.
}
[getUser] User retrieved
[OK] success
user.id: 123
user.name: Alice
{
"status": "OK",
"reason": "success",
"data": {
"user": {"id": 123, "name": "Alice"}
}
}┌──────────────────────────────────────────┐
│ LOG [console] getUser │
├──────────────────────────────────────────┤
│ message: String("User retrieved") │
└──────────────────────────────────────────┘
┌──────────────────────────────────────────┐
│ Response<OK> │
├────────────────┬─────────────────────────┤
│ reason │ String("success") │
│ user.id │ Int(123) │
│ user.name │ String("Alice") │
└────────────────┴─────────────────────────┘
- Write Once: No need for separate formatting code
- Automatic Adaptation: Output suits the consumer automatically
- Consistent Behavior: Same logic, appropriate presentation
- Debug Friendly: Rich diagnostics during development
The Log action respects output context:
Log <value> to the <console>.
-
Human:
[FeatureSetName] value -
Machine:
{"level":"info","source":"FeatureSetName","message":"value"} - Developer: Formatted table with type annotations
The Return action sets the response, which is formatted based on context:
Return an <OK: status> with <result>.
- Actions - Built-in action reference
- HTTP Services - API development
Fundamentals
- The Basics
- Feature Sets
- Actions
- Variables
- Type System
- Control Flow
- Error Handling
- Computations
- Dates
- Concurrency
Runtime & Events
I/O & Communication
Advanced