FLOW MASON

AI Copilot

Get intelligent assistance for designing, debugging, and optimizing pipelines using AI.

The FlowMason AI Copilot provides intelligent assistance for designing, debugging, and optimizing pipelines using large language models.

Beta Feature - This feature is currently under heavy testing. For early access, contact [email protected].

Features

Pipeline Suggestions

Get AI-powered suggestions for improving your pipelines:

from flowmason_core.copilot import CopilotService, CopilotContext

# Initialize service
copilot = CopilotService(api_key="your-anthropic-key")

# Create context from your pipeline
context = CopilotContext.from_pipeline(pipeline)

# Get suggestions
suggestion = await copilot.suggest(
    context=context,
    request="Add error handling to the API call"
)

print(f"Suggestion: {suggestion.description}")
print(f"Changes: {suggestion.config}")
print(f"Reasoning: {suggestion.reasoning}")

Pipeline Explanation

Understand complex pipelines with AI-generated explanations:

explanation = await copilot.explain(
    context=context,
    target="process-data"  # Specific stage or None for whole pipeline
)

print(explanation.summary)
print(explanation.details)

Pipeline Generation

Generate entire pipelines from natural language descriptions:

pipeline = await copilot.generate(
    description="Create a pipeline that fetches user data from an API, "
                "validates the schema, transforms it to our format, "
                "and saves to the database"
)

Optimization Suggestions

Get recommendations for improving pipeline performance:

optimizations = await copilot.optimize(context=context)

for opt in optimizations:
    print(f"- {opt.description}")
    print(f"  Impact: {opt.impact}")
    print(f"  Effort: {opt.effort}")

Debug Assistance

Get help debugging pipeline issues:

debug_help = await copilot.debug(
    context=context,
    error_message="Stage 'transform' failed: KeyError 'user_id'",
    execution_logs=logs
)

print(f"Root cause: {debug_help.root_cause}")
print(f"Suggested fix: {debug_help.suggestion}")

API Endpoints

The Studio backend provides REST endpoints for copilot functionality:

Suggest Changes

POST /api/v1/copilot/suggest
Content-Type: application/json

{
  "pipeline_id": "my-pipeline",
  "request": "Add validation before the transform stage"
}

Explain Pipeline

POST /api/v1/copilot/explain
Content-Type: application/json

{
  "pipeline_id": "my-pipeline",
  "stage_id": "transform"
}

Generate Pipeline

POST /api/v1/copilot/generate
Content-Type: application/json

{
  "description": "Pipeline that processes customer feedback"
}

Optimize Pipeline

POST /api/v1/copilot/optimize
Content-Type: application/json

{
  "pipeline_id": "my-pipeline"
}

Debug Assistance

POST /api/v1/copilot/debug
Content-Type: application/json

{
  "pipeline_id": "my-pipeline",
  "run_id": "run-123",
  "error": "KeyError: 'user_id'"
}

VSCode Integration

Access the AI Copilot directly from VSCode:

  1. Open the FlowMason sidebar
  2. Click on “AI Copilot” tab
  3. Type your request and press Enter

Inline Suggestions

  • Hover over a stage and click “Ask AI”
  • Use Cmd+K (Mac) or Ctrl+K (Windows) for quick actions

Commands

  • FlowMason: Ask AI Copilot
  • FlowMason: Explain Pipeline
  • FlowMason: Optimize Pipeline
  • FlowMason: Generate Pipeline from Description

Configuration

Configure the copilot in your settings:

{
  "flowmason.copilot.enabled": true,
  "flowmason.copilot.model": "claude-3-opus",
  "flowmason.copilot.maxTokens": 4096,
  "flowmason.copilot.temperature": 0.7
}

Environment variables:

ANTHROPIC_API_KEY=your-api-key
FLOWMASON_COPILOT_MODEL=claude-3-opus

Best Practices

  1. Be Specific - Provide clear, specific requests for better suggestions
  2. Review Changes - Always review AI suggestions before applying
  3. Iterate - Use “Modify” to refine suggestions that are close but not perfect
  4. Provide Context - Include relevant information about your use case
  5. Use Explain - Use the explain feature to understand complex pipelines