|
| 1 | +--- |
| 2 | +title: Introduction to command-line tools |
| 3 | +nav_order: 2.2 |
| 4 | +parent: How-to Guides |
| 5 | +grand_parent: TrustGraph Documentation |
| 6 | +review_date: 2026-08-01 |
| 7 | +guide_category: |
| 8 | + - Building with TrustGraph |
| 9 | +guide_category_order: 2 |
| 10 | +guide_description: Learn to use TrustGraph command-line tools for document processing and knowledge graph operations |
| 11 | +guide_difficulty: beginner |
| 12 | +guide_time: 5 min |
| 13 | +guide_emoji: 💻 |
| 14 | +guide_banner: /../cli.jpg |
| 15 | +guide_labels: |
| 16 | + - CLI |
| 17 | + - Command-line |
| 18 | +--- |
| 19 | + |
| 20 | +# Getting started with TrustGraph command-line tools |
| 21 | + |
| 22 | +{% capture requirements %} |
| 23 | +<ul style="margin: 0; padding-left: 20px;"> |
| 24 | +<li>A running TrustGraph deployment</li> |
| 25 | +<li>Basic command-line familiarity</li> |
| 26 | +</ul> |
| 27 | +{% endcapture %} |
| 28 | + |
| 29 | +{% include guide/guide-intro-box.html |
| 30 | + description=page.guide_description |
| 31 | + difficulty=page.guide_difficulty |
| 32 | + duration=page.guide_time |
| 33 | + you_will_need=requirements |
| 34 | + goal="Learn to use TrustGraph command-line tools for common tasks and automation." |
| 35 | +%} |
| 36 | + |
| 37 | +## Command-line tools installation |
| 38 | + |
| 39 | +The TrustGraph CLI tools are provided in the `trustgraph-cli` Python package. |
| 40 | + |
| 41 | +The CLI tools version should match your deployed TrustGraph version. Check your deployment version and install the corresponding CLI version. |
| 42 | + |
| 43 | +{% capture pip_install_version %} |
| 44 | +```bash |
| 45 | +pip install trustgraph-cli==1.8.10 |
| 46 | +``` |
| 47 | +{% endcapture %} |
| 48 | + |
| 49 | +{% capture uv_install_version %} |
| 50 | +```bash |
| 51 | +uv pip install trustgraph-cli==1.8.10 |
| 52 | +``` |
| 53 | +{% endcapture %} |
| 54 | + |
| 55 | +{% capture poetry_install_version %} |
| 56 | +```bash |
| 57 | + |
| 58 | +``` |
| 59 | +{% endcapture %} |
| 60 | + |
| 61 | +{% include code_tabs.html |
| 62 | + tabs="pip,uv,poetry" |
| 63 | + content1=pip_install_version |
| 64 | + content2=uv_install_version |
| 65 | + content3=poetry_install_version |
| 66 | +%} |
| 67 | + |
| 68 | +## Common CLI arguments |
| 69 | + |
| 70 | +Most TrustGraph CLI tools accept these common arguments: |
| 71 | + |
| 72 | +- `-u, --api-url API_URL` - API URL (default: `http://localhost:8088/`) |
| 73 | +- `-t, --token TOKEN` - Authentication token (default: `$TRUSTGRAPH_TOKEN` environment variable) |
| 74 | + |
| 75 | +Example using custom API URL: |
| 76 | +```bash |
| 77 | +tg-show-flows -u http://my-trustgraph-host:8088/ |
| 78 | +``` |
| 79 | + |
| 80 | +Example using authentication token: |
| 81 | +```bash |
| 82 | +export TRUSTGRAPH_TOKEN="your-token-here" |
| 83 | +tg-show-flows |
| 84 | +``` |
| 85 | + |
| 86 | +Or pass the token directly: |
| 87 | +```bash |
| 88 | +tg-show-flows -t "your-token-here" |
| 89 | +``` |
| 90 | + |
| 91 | +The deployment patterns used in the deployment access the TrustGraph cluster |
| 92 | +at `localhost`. Docker/Podman compose expose internal service ports on |
| 93 | +`localhost`, and the Kubernetes port-forward commands also expose services |
| 94 | +on `localhost`. In this configuration, the default works, and the URL does |
| 95 | +not need to be specified. |
| 96 | + |
| 97 | +If an API gateway key is provisioned when the system is deployed, this needs |
| 98 | +to be specified with command-line tools in order to authenticate. If no |
| 99 | +gateway key is provided, then no token needs to be provided. |
| 100 | + |
| 101 | +## Example commands |
| 102 | + |
| 103 | +Here are a few key commands to get started: |
| 104 | + |
| 105 | +**View running flows:** |
| 106 | +```bash |
| 107 | +tg-show-flows |
| 108 | +``` |
| 109 | + |
| 110 | +Shows all active processing flows with their configurations. |
| 111 | + |
| 112 | +**List documents in the library:** |
| 113 | +```bash |
| 114 | +tg-show-library-documents |
| 115 | +``` |
| 116 | + |
| 117 | +Displays all documents that have been added to the library. |
| 118 | + |
| 119 | +**Query the LLM directly:** |
| 120 | +```bash |
| 121 | +tg-invoke-llm "You are a helpful assistant" "What is 2+2?" |
| 122 | +``` |
| 123 | + |
| 124 | +Sends a direct request to the LLM. |
| 125 | + |
| 126 | +**Query using Graph RAG:** |
| 127 | +```bash |
| 128 | +tg-invoke-graph-rag -q "Tell me about cats" |
| 129 | +``` |
| 130 | + |
| 131 | +Retrieves relevant knowledge graph information to answer questions. |
| 132 | + |
| 133 | +For detailed documentation on these and many more commands, see [Command-line document management](document-management-cli). |
0 commit comments