Overview

Date: 2026-05-11

Time: 15:45

Overview

This is an example script demonstrating FTL2's automatic result collection and summary feature. It shows that AutomationContext (obtained via automation()) automatically tracks all task outcomes — successes and failures — and prints a per-host summary with error details when the context manager exits. The key point is that users don't need manual error checking; the framework handles reporting.

Usage Patterns

The script follows the standard FTL2 async context manager pattern:


from ftl2 import automation

async with automation() as ftl:
    await ftl.file(path="/some/path", state="directory")
    await ftl.command(cmd="echo 'hello'")
    # Failures don't stop execution — all tasks run
    await ftl.file(path="/bad/path", state="touch")
# Summary and errors printed automatically on exit

Run with: uv run python exampleautosummary.py

API and Configuration

Key Behaviors

Relationships