Workflow Examples Index

Version: 1.0.0
Purpose: Quick reference index of all workflow examples for AI agents


Overview

This directory contains complete, runnable workflow examples demonstrating multi-step API operations. Each workflow shows how to chain API calls, handle dependencies, and manage state across multiple steps.

All workflows follow the workflow patterns documented in: patterns/workflow-patterns.md


Workflow Categories

Query Workflows

Workflows focused on retrieving and querying game state data.

get-player-and-planets.md

Pattern: Linear Chain
Purpose: Get player information and their planets

Steps:

  1. Get player by ID
  2. Get player’s planets
  3. Return combined data

Use When:

Dependencies: None (takes player ID as input)


query-guild-stats.md

Pattern: Parallel with Dependency
Purpose: Query comprehensive guild statistics

Steps:

  1. Get guild information
  2. Get guild member count (parallel)
  3. Get guild power stats (parallel)
  4. Combine results

Use When:

Dependencies: Guild ID


query-and-monitor-planet.md

Pattern: Hybrid (Query + Streaming)
Purpose: Query planet data and monitor for updates

Steps:

  1. Get planet information (query)
  2. Subscribe to planet events (streaming)
  3. Monitor for updates
  4. Handle events

Use When:

Dependencies: Planet ID


Authentication Workflows

Workflows demonstrating authentication and authenticated operations.

authenticated-guild-query.md

Pattern: Linear Chain with Authentication
Purpose: Authenticate and query guild information

Steps:

  1. Login to webapp API
  2. Store session cookie
  3. Make authenticated request to get guild
  4. Return guild data

Use When:

Dependencies: Username and password

Related: See examples/auth/ for authentication examples


Monitoring Workflows

Workflows for monitoring game state in real-time.

monitor-planet-shield.md

Pattern: Streaming
Purpose: Monitor planet shield health in real-time

Steps:

  1. Connect to GRASS/NATS
  2. Subscribe to planet shield events
  3. Process shield updates
  4. Handle shield status changes

Use When:

Dependencies: Planet ID, NATS connection

Related: See patterns/polling-vs-streaming.md for streaming patterns


Modding Workflows

Workflows for cosmetic mod management.

install-and-use-cosmetic-mod.md

Pattern: Linear Chain
Purpose: Install and use a cosmetic mod

Steps:

  1. Validate mod file
  2. Install mod
  3. Activate mod
  4. Verify installation
  5. Query struct type with cosmetics
  6. Use cosmetic data

Use When:

Dependencies: Mod file, Guild ID

Related: See api/cosmetic-mods.md for mod API endpoints


Workflow Patterns Used

Linear Chain

Use When: Steps depend on previous results

Parallel with Dependency

Use When: Some steps can run in parallel after initial dependency

Hybrid (Query + Streaming)

Use When: Need initial data and real-time updates

Streaming

Use When: Only need real-time updates


Quick Reference

By Use Case

Player Operations:

Guild Operations:

Planet Operations:

Modding Operations:

By Pattern

Linear Chain:

Parallel:

Hybrid:

Streaming:


Workflow Structure

All workflows follow this structure:

{
  "workflow": {
    "id": "workflow-identifier",
    "name": "Human-readable name",
    "description": "What this workflow does",
    "pattern": "workflow-pattern-name",
    "steps": [
      {
        "step": 1,
        "name": "Step name",
        "action": "What this step does",
        "endpoint": "API endpoint",
        "method": "HTTP method",
        "dependsOn": ["previous-step-output"],
        "output": "step-output-key"
      }
    ],
    "inputs": {
      "required": ["input1", "input2"],
      "optional": ["input3"]
    },
    "outputs": {
      "data": "output-data-key"
    },
    "errorHandling": {
      "strategy": "fail-fast|continue-on-error|retry-with-fallback"
    }
  }
}

Using Workflows

1. Find the Right Workflow

Use this index to find workflows by:

2. Review the Workflow

Read the workflow file to understand:

3. Adapt to Your Needs

Customize the workflow for your specific requirements:

4. Implement

Use the workflow as a template for your implementation:



Contributing Workflows

When adding new workflows:

  1. Follow the structure - Use the standard workflow structure
  2. Document clearly - Include description, inputs, outputs
  3. Use patterns - Follow workflow patterns from patterns/workflow-patterns.md
  4. Add to index - Update this README with the new workflow
  5. Test thoroughly - Ensure workflow works with real API

Last Updated: December 7, 2025