From ac383d4452a41d9eb060ad84e7f97da9d331686e Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Sun, 20 Jul 2025 16:14:52 +0100 Subject: [PATCH] Agent working --- .../trustgraph/agent/react/agent_manager.py | 14 +++++++++----- trustgraph-flow/trustgraph/agent/react/service.py | 5 ++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/trustgraph-flow/trustgraph/agent/react/agent_manager.py b/trustgraph-flow/trustgraph/agent/react/agent_manager.py index 82e73555..33b32216 100644 --- a/trustgraph-flow/trustgraph/agent/react/agent_manager.py +++ b/trustgraph-flow/trustgraph/agent/react/agent_manager.py @@ -80,11 +80,12 @@ class AgentManager: i += 1 # Try to parse as JSON - try: - final_answer = json.loads(json_text) - except json.JSONDecodeError: - # Not valid JSON, treat as regular text - final_answer = json_text + # try: + # final_answer = json.loads(json_text) + # except json.JSONDecodeError: + # # Not valid JSON, treat as regular text + # final_answer = json_text + final_answer = json_text else: # Regular text answer while i < len(lines): @@ -263,6 +264,9 @@ class AgentManager: if isinstance(resp, str): resp = resp.strip() + else: + resp = str(resp) + resp = resp.strip() logger.info(f"resp: {resp}") diff --git a/trustgraph-flow/trustgraph/agent/react/service.py b/trustgraph-flow/trustgraph/agent/react/service.py index 3f032ef6..d2a0d41c 100755 --- a/trustgraph-flow/trustgraph/agent/react/service.py +++ b/trustgraph-flow/trustgraph/agent/react/service.py @@ -6,6 +6,10 @@ import json import re import sys import functools +import logging + +logging.basicConfig(level=logging.DEBUG) +logger = logging.getLogger(__name__) from ... base import AgentService, TextCompletionClientSpec, PromptClientSpec from ... base import GraphRagClientSpec, ToolClientSpec @@ -297,6 +301,5 @@ class Processor(AgentService): ) def run(): - Processor.launch(default_ident, __doc__)