Bases: ABC
Base class for every agentic pattern in this library.
Subclasses MUST implement build() and run(). They MAY override diagram()
and explain() — both have sensible defaults.
Source code in src/agentic_architectures/architectures/base.py
| def __init__(self, llm: BaseChatModel | None = None, **kwargs: Any) -> None:
from agentic_architectures.llm.factory import get_llm
# Every architecture passes its leftover keywords here. Unknown ones used to be stored
# and ignored, so a misspelled option (grid_size for height/width) silently ran the
# default; now it is an error that names the option.
if kwargs:
raise TypeError(f"{type(self).__name__}() got unexpected keyword argument(s): {', '.join(sorted(kwargs))}")
self.llm = llm if llm is not None else get_llm()
self.config: dict[str, Any] = {}
|
build
abstractmethod
build() -> CompiledStateGraph
Compile and return the LangGraph for this architecture.
Source code in src/agentic_architectures/architectures/base.py
| @abstractmethod
def build(self) -> CompiledStateGraph:
"""Compile and return the LangGraph for this architecture."""
|
run
abstractmethod
run(task: str, **kwargs: Any) -> ArchitectureResult
Execute the architecture on a task and return a standardized result.
Source code in src/agentic_architectures/architectures/base.py
| @abstractmethod
def run(self, task: str, **kwargs: Any) -> ArchitectureResult:
"""Execute the architecture on a task and return a standardized result."""
|
diagram
Return a Mermaid diagram string for the compiled graph.
Source code in src/agentic_architectures/architectures/base.py
| def diagram(self) -> str:
"""Return a Mermaid diagram string for the compiled graph."""
from agentic_architectures.ui.diagram import graph_to_mermaid
return graph_to_mermaid(self.build())
|
explain
Return the theory section (markdown) for this architecture.
Source code in src/agentic_architectures/architectures/base.py
| def explain(self) -> str:
"""Return the theory section (markdown) for this architecture."""
return self.description or self.__doc__ or "(no description provided)"
|