Back to all posts

Automate your AI agents with VM0 GitHub actions integration

Introduction

Today, we shared a practical example using vm0-ai/run-action, a GitHub Action that lets you trigger VM0 workflows directly from your CI/CD pipelines. This integration brings agent automation into your GitHub repositories, making it easy to schedule and run AI agents automatically.

What is VM0

VM0 is an agent runtime for building AI agents. It provides the infrastructure to orchestrate agent skills, run agents in sandboxes, and define agent workflows using natural language.

What is Github action

GitHub Actions is GitHub’s built-in automation platform that lets you run workflows based on events or on a schedule. Using cron jobs, you can automatically execute tasks at fixed intervals, such as running CI pipelines, background jobs, or AI agents.

From local to cloud: Running VM0 workflows with GitHub actions

Previously, running VM0 workflows required executing the vm0 run command from your local machine. While this worked well for development and testing (also VM0 is in beta!) it presented challenges for:

With the new vm0-ai/run-action, you can now trigger VM0 workflows directly from GitHub Actions using a simple action configuration. No more manual command execution, just describe your agent task and let GitHub handle the scheduling and execution.

Getting started: your first VM0 GitHub action

Using VM0 in GitHub Actions is straightforward. Here's a basic example:

- name: Run VM0 Agent
  uses: vm0-ai/run-action@v1
  with:
    agent: my-agent
    prompt: "Build and test the project"
    artifact-name: my-artifact
    vm0-token: ${{ secrets.VM0_TOKEN }}

Setting up authentication

To authenticate your GitHub Actions with VM0, you'll need to set up a VM0_TOKEN secret in your repository. This is a one-time setup process:

# Generate a VM0 authentication token and store it in GitHub Secrets
vm0 auth setup-token | gh secret set VM0_TOKEN

This command generates a token from your local VM0 authentication and securely stores it in your GitHub repository's secrets, making it available to your workflows.

Real-world example: Automated content publishing

Let's walk through a complete example that demonstrates the power of VM0 GitHub Actions integration. We'll create an automated content farm that publishes daily AI news articles to dev.to.

The scenario

We have an existing VM0 workflow at vm0-cookbooks/104-content-farm that collects daily AI news and publishes articles. Now, we want this workflow to run automatically on a schedule.

Step 1: Create a GitHub repository

First, create a new repository to house your automated workflow:

# Create and set up your repository
git clone <https://github.com/yourusername/vm0-content-farm>
cd vm0-content-farm

Step 2: Configure the workflow

Create .github/workflows/daily.yaml in your repository:

name: Content Farm

on:
  schedule:
    # Run at 10:00 AM UTC+8 (2:00 AM UTC) every day
    - cron: '0 2 * * *'
  workflow_dispatch:

jobs:
  run-content-farm:
    runs-on: ubuntu-latest
    steps:
      - name: Run Content Farm Agent
        uses: vm0-ai/run-action@v1
        with:
          agent: content-farm
          prompt: "Write an article about recent AI developments, providing brief summaries of each story to help readers quickly browse the news over their morning coffee"
          artifact-name: content-farm-output
          vm0-token: ${{ secrets.VM0_TOKEN }}
          secrets: |
            CLAUDE_CODE_OAUTH_TOKEN=${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
            FAL_KEY=${{ secrets.FAL_KEY }}
            DEVTO_API_KEY=${{ secrets.DEVTO_API_KEY }}

Let's break down the key components:

Step 3: Set up your secrets

Configure the necessary authentication tokens in your repository:

# Set up Claude Code authentication
claude setup-token
gh secret set CLAUDE_CODE_OAUTH_TOKEN --body "your-claude-token"

# Set up other required API keys
gh secret set FAL_KEY --body "your-fal-key"
gh secret set DEVTO_API_KEY --body "your-devto-api-key"

Security note: These secrets are stored securely in GitHub and are only accessible to your workflows. They're never exposed in logs or workflow outputs.

Step 4: Add auto-deployment workflow

Create .github/workflows/publish.yml

  name: Publish Agent

  on:
    push:
      branches:
        - main

  jobs:
    publish:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v4
        - uses: vm0-ai/compose-action@v1
          with:
            vm0-token: ${{ secrets.VM0_TOKEN }}

This automatically deploys your agent configuration on every push to main. No manual vm0 compose needed.

Step 5: Deploy and test

  Deploy:
  # Get the content-farm agent configuration
  git clone https://github.com/vm0-ai/vm0-cookbooks
  cp -r vm0-cookbooks/104-content-farm/* ./

  # Push to trigger auto-deployment
  git add .
  git commit -m "feat: add content farm agent"
  git push origin main

  Test:
  # Manually trigger the workflow
  gh workflow run scheduled-run.yml

That's it! Your agent will now auto-deploy on push and run on schedule.

Conclusion

The VM0 GitHub Actions integration helps you bring AI agents into your existing development workflow.

Instead of running agents manually or treating them as one-off scripts, you can run them directly inside your CI/CD pipelines and on a schedule. This makes it easier to:

Whether you are publishing content, generating reports, reviewing code, or automating internal workflows, VM0 GitHub Actions gives you a simple and reliable way to run AI agents when they are needed.

To get started, explore our cookbooks repository, for working examples, and try the

vm0-ai/run-action in your own GitHub workflows.

Additional resources

Related Articles

Stay in the loop

// Get the latest insights on agent-native development.

SubscribeJoin Discord