From a02f038557add43bf5feb3da4561a8ff1569d7d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Fri, 5 Jun 2026 10:31:58 +0000 Subject: [PATCH] Add src/deep_agents_from_scratch/state.py --- src/deep_agents_from_scratch/state.py | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/deep_agents_from_scratch/state.py diff --git a/src/deep_agents_from_scratch/state.py b/src/deep_agents_from_scratch/state.py new file mode 100644 index 0000000..d67dd55 --- /dev/null +++ b/src/deep_agents_from_scratch/state.py @@ -0,0 +1,38 @@ +"""State definition for the Deep Agent. + +This module defines a lightweight dataclass that will be used as the +state for the :class:`StateGraph`. The state keeps the conversation +history, a virtual file system, and intermediate values produced by +the graph nodes. +""" + +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import Dict, List, Any + +from langchain_core.messages import BaseMessage + +@dataclass +class DeepAgentState: + """State used by the StateGraph. + + Attributes + ---------- + messages: List[BaseMessage] + The conversation messages. + files: Dict[str, str] + Virtual file system: mapping filename -> content. + query: str | None + Current search query. + search_results: List[Dict[str, Any]] + Raw search results from Tavily. + summaries: List[str] + Summaries of each search result. + """ + + messages: List[BaseMessage] = field(default_factory=list) + files: Dict[str, str] = field(default_factory=dict) + query: str | None = None + search_results: List[Dict[str, Any]] = field(default_factory=list) + summaries: List[str] = field(default_factory=list) \ No newline at end of file