Skip to content

Repository files navigation

ADK Comic Pipeline

This repository contains an agentic pipeline for generating comic books, built using the Google Agent Development Kit (ADK) and Vertex AI.

It is based on the solution to the codelab: Create a low-code agent with ADK visual builder

Features

  • Automated Scripting: Generates creative comic scripts and character manifests from high-level prompts.
  • Intelligent Panelization: Breaks down scripts into exactly 8 storyboarded panels.
  • AI Image Synthesis: Generates 16:9 images for each panel using Vertex AI.
  • HTML Assembly: Compiles the final artwork and script into a responsive HTML comic book.
  • Cloud Deployment: Scripts included for deploying agents to Google Cloud Run.
  • Low-Code Interface: Use the ADK Builder for visual agent development.

Project Structure

  • Agent1/: A basic agent featuring a Google Search tool. Uses root_agent.yaml.
  • Agent2/: An agent focused on image generation using sub-agents. Uses root_agent.yaml and sub_agent_*.yaml.
  • Agent3/: The primary comic pipeline implementation.
    • root_agent.yaml: The Studio Director agent that manages the pipeline.
    • comic_pipeline_agent.yaml: Orchestrates the SequentialAgent workflow.
    • tools/: Custom Python tools for image generation and file handling.
  • images/: Directory where intermediate panel images are stored.
  • output/: The final output directory containing comic.html and assets.

Scripts & Utilities

  • agent_builder: Launches the ADK Builder UI (accessible via browser) for visual agent design.
  • myadk: A convenience wrapper for the adk CLI tool.
  • comic.sh: Starts a local web server (port 8080) to view the generated comic.
  • deploycloudrun.py: Automates deployment to Google Cloud Run, including IAM and Service Account setup.
  • fix_comic.py: Manual utility to regenerate the comic.html with a default story (Momotaro).
  • init.sh: Comprehensive setup script to configure the GCP project, enable APIs, and install dependencies.
  • set_env.sh / set_adc.sh: Helpers to set environment variables and refresh Application Default Credentials.

Makefile Commands

  • make run: Runs adk web . to start the ADK development server.
  • make web: Starts adk web on all interfaces (0.0.0.0).
  • make clean: Removes log files, generated images, and temporary cache directories.
  • make test: Runs fix_comic.py to validate the HTML generation.
  • make deploy: Deploys the project using deploycloudrun.py.
  • make comic: Launches a server specifically for the output/ directory on port 8000.

How it Works (Agent3)

The system uses a Studio Director agent (root_agent.yaml) that delegates to a SequentialAgent (comic_pipeline_agent.yaml), coordinating four specialized stages:

  1. Scripting Agent: Narrative and Character Architect.
  2. Panelization Agent: Cinematographer and Storyboarder.
  3. Image Synthesis Agent: Technical Artist and Asset Generator.
  4. Assembly Agent: Frontend Developer for final packaging.

Known Bugs & Workarounds

  • Environment Variables: After editing .env, run source .env or ./set_env.sh to update your shell.
  • YAML Nesting: The ADK CLI may nest YAML configurations in subdirectories incorrectly. They must be moved to the root of the respective agent's directory.
  • Issue Tracking: See google/adk-python Issue #4134.

Getting Started

  1. Initialize Project: Run ./init.sh to set up your Google Cloud project, enable necessary APIs, and install dependencies.
  2. Verify Environment: Ensure GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION are set in the .env file.
  3. Run Pipeline: Execute the comic creation pipeline for Agent3:
    adk run Agent3 --input "Create me a comic about a space explorer on a neon planet."
  4. View Results: Run ./comic.sh and open http://localhost:8080 in your browser.

Deployment

To deploy an agent (default Agent1) to Google Cloud Run:

make deploy

Note: Edit deploycloudrun.py to change the default target agent.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages