Skip to content

workflow optimization for memory and remove redundency - #58

Merged
iamtekson merged 1 commit into
mainfrom
dev
Jul 9, 2026
Merged

workflow optimization for memory and remove redundency#58
iamtekson merged 1 commit into
mainfrom
dev

Conversation

@iamtekson

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors GeoAgent’s QGIS automation architecture to reduce redundancy and memory usage by introducing a multi-step “outer workflow” graph plus a single-task geoprocessing sub-graph, and by caching the QGIS processing registry metadata for faster algorithm discovery.

Changes:

  • Added a cached processing algorithm catalog and a new token/tag-based local scoring algorithm finder.
  • Replaced the previous processing graphs with a new multi-step workflow (agents/workflow.py) and a single-task geoprocessing sub-graph (agents/geoprocessing_flow.py).
  • Simplified/renamed system prompts and updated structured schemas/state types to match the new workflow.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/geoprocessing.py Adds cached registry catalog + improved algorithm discovery and updates execution output handling.
prompts/system.py Renames/simplifies routing/selection/parameter/error-analysis prompts for the new workflow.
agents/workflow.py New outer-loop multi-step workflow graph coordinating per-task routing and execution.
agents/geoprocessing_flow.py New single-task geoprocessing sub-graph with retry + error analysis.
agents/graph.py Updates general graph behavior (context trimming + loop back after tools) and switches processing mode to the new workflow.
agents/states.py Replaces the old monolithic processing state with WorkflowState + GeoTaskState.
agents/schemas.py Updates structured-output schemas for per-task routing/decomposition and error analysis.
agents/init.py Re-exports the new graph builders/states/schemas and removes old exports.
agents/processing.py Removed legacy single-step processing graph implementation.
agents/multi_step_processing.py Removed legacy recursive multi-step processing implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/geoprocessing.py
scored = [(_score_algorithm(tokens, e), e) for e in catalog]
scored = [(s, e) for s, e in scored if s > 0]
scored.sort(key=lambda item: item[0], reverse=True)
matches = [e for _, e in scored[: max(1, limit)]]
Comment on lines +168 to +179
if not selected:
_logger.info("GEO select: shortlist insufficient; trying full catalog")
full_lines = "\n".join(
f"- {e['id']} | {e['name']}"
for e in get_algorithm_catalog()
if e["id"] not in excluded
)
answer = _ask_selection(
operation, "All available algorithms:\n" + full_lines, retry_context
)
if answer and answer in catalog_ids and answer not in excluded:
selected = answer
@iamtekson
iamtekson merged commit 3205484 into main Jul 9, 2026
2 checks passed
@iamtekson
iamtekson deleted the dev branch July 9, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants