Skip to content

QVault/building-effective-agents

Repository files navigation

Effective Agents Workflows

A collection of Cloudflare Workers-based workflows for handling various AI and content processing tasks. This project leverages Cloudflare's durable objects and workflow capabilities to create reliable, scalable AI processing pipelines.

Workflows Available

  1. Orchestrator Workflow (/orchestrator)

    • Handles news fact-checking pipeline
    • Extracts claims from articles
    • Performs parallel source verification
    • Conducts historical analysis
  2. Parallel LLM Workflow (/parallel-llm)

    • Manages concurrent LLM operations
    • Optimizes throughput for multiple AI requests
  3. Question Routing Workflow (/routing-questions)

    • Routes questions to appropriate AI models
    • Handles question classification and distribution
  4. Translation Copy Workflow (/translate-copy)

    • Translates marketing content to target languages
    • Maintains tone and style consistency
    • Supports word count optimization
  5. Evaluator Optimizer Workflow (/evaluator-optimizer)

    • Evaluates translation quality
    • Optimizes content based on metrics

Quick Start

Prerequisites

  • Node.js installed
  • Wrangler CLI installed (npm install -g wrangler)
  • Cloudflare account with Workers access

Setup

  1. Clone the repository:
git clone [repository-url]
cd effective-agents
  1. Install dependencies:
npm install
  1. Configure your environment:
cp wrangler.jsonc.example wrangler.jsonc
# Edit wrangler.jsonc with your settings

Deployment

Deploy to Cloudflare Workers:

wrangler deploy

Usage Examples

Trigger Translation Workflow

Use the provided script to trigger the translation workflow:

// trigger-workflow.js
const payload = {
  marketingSubject: "Your marketing content",
  targetLanguage: "Spanish",
  targetWordCount: 100,
};

async function triggerWorkflow() {
  try {
    const response = await fetch(
      'https://effective-agents.ai-662.workers.dev/translate-copy',
      {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        body: JSON.stringify(payload),
      }
    );

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const data = await response.json();
    console.log('Workflow triggered successfully:', data);
  } catch (error) {
    console.error('Error triggering workflow:', error);
  }
}

triggerWorkflow();

Run the script:

node trigger-workflow.js

API Endpoints

Base URL: https://effective-agents.ai-662.workers.dev

  • /orchestrator - News fact checking workflow
  • /parallel-llm - Parallel LLM calls workflow
  • /routing-questions - Question routing workflow
  • /translate-copy - Content translation workflow
  • /evaluator-optimizer - Translation evaluation workflow
  • ?instanceId=XXX&workflow=YYY - Check status of a running workflow

Architecture

The project uses a component-based architecture with these key features:

  • Durable Objects: For maintaining state across requests
  • Workflow System: For managing long-running processes
  • Parallel Processing: For optimizing throughput
  • Error Handling: Built-in retries and failure management
  • Monitoring: Built-in observability with sampling rate of 1

Development

Project Structure

├── src/
│   ├── workflow/
│   │   ├── orchestrator-workflow.ts
│   │   ├── parallel-llm-workflow.ts
│   │   ├── routing-questions-workflow.ts
│   │   ├── translate-copy-workflow.ts
│   │   └── evaluator-optimizer-workflow.ts
│   ├── services/
│   │   └── ai/
│   └── index.ts
├── wrangler.jsonc
└── package.json

Configuration

The wrangler.jsonc file contains all necessary configuration:

  • Project name and entry points
  • Workflow bindings
  • Compatibility settings
  • Observability configuration

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

[Add your license here]

Support

For support, please [add support contact information]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published