## Summary - Closes Phase 4 of [#62](#62): `evals/suite.json` (≥40 graded questions), `run_evals` management command, and manually-triggered `.gitea/workflows/run-evals.yml`. - Emits versioned WS `status` frames during grounded chat (evaluating / searching / reading_sources / refining / writing) for [chat_web_app#96](ai_ml_operations/chat_web_app#96). - Implements [#63](#63): Redis/Celery optional infra, `AgentRun`/`AgentStep`, tool registry (SSRF-safe `fetch_url`, tenant-scoped docs), LangGraph orchestrator, progress frames, REST `GET/POST /api/agent_runs/…`, gated by `ALLOW_AGENTIC_TASKS` (default off). ## Test plan - [x] `SKIP_RAG_INIT=1 uv run python manage.py test` for evals, ws frames, agent tools, consumers, grounding - [ ] Manual: with `ALLOW_AGENTIC_TASKS=false`, chat identical to today - [ ] Manual: status frames visible in FE with #96 branch - [ ] Manual (GPU): `python manage.py run_evals --runs 3` - [ ] Manual: `ALLOW_AGENTIC_TASKS=true` multi-step research prompt creates AgentRun + framesReviewed-on: #71
23 lines
828 B
Python
23 lines
828 B
Python
"""Celery app for durable agent-run background work (#63).
|
|
|
|
Only used when ``CELERY_BROKER_URL``/``REDIS_URL`` is configured; otherwise
|
|
``chat_backend.services.agent.tasks`` falls back to a daemon thread (mirrors
|
|
the ``ImmediateBackend``-over-a-thread pattern already used by
|
|
``drive_tasks.py`` for Drive sync). Importing this module must never require
|
|
a broker connection — worker processes call ``celery_app.worker_main`` /
|
|
``-A llm_be worker``, everything else just imports ``celery_app`` to get
|
|
``@celery_app.task`` decorators registered.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
from celery import Celery
|
|
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "llm_be.settings")
|
|
|
|
celery_app = Celery("llm_be")
|
|
celery_app.config_from_object("django.conf:settings", namespace="CELERY")
|
|
celery_app.autodiscover_tasks()
|