2026-02-25 16:51:12 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
2026-03-03 15:29:46 +08:00
|
|
|
from typing import Any
|
2026-02-25 16:51:12 +08:00
|
|
|
from uuid import UUID
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
|
|
|
|
|
2026-03-03 15:29:46 +08:00
|
|
|
class RunAgentInput(BaseModel):
|
|
|
|
|
threadId: str
|
|
|
|
|
runId: str
|
|
|
|
|
parentRunId: str | None = None
|
|
|
|
|
state: dict[str, Any]
|
|
|
|
|
messages: list[dict[str, Any]]
|
|
|
|
|
tools: list[dict[str, Any]]
|
|
|
|
|
context: list[dict[str, Any]]
|
|
|
|
|
forwardedProps: dict[str, Any]
|
|
|
|
|
resume: dict[str, Any] | None = None
|
|
|
|
|
|
|
|
|
|
|
2026-02-25 16:51:12 +08:00
|
|
|
class AgentChatRunRequest(BaseModel):
|
|
|
|
|
message: str = Field(min_length=1, max_length=8000)
|
|
|
|
|
session_id: UUID | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AgentChatEvent(BaseModel):
|
|
|
|
|
type: str
|
|
|
|
|
run_id: str | None = None
|
|
|
|
|
message_id: str | None = None
|
|
|
|
|
delta: str | None = None
|
|
|
|
|
tool_name: str | None = None
|
|
|
|
|
result: str | None = None
|
|
|
|
|
output: str | None = None
|
|
|
|
|
error: str | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AgentChatRunResponse(BaseModel):
|
|
|
|
|
session_id: UUID
|
|
|
|
|
output: str
|
|
|
|
|
events: list[AgentChatEvent]
|