Skip to content

Results Guide

πŸ“Š Results GuideLink

Master Sierra Dev's powerful result visualization system.

🎯 What Are Results?Link

Results are structured data formats that make your output:

  • Consistent - Same format every time
  • Machine-readable - Easy to parse and process
  • Beautiful - Sierra platform renders them with style
  • Flexible - Multiple formats for different data types

Why not just print()?

Regular print statements create messy, inconsistent output. Sierra results provide structure, validation, and beautiful rendering!


πŸ“‹ Available Result TypesLink

Type Best For Example Use
Table Tabular data, lists Port scan results, file listings
Tree Hierarchical data Directory structures, categories
Timeline Time-based events Historical data, logs
Chart Statistical data Distributions, comparisons
Network Relationships Social graphs, network topology
Error Error messages Validation failures, exceptions

πŸ—‚οΈ Table ResultsLink

Perfect for displaying structured, tabular data.

Basic ExampleLink

Python
import sierra

result = sierra.Table(
    headers=["Name", "Age", "City"],
    rows=[
        ["Alice", "28", "NYC"],
        ["Bob", "35", "LA"],
        ["Charlie", "42", "Chicago"]
    ]
)

sierra.respond(result)

Output (JSON):

JSON
1
2
3
4
5
6
7
8
9
{
  "type": "Table",
  "headers": ["Name", "Age", "City"],
  "rows": [
    ["Alice", "28", "NYC"],
    ["Bob", "35", "LA"],
    ["Charlie", "42", "Chicago"]
  ]
}

Real-World Example: Port ScannerLink

Python
@invoker.entry_point
def run(target: sierra.Param[str, ...]):
    open_ports = scan_ports(target)  # Your scanning logic

    rows = []
    for port in open_ports:
        rows.append([
            str(port.number),
            port.service,
            port.state
        ])

    result = sierra.Table(
        headers=["Port", "Service", "State"],
        rows=rows
    )

    sierra.respond(result)

🌳 Tree ResultsLink

Perfect for heirarchical, nested data.

Basic ExampleLink

Python
result = sierra.Tree(
    tree=[
        "Root",
        {
            "Level 1": [
                "Item A",
                "Item B"
            ],
            "Level 2": [
                "Item C",
                {"Nested": ["Deep item"]}
            ]
        }
    ]
)

sierra.respond(result)

Or Use Helper FunctionLink

Python
1
2
3
4
5
6
7
8
9
result = sierra.create_tree_result([
    "Directory: /home/user",
    {
        "documents/": ["report.pdf", "notes.txt"],
        "images/": ["photo1.jpg", "photo2.jpg"]
    }
])

sierra.respond(result)

⏰ Timeline ResultsLink

Perfect for time-based events and historical data.

ExampleLink

Python
result = sierra.Timeline(
    events=[
        {
            "timestamp": "2024-01-15T10:30:00Z",
            "title": "Login Attempted",
            "description": "Failed login from IP 192.168.1.1"
        },
        {
            "timestamp": "2024-01-15T10:32:00Z",
            "title": "Lockout Triggered",
            "description": "Account locked after 3 failed attempts"
        },
        {
            "timestamp": "2024-01-15T11:00:00Z",
            "title": "Password Reset",
            "description": "Password reset email sent"
        }
    ]
)

sierra.respond(result)

πŸ“ˆ Chart ResultsLink

Perfect for statistical and numerical data visualization.

Example: Distribution ChartLink

Python
result = sierra.Chart(
    chart_type="bar",
    labels=["Critical", "High", "Medium", "Low"],
    datasets=[
        {
            "label": "Vulnerabilities",
            "data": [5, 12, 28, 45]
        }
    ]
)

sierra.respond(result)

Supported Chart TypesLink

  • bar - Bar charts
  • line - Line graphs
  • pie - Pie charts
  • radar - Radar/spider charts

πŸ•ΈοΈ Network ResultsLink

Perfect for relationship graphs and network topologies.

Example: Social NetworkLink

Python
result = sierra.Network(
    nodes=[
        {"id": "alice", "label": "Alice"},
        {"id": "bob", "label": "Bob"},
        {"id": "charlie", "label": "Charlie"}
    ],
    edges=[
        {"from": "alice", "to": "bob", "label": "follows"},
        {"from": "bob", "to": "charlie", "label": "follows"},
        {"from": "charlie", "to": "alice", "label": "follows"}
    ]
)

sierra.respond(result)

❌ Error ResultsLink

Perfect for reporting errors and validation failures.

ExampleLink

Python
@invoker.entry_point
def run(email: sierra.Param[str, ...]):
    if not email or '@' not in email:
        result = sierra.create_error_result(
            "Invalid email format. Please provide a valid email address."
        )
        sierra.respond(result)
        return

    # Continue with valid email...

Output (JSON):

JSON
1
2
3
4
{
  "type": "Error",
  "error": "Invalid email format. Please provide a valid email address."
}


🎨 Best PracticesLink

βœ… Do ThisLink

Python
# Clear, descriptive headers
result = sierra.Table(
    headers=["IP Address", "Hostname", "Status"],
    rows=data
)

# Handle errors gracefully
if not data:
    sierra.respond(sierra.create_error_result("No results found"))
    return

# Use appropriate types
# Tabular data β†’ Table
# Hierarchical β†’ Tree
# Time-based β†’ Timeline

❌ Avoid ThisLink

Python
# Vague headers
result = sierra.Table(
    headers=["Col1", "Col2", "Col3"],
    rows=data
)

# Mixing result types
# Don't return multiple results!

# Ignoring errors
# Always validate input first

πŸ”„ Choosing the Right TypeLink

Use this decision tree:

graph TD
    A[What data do you have?] -->|Lists/tables| B[Table]
    A -->|Hierarchy/nesting| C[Tree]  
    A -->|Time-ordered events| D[Timeline]
    A -->|Numbers/statistics| E[Chart]
    A -->|Relationships/connections| F[Network]
    A -->|Error occurred| G[Error]

    style B fill:#00f3ff20
    style C fill:#bc13fe20
    style D fill:#0aff0020
    style E fill:#fcee0a20
    style F fill:#ff00ff20
    style G fill:#ff660020

πŸ’‘ Advanced TipsLink

Dynamic Result SelectionLink

Python
@invoker.entry_point
def run(
    format: sierra.Param[
        str,
        sierra.SierraOption(description="Output format: table or tree")
    ] = "table"
):
    data = get_data()

    if format == "tree":
        result = convert_to_tree(data)
    else:
        result = convert_to_table(data)

    sierra.respond(result)

Combining DataLink

Python
# Process data first
raw_data = fetch_data()
processed = analyze(raw_data)

# Create comprehensive result
rows = []
for item in processed:
    rows.append([
        item.name,
        item.score,
        item.status
    ])

result = sierra.Table(
    headers=["Name", "Score", "Status"],
    rows=rows
)

sierra.respond(result)

πŸ“š Complete ExamplesLink

See these real invokers for inspiration:


πŸš€ Next StepsLink