Skip to main content

AI Workflows

Wit includes powerful AI workflows that orchestrate multiple steps and agents to accomplish complex tasks. These workflows use the Mastra framework for reliable, observable AI operations.

Overview

AI workflows provide:
  • Multi-step orchestration - Chain AI operations together
  • Parallel execution - Run independent tasks simultaneously
  • Error handling - Graceful recovery and retry logic
  • Streaming output - Real-time progress updates
  • Structured output - Type-safe inputs and outputs

Available Workflows


Multi-Agent Planning Workflow

The most sophisticated workflow, using three specialized agents to plan and execute complex coding tasks.

Agents

  1. Planner Agent - Analyzes tasks, creates execution plans with parallel groups
  2. Executor Agents - Run subtasks in parallel using full code agent capabilities
  3. Reviewer Agent - Validates results, triggers re-planning if needed

Usage

Programmatic Usage

Streaming Execution

Execution Plan Structure


Code Generation Workflow

Generate code from natural language descriptions with context awareness.

Features

  • Analyzes existing codebase for patterns
  • Generates type-safe code
  • Follows project conventions
  • Creates tests alongside implementation

Usage

Options


Marketing Content Workflow

Generate marketing content for releases, announcements, and documentation.

Features

  • Release announcement generation
  • Changelog formatting
  • Social media posts
  • Documentation updates

Usage

Output Types


Creating Custom Workflows

You can create custom workflows using the Mastra framework:

Registering with Mastra


Error Handling

Workflows include built-in error handling:

Retry Logic


Observability

Logging

Metrics

Workflows automatically track:
  • Step duration
  • Success/failure rates
  • Token usage (for AI steps)
Access via the Mastra dashboard or API.

Best Practices

Use dryRun: true when testing new workflows to see the execution plan without making changes.
Break complex tasks into smaller, focused workflows that can be composed together.
Always define Zod schemas for inputs and outputs to ensure type safety.
Workflows with AI steps consume API tokens. Monitor usage in production.