Home/Blog/Engineering

Orchestrating Multimedia Magic: How I Built Content Generation with Vizra ADK Workflows

·3m read·Engineering
Orchestrating Multimedia Magic: How I Built Content Generation with Vizra ADK Workflows

Managing Multimedia Generation

Generating multimedia assets requires executing sequential and parallel steps. A reliable system must research facts, synthesize audio, and generate visuals. Single LLM prompts fail at coordinating these varied tasks.

I use Vizra ADK Workflows to manage this orchestration.

Sequential Planning

Content generation begins with a script. I use a sequential workflow to establish the text foundation before generating audio and image assets.

use Vizra\VizraADK\Facades\Workflow;
use App\Agents\Content\ResearcherAgent;
use App\Agents\Content\ScriptWriterAgent;

public function generateContent(string $topic)
{
    $scriptData = Workflow::sequential()
        ->then(ResearcherAgent::class)
        ->then(ScriptWriterAgent::class)
        ->run($topic);

    // ... pass to next stage
}

The ResearcherAgent queries a Meilisearch vector store for context. The ScriptWriterAgent formats this data into a JSON structure containing a title, body, and image generation prompt.

Parallel Asset Generation

Audio synthesis and image generation do not depend on each other. I pass the completed script into a parallel workflow to run these tasks concurrently.

    // ... inside generateContent

    $assets = Workflow::parallel()
        ->agents([
            'audio' => VoiceOverAgent::class,
            'visual' => ThumbnailGeneratorAgent::class,
        ])
        ->run($scriptData['final_script']);

    return [
        'script' => $scriptData,
        'audio_path' => $assets['audio'],
        'image_url' => $assets['visual'],
    ];
}

Agent Configuration

Each agent runs a specialized tool. I configure the Voice Over Agent to connect with ElevenLabs.

The Voice Over Agent

The agent processes the script text and returns an MP3 file path.

namespace App\Agents\Content;

use Vizra\VizraADK\Agents\BaseLlmAgent;
use App\Tools\Audio\ElevenLabsTtsTool;

class VoiceOverAgent extends BaseLlmAgent
{
    protected string $name = 'voice_over_specialist';

    protected string $model = 'gpt-4o-mini';

    protected string $instructions = <<<'INSTRUCTIONS'
        You are an audio engineer.
        1. Receive the script text.
        2. Select the voice ID based on the content tone.
        3. Use the 'text_to_speech' tool to generate the audio.
        4. Return the file path provided by the tool.
    INSTRUCTIONS;

    protected array $tools = [
        ElevenLabsTtsTool::class,
    ];
}

The Tool Implementation

The ElevenLabsTtsTool encapsulates the API call to isolate the agent logic from network operations.

namespace App\Tools\Audio;

use Vizra\VizraADK\Contracts\ToolInterface;
use Illuminate\Support\Facades\Http;

class ElevenLabsTtsTool implements ToolInterface
{
    public function definition(): array
    {
        return [
            'name' => 'text_to_speech',
            'description' => 'Converts text to audio using ElevenLabs',
            'parameters' => [
                'type' => 'object',
                'properties' => [
                    'text' => ['type' => 'string'],
                    'voice_id' => ['type' => 'string'],
                ],
                'required' => ['text'],
            ],
        ];
    }

    public function execute(array $arguments, $context, $memory): string
    {
        // Implementation calling ElevenLabs API
    }
}

Architecture Benefits

This architecture isolates responsibilities. The ResearcherAgent manages text retrieval. The VoiceOverAgent handles audio processing. I switch external providers by replacing the tool classes. Parallelizing the asset generation cuts total processing time in half. Vizra’s tracing tools provide visibility into agent reasoning and tool outputs throughout the pipeline.

Related Posts