-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.py
More file actions
70 lines (50 loc) · 1.72 KB
/
graph.py
File metadata and controls
70 lines (50 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from typing import TypedDict
from langgraph.graph import StateGraph, END
from agents.jd_agent import run_jd_agent
from agents.resume_agent import run_resume_agent
from agents.fit_agent import run_fit_agent
from agents.writer_agent import run_writer_agent
from agents.reviewer_agent import run_reviewer_agent
class AgentState(TypedDict):
job_description: str
resume: str
jd_analysis: str
resume_analysis: str
fit_analysis: str
draft: str
final_answer: str
def jd_node(state):
result = run_jd_agent(state["job_description"])
return {"jd_analysis": result.content}
def resume_node(state):
result = run_resume_agent(state["resume"])
return {"resume_analysis": result.content}
def fit_node(state):
result = run_fit_agent(
state["jd_analysis"],
state["resume_analysis"]
)
return {"fit_analysis": result.content}
def writer_node(state):
result = run_writer_agent(state["fit_analysis"])
return {"draft": result.content}
def reviewer_node(state):
result = run_reviewer_agent(
state["draft"],
state["job_description"],
state["resume"],
)
return {"final_answer": result.content}
workflow = StateGraph(AgentState)
workflow.add_node("jd_agent", jd_node)
workflow.add_node("resume_agent", resume_node)
workflow.add_node("fit_agent", fit_node)
workflow.add_node("writer_agent", writer_node)
workflow.add_node("reviewer_agent", reviewer_node)
workflow.set_entry_point("jd_agent")
workflow.add_edge("jd_agent", "resume_agent")
workflow.add_edge("resume_agent", "fit_agent")
workflow.add_edge("fit_agent", "writer_agent")
workflow.add_edge("writer_agent", "reviewer_agent")
workflow.add_edge("reviewer_agent", END)
app = workflow.compile()