Skip to main content

preview Command

The preview command shows the data that the SQLite storage backend keeps while a workflow runs. Use it to debug, to verify outputs and to see the data that goes between actions.

bash
BASH
agac preview -w <workflow-name> [options]

Use preview to check quickly which records an action wrote. You do not have to open SQLite files manually.

Options​

OptionDescription
-w, --workflow TEXTThe workflow name: the name of its configuration file (required). -a names the same option.
--sandboxRead the output of sandbox runs (agac run --sandbox) in place of the output of real runs. See Sandbox Runs
-A, --action TEXTThe name of the action to preview. If you do not specify it, the command lists all actions.
-n, --limit INTThe maximum number of records to show (default: 10)
--offset INTThe number of records to skip (default: 0)
-f, --formatThe output format: table, json or raw (default: table)
--statsShow only the storage statistics

Without -w, the command stops with exit code 2 and prints Error: Missing option '-w' / '--workflow' / '-a'. See The Workflow and the Action.

Examples​

List All Actions​

Show the actions that have stored data:

bash
BASH
agac preview -w my_workflow

Preview Action Output​

Show the records of a specified action:

bash
BASH
agac preview -w my_workflow -A extract_facts

JSON Output​

Get output that a machine can read, for scripts:

bash
BASH
agac preview -w my_workflow -A extract_facts -f json

Pagination​

Move through large datasets one page at a time:

bash
BASH
# First 10 records
agac preview -w my_workflow -A extract_facts -n 10

# Next 10 records
agac preview -w my_workflow -A extract_facts -n 10 --offset 10

Storage Statistics​

Show the quantity of data that each action stored:

bash
BASH
agac preview -w my_workflow --stats

Output Formats​

Table Format (default)​

The table shows one row for each record. The row numbers start from the offset. With -A, the columns are the output fields of the action, sorted by name. The table shows a maximum of the first six fields. Without -A, the command lists the actions that have stored data.

text
TXT
┏━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━┓
┃ # ┃ id ┃ saw_keys ┃ saw_score ┃ saw_secret ┃ score ┃
┡━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━┩
│ 1 │ keep-1 │ id,saw_source_keys,score,tier │ True │ False │ 90 │
└───┴────────┴───────────────────────────────┴───────────┴────────────┴───────┘

JSON Format​

The full data of each record, as a JSON array. The data includes the lineage and metadata fields:

bash
BASH
agac preview -w my_workflow -A extract_facts -f json

Raw Format​

Output with no format, to send through a pipe to other tools:

bash
BASH
agac preview -w my_workflow -A extract_facts -f raw | jq '.[] | .content'

Use Cases​

Debug Missing Data​

If a downstream action does not receive the expected data, examine the output of the upstream action:

bash
BASH
# Check what the upstream action actually produced
agac preview -w my_workflow -A upstream_action -n 5 -f json

Verify Field References​

Make sure that fields exist before you refer to them:

bash
BASH
# See the actual content structure
agac preview -w my_workflow -A extract_facts -f json | jq '.[0].content | keys'

Monitor the Progress of a Workflow​

During a workflow that runs for a long time, check which records the workflow processed:

bash
BASH
agac preview -w my_workflow --stats

See Also​