SurfSense/surfsense_backend/app/agents/researcher/qna_agent/state.py

28 lines
782 B
Python
Raw Normal View History

"""Define the state structures for the agent."""
2025-06-03 00:10:35 -07:00
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
2025-06-03 00:10:35 -07:00
from sqlalchemy.ext.asyncio import AsyncSession
2025-06-03 00:10:35 -07:00
@dataclass
class State:
"""Defines the dynamic state for the Q&A agent during execution.
This state tracks the database session, chat history, and the outputs
2025-06-03 00:10:35 -07:00
generated by the agent's nodes during question answering.
See: https://langchain-ai.github.io/langgraph/concepts/low_level/#state
for more information.
"""
# Runtime context
db_session: AsyncSession
chat_history: list[Any] | None = field(default_factory=list)
2025-06-03 00:10:35 -07:00
# OUTPUT: Populated by agent nodes
reranked_documents: list[Any] | None = None
final_answer: str | None = None