DEV Community

Abhishek Bijjargi
Abhishek Bijjargi

Posted on

From AI Assisted Exploration to a Wagtail Upgrade Agent

Repositories

Wagtail Upgrade Assistant (Agent): GitHub
Bakerydemo exploration: GitHub

Demo Video

Demo Video for Bakerydemo exploration


Introduction

Upgrading a Wagtail project is rarely a straightforward process. It involves navigating breaking changes, deprecated APIs, dependency conflicts, and compatibility issues across Python and Django versions.

As part of maintaining the Bakerydemo project, I initially explored how to approach this upgrade problem using an AI assisted workflow. The goal was to understand whether AI could provide a structured and reliable upgrade strategy.

This post documents that journey, starting from prompt based exploration and evolving into a reusable AI agent designed specifically for Wagtail upgrades.


Objective

The goal of this work was to:

  1. Upgrade a Wagtail project to the latest version
  2. Identify and handle deprecations
  3. Ensure dependencies remain secure
  4. Maintain a working CI pipeline after the upgrade

Initial Approach: AI Assisted Planning

I started by providing the following prompt to an AI assistant:

I am a maintainer of the bakerydemo project.

Help me:

Upgrade to the latest Wagtail version

Identify deprecations

Ensure dependencies are secure

Keep CI working after upgrade

Give step by step instructions specific to this project.

The response outlined a structured upgrade strategy, which served as a strong starting point for understanding the process.


Key Insights from the AI

Incremental Upgrades Instead of Direct Jump

Rather than upgrading directly to the latest version, the AI recommended incremental upgrades across major versions.

For example:

  • Current version to Wagtail 5
  • Then to Wagtail 6
  • Finally to Wagtail 7

This reduces risk and simplifies debugging.


Dependency Alignment

A critical requirement is aligning:

  • Python version
  • Django version
  • Wagtail version

Incompatible combinations can lead to installation failures or runtime issues.


Handling Breaking Changes

Common breaking changes included:

  • Migration from wagtail.core to wagtail
  • Changes in the panel API
  • StreamField configuration updates
  • Removal of legacy admin components

These require manual code updates and cannot be fully automated.


Deprecation Awareness

The AI emphasized identifying deprecated APIs early by enabling warnings and reviewing logs, allowing maintainers to fix issues proactively.


CI Stability

Maintaining CI integrity during upgrades involves:

  • Updating Python versions
  • Ensuring migrations run correctly
  • Verifying static file handling
  • Running test suites after dependency updates

Limitation of the Initial Approach

While the AI generated a solid plan, it had one limitation:

It was not reusable.

Each time, the process depended on re-entering prompts and manually interpreting results. This made it less practical for repeated use across projects.


From Prompt to Agent: Building a Reusable Solution

To address this, I extended the idea into a dedicated tool:

Wagtail Upgrade Assistant

A domain specific AI agent and CLI tool designed to automate the analysis phase of Wagtail upgrades.

Repository: https://github.com/Abhi090907/Wagtail-Upgrade-Assistant-agent/tree/main


What the Agent Does

The Wagtail Upgrade Assistant transforms the earlier exploration into a reusable workflow.

Project Analysis

  • Detects Python, Django, and Wagtail versions
  • Parses dependency files such as requirements.txt

Static Code Analysis

  • Identifies deprecated patterns such as:
    • wagtail.core imports
    • legacy edit handlers
  • Uses Python AST for accurate detection

Upgrade Guidance

  • Suggests incremental upgrade paths
  • Highlights required code changes

Dependency Audit

  • Flags outdated or incompatible packages

CI Recommendations

  • Provides GitHub Actions based suggestions
  • Ensures compatibility during upgrades

Example Workflow

Run the CLI tool:

wagtail-upgrade-agent analyze ./example_project
Enter fullscreen mode Exit fullscreen mode

The agent generates a structured report including:

  • Current stack summary
  • Deprecated API usage with file references
  • Recommended upgrade path
  • Required code changes
  • Dependency updates
  • CI improvements

Why This Matters

This approach shifts the process from:

Manual interpretation of AI responses

to:

A repeatable and structured upgrade workflow

It allows maintainers to quickly assess upgrade complexity without manually scanning the entire codebase.


Observations

During development and testing, a few practical challenges emerged:

  • Environment issues such as Python version compatibility
  • Dependency installation inconsistencies
  • The need for manual validation despite automated analysis

These highlight that while AI and tooling can assist significantly, human oversight remains essential.


Key Takeaways

  • A structured upgrade strategy is critical for Wagtail projects
  • Incremental upgrades reduce risk and complexity
  • Dependency compatibility must be carefully managed
  • AI is effective for planning, but tools make it reusable
  • Combining AI with static analysis creates a practical workflow

Conclusion

Upgrading Wagtail projects involves more than updating dependencies. It requires careful planning, awareness of framework changes, and maintaining system stability.

Starting with an AI assisted exploration provided valuable insights. Extending that into a reusable agent transformed those insights into a practical tool.

This progression from prompt to implementation demonstrates how AI can move beyond assistance and become part of a maintainable development workflow.


Connect

GitHub: GitHub

LinkedIn: LinkedIn

Gmail: abhishekbijjargi4@gmail.com

Top comments (0)