Skip to content

Comments

chore(api): migrate evaluator templates to new endpoint - Phase 2#3801

Merged
jp-agenta merged 4 commits intorelease/v0.86.7from
feat/cleanup-evaluators-phase2
Feb 23, 2026
Merged

chore(api): migrate evaluator templates to new endpoint - Phase 2#3801
jp-agenta merged 4 commits intorelease/v0.86.7from
feat/cleanup-evaluators-phase2

Conversation

@mmabrouk
Copy link
Member

@mmabrouk mmabrouk commented Feb 22, 2026

Summary

Completes the evaluator endpoints cleanup by migrating GET /evaluators/ to the new API structure.

Stacked on: #3800 (Phase 1)

Changes

Backend

  • Add GET /preview/simple/evaluators/templates endpoint
  • Add EvaluatorTemplate and EvaluatorTemplatesResponse models
  • Move BUILTIN_EVALUATORS to get_builtin_evaluators() function in shared location
  • Update db_manager.py and migrations to use new function
  • Remove legacy evaluators_router.py and its mount

Frontend

  • Update fetchAllEvaluators() to use the new /templates endpoint
  • The evaluatorsQueryAtomFamily atom automatically uses the new endpoint when preview=false

Testing

  1. Verify evaluator selection dropdowns still work
  2. Verify evaluator templates load correctly in evaluation configuration
  3. Verify new evaluator creation flow works

Migration Notes

The new endpoint returns the same data structure wrapped in a response envelope:

{
  "count": 12,
  "templates": [
    {"name": "LLM-as-a-judge", "key": "auto_ai_critique", ...},
    ...
  ]
}

The frontend handles both the new and old response formats gracefully.


Open with Devin

Add new /preview/simple/evaluators/templates endpoint to replace the
legacy GET /evaluators/ endpoint:

Backend changes:
- Add EvaluatorTemplate and EvaluatorTemplatesResponse models
- Add list_evaluator_templates() handler to SimpleEvaluatorsRouter
- Move BUILTIN_EVALUATORS to get_builtin_evaluators() function in
  oss/src/resources/evaluators/evaluators.py
- Update db_manager.py and migrations to use new function
- Remove evaluators_router.py and its mount from routers.py

Frontend changes:
- Update fetchAllEvaluators() to use new /templates endpoint
- The evaluatorsQueryAtomFamily automatically uses the new endpoint
  when preview=false since it calls fetchAllEvaluators()

This completes the evaluators endpoint cleanup started in Phase 1.
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 22, 2026
@dosubot
Copy link

dosubot bot commented Feb 22, 2026

Related Documentation

Checked 0 published document(s) in 2 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@vercel
Copy link

vercel bot commented Feb 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Feb 23, 2026 0:01am

Request Review

devin-ai-integration[bot]

This comment was marked as resolved.

FastAPI matches routes in registration order. The /{evaluator_id} route
was registered before /templates, which caused FastAPI to try matching
'templates' as a UUID path parameter, resulting in a 422 validation error.

Moving /templates registration before /{evaluator_id} ensures the literal
path is matched first.
@mmabrouk
Copy link
Member Author

Fixed: Route Registration Order

Thanks Devin for catching this! The /templates route was registered after /{evaluator_id}, which caused FastAPI to try matching "templates" as a UUID.

Fix: Moved /templates route registration before /{evaluator_id} routes (commit 7e5e9da).

Also added a comment explaining why the order matters for future maintainers.

devin-ai-integration[bot]

This comment was marked as resolved.

Per AGENTS.md guidelines: 'Use @intercept_exceptions() at the route boundary.'
@mmabrouk
Copy link
Member Author

Deploying to testing.preview.agenta.dev for QA @bekossy

Copy link
Member

@bekossy bekossy left a comment

Choose a reason for hiding this comment

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

QA done. Lgtm ✅

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 23, 2026
@jp-agenta jp-agenta changed the base branch from feat/cleanup-evaluators to release/v0.86.7 February 23, 2026 12:00
@jp-agenta jp-agenta merged commit f973733 into release/v0.86.7 Feb 23, 2026
7 checks passed
@github-actions
Copy link

Railway Preview Environment

Image tag pr-3801-08b0490
Status Failed
Logs View workflow run

Updated at 2026-02-23T12:11:17.418Z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Frontend lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants