Add src/deep_agents_from_scratch/state.py
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user