Update app/agents/master_agent.py
Browse files
app/agents/master_agent.py
CHANGED
|
@@ -242,10 +242,14 @@ Remember: Use the user_id and session_id from the session context in your tool c
|
|
| 242 |
try:
|
| 243 |
import json
|
| 244 |
obs_dict = json.loads(observation)
|
| 245 |
-
if "loan_id" in obs_dict:
|
| 246 |
return obs_dict["loan_id"]
|
| 247 |
except:
|
| 248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
|
| 250 |
return None
|
| 251 |
|
|
|
|
| 242 |
try:
|
| 243 |
import json
|
| 244 |
obs_dict = json.loads(observation)
|
| 245 |
+
if obs_dict.get("success") and "loan_id" in obs_dict:
|
| 246 |
return obs_dict["loan_id"]
|
| 247 |
except:
|
| 248 |
+
# Try to find loan_id in text
|
| 249 |
+
import re
|
| 250 |
+
match = re.search(r'"loan_id"\s*:\s*"([^"]+)"', observation)
|
| 251 |
+
if match:
|
| 252 |
+
return match.group(1)
|
| 253 |
|
| 254 |
return None
|
| 255 |
|