Files
Stirling-PDF/engine/src/stirling/contracts/agent_drafts.py
T
James BruntonandGitHub f9575c06fb Add Java orchestrator to connect to the AI engine (#6003)
# Description of Changes
Add Java orchestration layer which can connect and go back and forth
with the AI engine to get results for the user. It's expected that the
AI engine will not be publicly available and this Java layer will always
be in front of it, to manage sessions and auth etc.
2026-04-09 08:04:38 +00:00

58 lines
1.4 KiB
Python

from __future__ import annotations
from typing import Annotated, Literal
from pydantic import Field
from stirling.models import ApiModel
from .agent_specs import AgentSpecStep
from .common import ConversationMessage, StepKind, WorkflowOutcome
from .pdf_edit import EditCannotDoResponse, EditClarificationRequest
class AgentDraftStep(ApiModel):
kind: Literal[StepKind.TOOL, StepKind.AI_TOOL]
title: str
description: str
class AgentDraft(ApiModel):
name: str
description: str
objective: str
steps: list[AgentSpecStep] = Field(default_factory=list)
class AgentDraftRequest(ApiModel):
user_message: str
conversation_history: list[ConversationMessage] = Field(default_factory=list)
class AgentDraftResponse(ApiModel):
outcome: Literal[WorkflowOutcome.DRAFT] = WorkflowOutcome.DRAFT
draft: AgentDraft
class AgentRevisionRequest(ApiModel):
user_message: str
conversation_history: list[ConversationMessage] = Field(default_factory=list)
current_draft: AgentDraft
class AgentRevisionResponse(ApiModel):
outcome: Literal[WorkflowOutcome.DRAFT] = WorkflowOutcome.DRAFT
draft: AgentDraft
AgentDraftWorkflowResponse = Annotated[
AgentDraftResponse | EditClarificationRequest | EditCannotDoResponse,
Field(discriminator="outcome"),
]
AgentRevisionWorkflowResponse = Annotated[
AgentRevisionResponse | EditClarificationRequest | EditCannotDoResponse,
Field(discriminator="outcome"),
]