Skip to main content

Overview

Integrate Relay workflows with AgentFlow to automate business processes with AI-powered decision making. Relay combines workflow automation with human-in-the-loop approvals and AI assistance.

Prerequisites

Relay Account

Sign up at relay.app

API Access

Generate API key from Relay settings

Workflow Created

Build workflow with API trigger

AgentFlow Admin

Admin access required

Step 1: Setup Relay Workflow

Create New Workflow

  1. Log in to Relay.app
  2. Click Create Workflow
  3. Name: AgentFlow Automation
  4. Description: Process requests from AgentFlow chat

Add API Trigger

1

Select Trigger Type

  • Click Add Trigger
  • Choose API / Webhook
  • Select When API call is received
2

Configure Trigger

  • Method: POST
  • Authentication: API Key
  • Click Generate API Key
  • Copy the API key and webhook URL
3

Define Input Schema

Build Workflow Logic

Add steps to process the request:
1

Parse Input

Set Variables step:
2

AI Processing

AI Assist step:
  • Prompt: “Analyze this message:
  • Model: GPT-4
  • Output: analysis_result
3

Conditional Logic

Condition step:
4

Execute Actions

  • Update database
  • Send notifications
  • Call external APIs
  • Log to systems
5

Return Response

API Response step:

Publish Workflow

  1. Click Test Workflow with sample data
  2. Verify all steps execute correctly
  3. Click Publish
  4. Note the workflow ID and API endpoint

Step 2: Create AI Connection in AgentFlow

Manual Setup

  1. Admin DashboardAI ModelsAdd Model
  2. Basic information:
    • Name: Relay Business Automation
    • Model ID: relay-workflow-executor
    • Description: Automated business processes via Relay
  3. API Configuration:
    • Endpoint: https://api.relay.app/v1/workflows/{{workflow_id}}/execute
    • Method: POST
  4. Headers:
  5. Request schema:
  6. Response path: data.execution_result
  7. Save

Step 3: Import via YAML

YAML Configuration

Create relay-workflow-config.yaml:

Import Process

  1. Replace placeholders with actual values
  2. Admin DashboardAI ModelsImport Model
  3. Upload YAML file
  4. Enter Relay API key
  5. Import

Step 4: Assign to Group

  1. Admin DashboardGroups
  2. Select group (e.g., “Operations Team”)
  3. Manage Models → Enable Relay Workflow
  4. Set limits:
    • Daily executions: 1000
    • Priority: High
    • Approval required: No (or Yes for sensitive operations)
  5. Save Changes

Step 5: Use in Chat

Trigger Workflows

  1. Chat InterfaceNew Conversation
  2. Select Relay Workflow model
  3. Send message to execute workflow

Example Scenarios


Advanced Workflow Features

Human-in-the-Loop Approvals

Relay’s unique feature: Add approval steps
1

Add Approval Step

  • Click Add StepRequest Approval
  • Configure approvers
  • Set approval conditions
2

Configure Approval

3

Handle Response

  • If Approved → Continue workflow
  • If Rejected → Send notification and end
  • If Timeout → Escalate to admin

AI-Powered Decision Making

Use Relay’s AI capabilities:

Multi-App Workflows

Connect multiple services:
1

CRM Integration

Salesforce → Search/Create contact
2

Communication

Slack → Send notification
3

Document Management

Google Drive → Create folder & files
4

Project Management

Asana → Create tasks
5

Analytics

Airtable → Log execution

Workflow Templates

1. Customer Onboarding

2. Invoice Approval Workflow

3. Lead Qualification


Error Handling

Retry Logic

Relay automatically retries failed steps:

Error Notifications

Configure alerts for failures:

Fallback Actions

Define fallback behavior:

Monitoring & Analytics

Execution Dashboard

View in Relay:
  • Runs: All workflow executions
  • Status: Success/Failed/Running
  • Duration: Execution time
  • Logs: Detailed step logs

AgentFlow Analytics

Track performance:
  1. Analytics DashboardModel Usage
  2. Filter by Relay workflows
  3. Monitor:
    • Success rate
    • Average response time
    • Error patterns
    • Usage trends

Custom Metrics

Export data for analysis:

Troubleshooting

Check:
  • API key is valid
  • Workflow is published (not draft)
  • Endpoint URL is correct
  • Request format matches schema
Debug: View execution log in Relay dashboard
Common causes:
  • Invalid credentials for integrated app
  • API rate limit exceeded
  • Timeout on long-running operation
  • Data format mismatch
Fix: Check step logs and adjust configuration
Issue: Approvers didn’t respond in timeSolutions:
  • Increase timeout duration
  • Add more approvers
  • Set up escalation path
  • Enable reminder notifications
Check:
  • API Response step is configured
  • Response format matches expected schema
  • No errors in previous steps
Fix: Test workflow manually in Relay

Security & Compliance

API Key Management

1

Generate Keys

Create separate keys for different environments:
  • Development
  • Staging
  • Production
2

Rotate Regularly

Update keys every 90 days
3

Monitor Usage

Track API calls for anomalies
4

Revoke Compromised Keys

Immediately disable if breach suspected

Data Privacy

  • Encryption: All data encrypted in transit (TLS 1.3)
  • Storage: Encrypted at rest (AES-256)
  • Retention: Configure data retention policies
  • Compliance: GDPR, SOC 2, HIPAA ready

Access Control

Implement least privilege:

Best Practices

Workflow Design

Keep workflows focused and modular

Error Handling

Always add try-catch and fallbacks

Testing

Test thoroughly with edge cases

Documentation

Document purpose and data flow

Version Control

Version workflows for rollback capability

Monitoring

Set up alerts for critical workflows

Performance

Optimize for speed and efficiency

Security

Regular security audits

Relay vs Other Platforms


Next Steps

LangChain Agents

Build AI agents with tools

Cloud Functions

Serverless automation

OpenAI Assistants

Advanced AI agents

Analytics

Monitor workflow performance