Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -544,7 +544,13 @@ def get_agent_response(prompt: str, task_id: Optional[str]=None, thread_id: Opti
|
|
| 544 |
agent_name_get = type(AGENT_INSTANCE).__name__
|
| 545 |
logger.info(f"Agent ({agent_name_get}) processing. Task: {task_id or 'N/A'}. Thread: {thread_id_to_use}. Prompt: {prompt[:100]}...")
|
| 546 |
|
| 547 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 548 |
|
| 549 |
try:
|
| 550 |
if is_langgraph_agent_get:
|
|
|
|
| 544 |
agent_name_get = type(AGENT_INSTANCE).__name__
|
| 545 |
logger.info(f"Agent ({agent_name_get}) processing. Task: {task_id or 'N/A'}. Thread: {thread_id_to_use}. Prompt: {prompt[:100]}...")
|
| 546 |
|
| 547 |
+
# Detect LangGraph agent - either custom or from langgraph.prebuilt.create_react_agent
|
| 548 |
+
# Both return CompiledStateGraph with invoke() method that accepts messages
|
| 549 |
+
is_langgraph_agent_get = (
|
| 550 |
+
agent_name_get == 'CompiledStateGraph' or
|
| 551 |
+
(LANGGRAPH_FLAVOR_AVAILABLE and AGENT_INSTANCE and hasattr(AGENT_INSTANCE, 'graph') and hasattr(AGENT_INSTANCE, 'config_schema')) or
|
| 552 |
+
(hasattr(AGENT_INSTANCE, 'invoke') and hasattr(AGENT_INSTANCE, 'get_state'))
|
| 553 |
+
)
|
| 554 |
|
| 555 |
try:
|
| 556 |
if is_langgraph_agent_get:
|