Release/v1.2 (#457)

* Bump setup.py versions for 1.1

* PoC MCP server (#419)

* Very initial MCP server PoC for TrustGraph

* Put service on port 8000

* Add MCP container and packages to buildout

* Update docs for API/CLI changes in 1.0 (#421)

* Update some API basics for the 0.23/1.0 API change

* Add MCP container push (#425)

* Add command args to the MCP server (#426)

* Host and port parameters

* Added websocket arg

* More docs

* MCP client support (#427)

- MCP client service
- Tool request/response schema
- API gateway support for mcp-tool
- Message translation for tool request & response
- Make mcp-tool using configuration service for information
  about where the MCP services are.

* Feature/react call mcp (#428)

Key Features

  - MCP Tool Integration: Added core MCP tool support with ToolClientSpec and ToolClient classes
  - API Enhancement: New mcp_tool method for flow-specific tool invocation
  - CLI Tooling: New tg-invoke-mcp-tool command for testing MCP integration
  - React Agent Enhancement: Fixed and improved multi-tool invocation capabilities
  - Tool Management: Enhanced CLI for tool configuration and management

Changes

  - Added MCP tool invocation to API with flow-specific integration
  - Implemented ToolClientSpec and ToolClient for tool call handling
  - Updated agent-manager-react to invoke MCP tools with configurable types
  - Enhanced CLI with new commands and improved help text
  - Added comprehensive documentation for new CLI commands
  - Improved tool configuration management

Testing

  - Added tg-invoke-mcp-tool CLI command for isolated MCP integration testing
  - Enhanced agent capability to invoke multiple tools simultaneously

* Test suite executed from CI pipeline (#433)

* Test strategy & test cases

* Unit tests

* Integration tests

* Extending test coverage (#434)

* Contract tests

* Testing embeedings

* Agent unit tests

* Knowledge pipeline tests

* Turn on contract tests

* Increase storage test coverage (#435)

* Fixing storage and adding tests

* PR pipeline only runs quick tests

* Empty configuration is returned as empty list, previously was not in response (#436)

* Update config util to take files as well as command-line text (#437)

* Updated CLI invocation and config model for tools and mcp (#438)

* Updated CLI invocation and config model for tools and mcp

* CLI anomalies

* Tweaked the MCP tool implementation for new model

* Update agent implementation to match the new model

* Fix agent tools, now all tested

* Fixed integration tests

* Fix MCP delete tool params

* Update Python deps to 1.2

* Update to enable knowledge extraction using the agent framework (#439)

* Implement KG extraction agent (kg-extract-agent)

* Using ReAct framework (agent-manager-react)
 
* ReAct manager had an issue when emitting JSON, which conflicts which ReAct manager's own JSON messages, so refactored ReAct manager to use traditional ReAct messages, non-JSON structure.
 
* Minor refactor to take the prompt template client out of prompt-template so it can be more readily used by other modules. kg-extract-agent uses this framework.

* Migrate from setup.py to pyproject.toml (#440)

* Converted setup.py to pyproject.toml

* Modern package infrastructure as recommended by py docs

* Install missing build deps (#441)

* Install missing build deps (#442)

* Implement logging strategy (#444)

* Logging strategy and convert all prints() to logging invocations

* Fix/startup failure (#445)

* Fix loggin startup problems

* Fix logging startup problems (#446)

* Fix logging startup problems (#447)

* Fixed Mistral OCR to use current API (#448)

* Fixed Mistral OCR to use current API

* Added PDF decoder tests

* Fix Mistral OCR ident to be standard pdf-decoder (#450)

* Fix Mistral OCR ident to be standard pdf-decoder

* Correct test

* Schema structure refactor (#451)

* Write schema refactor spec

* Implemented schema refactor spec

* Structure data mvp (#452)

* Structured data tech spec

* Architecture principles

* New schemas

* Updated schemas and specs

* Object extractor

* Add .coveragerc

* New tests

* Cassandra object storage

* Trying to object extraction working, issues exist

* Validate librarian collection (#453)

* Fix token chunker, broken API invocation (#454)

* Fix token chunker, broken API invocation (#455)

* Knowledge load utility CLI (#456)

* Knowledge loader

* More tests
This commit is contained in:
cybermaggedon 2025-08-18 20:56:09 +01:00 committed by GitHub
parent c85ba197be
commit 89be656990
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
509 changed files with 49632 additions and 5159 deletions

View file

@ -9,6 +9,9 @@ from ssl import SSLContext, PROTOCOL_TLSv1_2
import uuid
import time
import asyncio
import logging
logger = logging.getLogger(__name__)
class ConfigTableStore:
@ -19,7 +22,7 @@ class ConfigTableStore:
self.keyspace = keyspace
print("Connecting to Cassandra...", flush=True)
logger.info("Connecting to Cassandra...")
if cassandra_user and cassandra_password:
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
@ -36,7 +39,7 @@ class ConfigTableStore:
self.cassandra = self.cluster.connect()
print("Connected.", flush=True)
logger.info("Connected.")
self.ensure_cassandra_schema()
@ -44,9 +47,9 @@ class ConfigTableStore:
def ensure_cassandra_schema(self):
print("Ensure Cassandra schema...", flush=True)
logger.debug("Ensure Cassandra schema...")
print("Keyspace...", flush=True)
logger.debug("Keyspace...")
# FIXME: Replication factor should be configurable
self.cassandra.execute(f"""
@ -59,7 +62,7 @@ class ConfigTableStore:
self.cassandra.set_keyspace(self.keyspace)
print("config table...", flush=True)
logger.debug("config table...")
self.cassandra.execute("""
CREATE TABLE IF NOT EXISTS config (
@ -70,7 +73,7 @@ class ConfigTableStore:
);
""");
print("version table...", flush=True)
logger.debug("version table...")
self.cassandra.execute("""
CREATE TABLE IF NOT EXISTS version (
@ -84,14 +87,14 @@ class ConfigTableStore:
SELECT version FROM version
""")
print("ensure version...", flush=True)
logger.debug("ensure version...")
self.cassandra.execute("""
UPDATE version set version = version + 0
WHERE id = 'version'
""")
print("Cassandra schema OK.", flush=True)
logger.info("Cassandra schema OK.")
async def inc_version(self):
@ -160,10 +163,8 @@ class ConfigTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
async def get_value(self, cls, key):
@ -180,10 +181,8 @@ class ConfigTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
for row in resp:
return row[0]
@ -205,10 +204,8 @@ class ConfigTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
return [
[row[0], row[1]]
@ -230,10 +227,8 @@ class ConfigTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
return [
row[0] for row in resp
@ -254,10 +249,8 @@ class ConfigTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
return [
(row[0], row[1], row[2])
@ -279,10 +272,8 @@ class ConfigTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
return [
row[0] for row in resp
@ -302,8 +293,6 @@ class ConfigTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)

View file

@ -9,6 +9,9 @@ from ssl import SSLContext, PROTOCOL_TLSv1_2
import uuid
import time
import asyncio
import logging
logger = logging.getLogger(__name__)
class KnowledgeTableStore:
@ -19,7 +22,7 @@ class KnowledgeTableStore:
self.keyspace = keyspace
print("Connecting to Cassandra...", flush=True)
logger.info("Connecting to Cassandra...")
if cassandra_user and cassandra_password:
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
@ -36,7 +39,7 @@ class KnowledgeTableStore:
self.cassandra = self.cluster.connect()
print("Connected.", flush=True)
logger.info("Connected.")
self.ensure_cassandra_schema()
@ -44,9 +47,9 @@ class KnowledgeTableStore:
def ensure_cassandra_schema(self):
print("Ensure Cassandra schema...", flush=True)
logger.debug("Ensure Cassandra schema...")
print("Keyspace...", flush=True)
logger.debug("Keyspace...")
# FIXME: Replication factor should be configurable
self.cassandra.execute(f"""
@ -59,7 +62,7 @@ class KnowledgeTableStore:
self.cassandra.set_keyspace(self.keyspace)
print("triples table...", flush=True)
logger.debug("triples table...")
self.cassandra.execute("""
CREATE TABLE IF NOT EXISTS triples (
@ -77,7 +80,7 @@ class KnowledgeTableStore:
);
""");
print("graph_embeddings table...", flush=True)
logger.debug("graph_embeddings table...")
self.cassandra.execute("""
create table if not exists graph_embeddings (
@ -103,7 +106,7 @@ class KnowledgeTableStore:
graph_embeddings ( user );
""");
print("document_embeddings table...", flush=True)
logger.debug("document_embeddings table...")
self.cassandra.execute("""
create table if not exists document_embeddings (
@ -129,7 +132,7 @@ class KnowledgeTableStore:
document_embeddings ( user );
""");
print("Cassandra schema OK.", flush=True)
logger.info("Cassandra schema OK.")
def prepare_statements(self):
@ -231,10 +234,8 @@ class KnowledgeTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
async def add_graph_embeddings(self, m):
@ -276,10 +277,8 @@ class KnowledgeTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
async def add_document_embeddings(self, m):
@ -321,14 +320,12 @@ class KnowledgeTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
async def list_kg_cores(self, user):
print("List kg cores...")
logger.debug("List kg cores...")
while True:
@ -342,10 +339,8 @@ class KnowledgeTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
lst = [
@ -353,13 +348,13 @@ class KnowledgeTableStore:
for row in resp
]
print("Done")
logger.debug("Done")
return lst
async def delete_kg_core(self, user, document_id):
print("Delete kg cores...")
logger.debug("Delete kg cores...")
while True:
@ -373,10 +368,8 @@ class KnowledgeTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
while True:
@ -390,14 +383,12 @@ class KnowledgeTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
async def get_triples(self, user, document_id, receiver):
print("Get triples...")
logger.debug("Get triples...")
while True:
@ -411,10 +402,8 @@ class KnowledgeTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
for row in resp:
@ -451,11 +440,11 @@ class KnowledgeTableStore:
)
)
print("Done")
logger.debug("Done")
async def get_graph_embeddings(self, user, document_id, receiver):
print("Get GE...")
logger.debug("Get GE...")
while True:
@ -469,10 +458,8 @@ class KnowledgeTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
for row in resp:
@ -508,5 +495,5 @@ class KnowledgeTableStore:
)
)
print("Done")
logger.debug("Done")

View file

@ -13,6 +13,9 @@ from ssl import SSLContext, PROTOCOL_TLSv1_2
import uuid
import time
import asyncio
import logging
logger = logging.getLogger(__name__)
class LibraryTableStore:
@ -23,7 +26,7 @@ class LibraryTableStore:
self.keyspace = keyspace
print("Connecting to Cassandra...", flush=True)
logger.info("Connecting to Cassandra...")
if cassandra_user and cassandra_password:
ssl_context = SSLContext(PROTOCOL_TLSv1_2)
@ -40,7 +43,7 @@ class LibraryTableStore:
self.cassandra = self.cluster.connect()
print("Connected.", flush=True)
logger.info("Connected.")
self.ensure_cassandra_schema()
@ -48,9 +51,9 @@ class LibraryTableStore:
def ensure_cassandra_schema(self):
print("Ensure Cassandra schema...", flush=True)
logger.debug("Ensure Cassandra schema...")
print("Keyspace...", flush=True)
logger.debug("Keyspace...")
# FIXME: Replication factor should be configurable
self.cassandra.execute(f"""
@ -63,7 +66,7 @@ class LibraryTableStore:
self.cassandra.set_keyspace(self.keyspace)
print("document table...", flush=True)
logger.debug("document table...")
self.cassandra.execute("""
CREATE TABLE IF NOT EXISTS document (
@ -82,14 +85,14 @@ class LibraryTableStore:
);
""");
print("object index...", flush=True)
logger.debug("object index...")
self.cassandra.execute("""
CREATE INDEX IF NOT EXISTS document_object
ON document (object_id)
""");
print("processing table...", flush=True)
logger.debug("processing table...")
self.cassandra.execute("""
CREATE TABLE IF NOT EXISTS processing (
@ -104,7 +107,7 @@ class LibraryTableStore:
);
""");
print("Cassandra schema OK.", flush=True)
logger.info("Cassandra schema OK.")
def prepare_statements(self):
@ -204,7 +207,7 @@ class LibraryTableStore:
async def add_document(self, document, object_id):
print("Adding document", document.id, object_id)
logger.info(f"Adding document {document.id} {object_id}")
metadata = [
(
@ -231,16 +234,14 @@ class LibraryTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
print("Add complete", flush=True)
logger.debug("Add complete")
async def update_document(self, document):
print("Updating document", document.id)
logger.info(f"Updating document {document.id}")
metadata = [
(
@ -267,16 +268,14 @@ class LibraryTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
print("Update complete", flush=True)
logger.debug("Update complete")
async def remove_document(self, user, document_id):
print("Removing document", document_id)
logger.info(f"Removing document {document_id}")
while True:
@ -293,16 +292,14 @@ class LibraryTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
print("Delete complete", flush=True)
logger.debug("Delete complete")
async def list_documents(self, user):
print("List documents...")
logger.debug("List documents...")
while True:
@ -316,10 +313,8 @@ class LibraryTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
lst = [
@ -344,13 +339,13 @@ class LibraryTableStore:
for row in resp
]
print("Done")
logger.debug("Done")
return lst
async def get_document(self, user, id):
print("Get document")
logger.debug("Get document")
while True:
@ -364,10 +359,8 @@ class LibraryTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
for row in resp:
@ -390,14 +383,14 @@ class LibraryTableStore:
object_id = row[6],
)
print("Done")
logger.debug("Done")
return doc
raise RuntimeError("No such document row?")
async def get_document_object_id(self, user, id):
print("Get document obj ID")
logger.debug("Get document obj ID")
while True:
@ -411,14 +404,12 @@ class LibraryTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
for row in resp:
print("Done")
logger.debug("Done")
return row[6]
raise RuntimeError("No such document row?")
@ -440,7 +431,7 @@ class LibraryTableStore:
async def add_processing(self, processing):
print("Adding processing", processing.id)
logger.info(f"Adding processing {processing.id}")
while True:
@ -460,16 +451,14 @@ class LibraryTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
print("Add complete", flush=True)
logger.debug("Add complete")
async def remove_processing(self, user, processing_id):
print("Removing processing", processing_id)
logger.info(f"Removing processing {processing_id}")
while True:
@ -486,16 +475,14 @@ class LibraryTableStore:
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
print("Delete complete", flush=True)
logger.debug("Delete complete")
async def list_processing(self, user):
print("List processing objects")
logger.debug("List processing objects")
while True:
@ -509,10 +496,8 @@ class LibraryTableStore:
break
except Exception as e:
print("Exception:", type(e))
logger.error("Exception occurred", exc_info=True)
raise e
print(f"{e}, retry...", flush=True)
await asyncio.sleep(1)
lst = [
@ -528,7 +513,7 @@ class LibraryTableStore:
for row in resp
]
print("Done")
logger.debug("Done")
return lst