mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 18:44:05 +02:00
# Description of Changes Redesign the Python AI engine to be properly agentic and make use of `pydantic-ai` instead of `langchain` for correctness and ergonomics. This should be a good foundation for us to build our AI engine on going forwards.
20 lines
641 B
Python
20 lines
641 B
Python
from __future__ import annotations
|
|
|
|
from typing import Annotated
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from stirling.agents import ExecutionPlanningAgent
|
|
from stirling.api.dependencies import get_execution_planning_agent
|
|
from stirling.contracts import AgentExecutionRequest, NextExecutionAction
|
|
|
|
router = APIRouter(prefix="/api/v1/agents", tags=["agents"])
|
|
|
|
|
|
@router.post("/next-action", response_model=NextExecutionAction)
|
|
async def next_action(
|
|
request: AgentExecutionRequest,
|
|
agent: Annotated[ExecutionPlanningAgent, Depends(get_execution_planning_agent)],
|
|
) -> NextExecutionAction:
|
|
return await agent.next_action(request)
|