andy88836's picture
Deploy MOFScreen-Agent FastAPI backend
e5bcce8 verified
Raw
History Blame Contribute Delete
1.01 kB
"""Screening workflow assembly for the MOF six-step pipeline."""
from agent import nodes
from agent.state import ScreeningState
class SimpleScreeningApp:
"""Small invoke-compatible workflow used when LangGraph is unavailable."""
def invoke(self, state: ScreeningState) -> ScreeningState:
current: ScreeningState = dict(state)
for node in (nodes.ingest_cif, nodes.six_step_screening_agent):
update = node(current)
current.update(update)
return current
def build_graph():
try:
from langgraph.graph import END, StateGraph
g = StateGraph(ScreeningState)
g.add_node("ingest_cif", nodes.ingest_cif)
g.add_node("six_step_screening", nodes.six_step_screening_agent)
g.set_entry_point("ingest_cif")
g.add_edge("ingest_cif", "six_step_screening")
g.add_edge("six_step_screening", END)
return g.compile()
except Exception:
return SimpleScreeningApp()
screening_app = build_graph()