Skip to main content
This template creates AI-generated 4-panel comics using the Inworld Agent Runtime and MiniMax Image Generation API. Key concepts demonstrated:
  • Custom nodes extending the CustomNode class for specialized processing
  • LLM-powered story generation
  • External API integration (MiniMax) for image generation
  • Parallel processing for efficiency
  • Error handling and retry logic

Watch the Demo

Architecture
  • Backend: Inworld Agent Runtime + Express.js + Minimax API
  • Frontend: Static HTML + JavaScript
  • Communication: HTTP

Prerequisites

Run the Template

  1. Clone the comic generator GitHub repo.
  2. Set up your API keys by creating a .env file in the project’s root directory with your required API keys:
    .env
  3. Install dependencies and start the server:
    The server will start on port 3003 (or the port specified in your PORT environment variable).
  4. Open your browser and navigate to http://localhost:3003 to access the comic generation interface.
  5. Create a comic by filling in the form:
    • Character 1 Description: e.g., “A brave knight with shiny armor”
    • Character 2 Description: e.g., “A wise old wizard with a long beard”
    • Art Style: e.g., “anime manga style” or “cartoon style”
    • Theme (optional): e.g., “medieval adventure”
  6. Click “Generate Comic” and wait for the processing to complete. You can check the status or view recent comics through the interface.
  7. Check out your captured traces in Portal!

Understanding the Template

The core functionality of the comic generator is contained in comic_server.ts, which orchestrates a graph-based processing pipeline using custom nodes and built-in Inworld Agent Runtime components. The template creates a processing pipeline that transforms user input through multiple AI processing stages to generate complete 4-panel comics.

1) Custom Node Implementation

The template defines custom nodes by extending the CustomNode class for specialized comic generation operations:
comic_story_node.ts

2) Node Creation

After defining custom node classes, the graph creates instances of both custom and built-in nodes:
comic_server.ts

3) Core Graph Construction

With all nodes created, the comic generation pipeline is assembled using GraphBuilder by connecting each processing stage:
comic_server.ts
This creates the complete flow: User Input → Story Generation → LLM Processing → Response Parsing → Image Generation → Final Comic

4) Graph Execution

Once the graph is built, the server uses it to process comic generation requests asynchronously. When a user submits a comic request through the REST API, the following execution flow begins:
comic_server.ts

5) Response Handling

As the graph processes through each stage, the application monitors the output stream and manages the comic generation lifecycle. This enables real-time status tracking and provides users with immediate feedback:
comic_server.ts
This demonstrates the power of the Inworld Agent Runtime’s graph architecture - you can create sophisticated AI processing pipelines by combining custom nodes with built-in components, handling complex workflows with proper resource management and error handling.