Resolution favours main for all conflicts (new orchestrator shape with artifacts/file_names/conversation_history/resume_with, WorkflowOutcome enum, RAG, ledger agent, deleted engine/config/.env.example). Re-wires our three form-fill agents (FormAnalyserAgent, FormFillerAgent, DocumentExtractorAgent) into the new app layout: - contracts/__init__.py: adds form-fill exports to __all__ - api/dependencies.py: adds get_form_analyser_agent / get_form_filler_agent / get_document_extractor_agent - api/app.py: instantiates the three agents in lifespan and registers form_fill_router - api/routes/__init__.py: exports form_fill_router - tests/test_stirling_api.py: imports and registers form-fill stubs - tests/test_stirling_contracts.py: adds back KnowledgeUpdateResponse discriminator test Form fill remains accessible via its own endpoints (/api/v1/form/ai/analyse, /fill-batch, /extract). Not wired as an orchestrator delegate — following main's pattern where orchestrator only routes pdf_edit/pdf_question/user_spec /math_auditor. Follow-ups still needed: - Thread conversation_history into form-fill agent prompts - Align form-fill response outcomes with WorkflowOutcome enum - Decide whether engine should return ToolOperationStep plans (main's new pattern per #6116) or keep returning fill values directly All 127 engine tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
66 lines
1.7 KiB
Python
66 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
from fastapi import Request
|
|
|
|
from stirling.agents import (
|
|
DocumentExtractorAgent,
|
|
ExecutionPlanningAgent,
|
|
FormAnalyserAgent,
|
|
FormFillerAgent,
|
|
OrchestratorAgent,
|
|
PdfEditAgent,
|
|
PdfQuestionAgent,
|
|
UserSpecAgent,
|
|
)
|
|
from stirling.agents.ledger import MathAuditorAgent
|
|
from stirling.rag import RagService
|
|
from stirling.services import AppRuntime
|
|
|
|
|
|
def get_runtime(request: Request) -> AppRuntime:
|
|
return request.app.state.runtime
|
|
|
|
|
|
def get_orchestrator_agent(request: Request) -> OrchestratorAgent:
|
|
return request.app.state.orchestrator_agent
|
|
|
|
|
|
def get_pdf_edit_agent(request: Request) -> PdfEditAgent:
|
|
return request.app.state.pdf_edit_agent
|
|
|
|
|
|
def get_pdf_question_agent(request: Request) -> PdfQuestionAgent:
|
|
return request.app.state.pdf_question_agent
|
|
|
|
|
|
def get_user_spec_agent(request: Request) -> UserSpecAgent:
|
|
return request.app.state.user_spec_agent
|
|
|
|
|
|
def get_execution_planning_agent(request: Request) -> ExecutionPlanningAgent:
|
|
return request.app.state.execution_planning_agent
|
|
|
|
|
|
def get_rag_service(request: Request) -> RagService:
|
|
return request.app.state.runtime.rag_service
|
|
|
|
|
|
def get_rag_embedding_model(request: Request) -> str:
|
|
return request.app.state.runtime.settings.rag_embedding_model
|
|
|
|
|
|
def get_math_auditor_agent(request: Request) -> MathAuditorAgent:
|
|
return request.app.state.math_auditor_agent
|
|
|
|
|
|
def get_form_analyser_agent(request: Request) -> FormAnalyserAgent:
|
|
return request.app.state.form_analyser_agent
|
|
|
|
|
|
def get_form_filler_agent(request: Request) -> FormFillerAgent:
|
|
return request.app.state.form_filler_agent
|
|
|
|
|
|
def get_document_extractor_agent(request: Request) -> DocumentExtractorAgent:
|
|
return request.app.state.document_extractor_agent
|