Getting started with TrustGraph command-line tools

Description

Learn to use TrustGraph command-line tools for document processing and knowledge graph operations

Difficulty

Beginner

Duration

5 min

You will need
  • A running TrustGraph deployment
  • Basic command-line familiarity
Goal

Learn to use TrustGraph command-line tools for common tasks and automation.

Command-line tools installation

The TrustGraph CLI tools are provided in the trustgraph-cli Python package.

The CLI tools version should match your deployed TrustGraph version. Check your deployment version and install the corresponding CLI version.

pip install trustgraph-cli==1.8.10

Common CLI arguments

Most TrustGraph CLI tools accept these common arguments:

  • -u, --api-url API_URL - API URL (default: http://localhost:8088/)
  • -t, --token TOKEN - Authentication token (default: $TRUSTGRAPH_TOKEN environment variable)

Example using custom API URL:

tg-show-flows -u http://my-trustgraph-host:8088/

Example using authentication token:

export TRUSTGRAPH_TOKEN="your-token-here"
tg-show-flows

Or pass the token directly:

tg-show-flows -t "your-token-here"

The deployment patterns used in the deployment access the TrustGraph cluster at localhost. Docker/Podman compose expose internal service ports on localhost, and the Kubernetes port-forward commands also expose services on localhost. In this configuration, the default works, and the URL does not need to be specified.

If an API gateway key is provisioned when the system is deployed, this needs to be specified with command-line tools in order to authenticate. If no gateway key is provided, then no token needs to be provided.

Example commands

Here are a few key commands to get started:

View running flows:

tg-show-flows

Shows all active processing flows with their configurations.

List documents in the library:

tg-show-library-documents

Displays all documents that have been added to the library.

Query the LLM directly:

tg-invoke-llm "You are a helpful assistant" "What is 2+2?"

Sends a direct request to the LLM.

Query using Graph RAG:

tg-invoke-graph-rag -q "Tell me about cats"

Retrieves relevant knowledge graph information to answer questions.

For detailed documentation on these and many more commands, see Command-line document management.