# Route Work with Structured Agent Outputs (https://www.shipfox.io/docs/how-to/author-workflows/use-structured-agent-outputs)

Description: Make an agent publish a typed decision, print its summary safely, and run a review step only when the decision requires it.

Use structured outputs when later workflow logic needs a value from an agent.
This guide records a summary and a boolean review decision instead of parsing
the agent's final response.

## Add the workflow [#add-the-workflow]

Create `.shipfox/workflows/classify-release-risk.yml`. This is a complete
workflow:

```yaml
# yaml-language-server: $schema=https://www.shipfox.io/docs/workflow.schema.json
name: Classify release risk
runner: shipfox

triggers:
  manual:
    source: manual

jobs:
  assess:
    steps:
      - key: assess
        prompt: |
          Review the repository for release risk.
          Set summary to one sentence that explains the main risk.
          Set needs_review to true when a person should review before release.
        outputs:
          summary: string
          needs_review: boolean

      - env:
          SUMMARY: "${{ steps.assess.outputs.summary }}"
        run: |
          printf 'Assessment: %s\n' "$SUMMARY"

      - if: '${{ steps.assess.outputs.needs_review == true }}'
        run: echo "Human review required"
```

The declared outputs give the agent two `set_output` tools. The summary is
bound through `env` before shell use. The final step reads the boolean directly
in its condition.

Commit and push the file to the project's default branch. Wait for **Classify
release risk** to sync.

## Verify the decision [#verify-the-decision]

Start the workflow and open the `assess` job.

1. Confirm that the agent sets both declared outputs.
2. Confirm that the assessment line matches the `summary` output.
3. If `needs_review` is true, confirm that the final step runs. If it is false,
   confirm that Shipfox marks the final step skipped.

An agent step fails when it does not set a required output after its bounded
re-prompts. See [Step outputs](https://www.shipfox.io/docs/reference/workflow-schema#step-outputs) for the
exact behavior.