15
15
from .outreach_social_tool import OutreachSocialTool
16
16
from .agent_permit import PermitSearchTool
17
17
from .schedule_tool import ScheduleTool
18
+ from .budget_tool import BudgetTool
18
19
19
20
resourse_search_tool = SearchTool ()
20
21
outreach_social_tool = OutreachSocialTool ()
21
22
schedule_tool = ScheduleTool ()
23
+ budget_tool = BudgetTool ()
22
24
23
- members = ["Resources" , "Social_Outreach" , "Volunteer_Outreach" , "Schedule" , "Permits" ]
25
+ members = ["Budget" , " Resources" , "Social_Outreach" , "Volunteer_Outreach" , "Schedule" , "Permits" ]
24
26
options = members + ["FINISH" ]
25
27
26
28
# Our team supervisor is an LLM node. It just picks the next agent to process
154
156
"- Temporary Event Permit: Authorizes use of public space for the event.\n "
155
157
)
156
158
159
+ budget_prompt = """You are an expert budget planning assistant specializing in all types of events. When a user asks about budget allocation:
160
+
161
+ 1. Use the calculate_budget_breakdown tool to get the budget amount and event type
162
+ 2. Based on the event type, first determine ALL relevant budget categories that would be needed. Consider:
163
+ - The specific nature and purpose of the event
164
+ - Standard requirements for this type of event
165
+ - Special equipment or resources typically needed
166
+ - Both essential and optional components
167
+
168
+ 3. For each identified category:
169
+ - Assign an appropriate percentage based on importance and typical costs
170
+ - Calculate the actual dollar amount
171
+
172
+ 4. Your response should:
173
+ - List all relevant budget categories specific to the event type
174
+ - Show percentage and dollar amount for each category
175
+ - Ensure percentages sum to exactly 100%
176
+ - Group related items logically
177
+
178
+ Remember that categories should be specifically tailored to the exact event type provided, not using generic templates.
179
+ Only output the answer, no other text.
180
+ If you need any clarification about the event type or special requirements, ask the user.
181
+ """
182
+
157
183
prompt = ChatPromptTemplate .from_messages (
158
184
[
159
185
("system" , system_prompt ),
@@ -270,6 +296,23 @@ def permit_node(state: dict) -> Command[str]:
270
296
goto = "Supervisor" ,
271
297
)
272
298
299
+ budget_agent = create_react_agent (
300
+ llm ,
301
+ tools = [budget_tool ],
302
+ prompt = budget_prompt
303
+ )
304
+
305
+ def budget_node (state : State ) -> Command [Literal ["Supervisor" ]]:
306
+ result = budget_agent .invoke (state )
307
+ return Command (
308
+ update = {
309
+ "messages" : [
310
+ HumanMessage (content = result ["messages" ][- 1 ].content , name = "Budget" )
311
+ ]
312
+ },
313
+ goto = "Supervisor" ,
314
+ )
315
+
273
316
def supervisor_node (state : State ) -> Command [Literal [* members , "__end__" ]]:
274
317
messages = [
275
318
{"role" : "system" , "content" : system_prompt },
@@ -291,6 +334,7 @@ def initialize_graph():
291
334
builder .add_node ("Volunteer_Outreach" , outreach_volunteer_node )
292
335
builder .add_node ("Schedule" , schedule_node )
293
336
builder .add_node ("Permits" , permit_node )
337
+ builder .add_node ("Budget" , budget_node )
294
338
builder .set_entry_point ("Supervisor" )
295
339
return builder .compile ()
296
340
0 commit comments