Quick Start
CLI Installation
The Invariant CLI lets you interact with Invariant from your terminal. Use it for automation, scripting, and direct access to core features.
Installing from pip
pip install invariant-client
Installing from source
git clone https://github.com/InvariantTech/client
cd client
pip install -e .
Verify your installation
Verify the CLI is installed and working:
invariant --version
# client: vX.Y.Z
# server: vA.B.C
If installed from source, use:
poetry run invariant --version
Account Setup
Follow this link to Create a free account. Your Invariant account will give you access to the Invariant analysis engine.
CLI Authentication
Authenticate your CLI session:
invariant login
This prints a login URL. Open it in your browser and sign in. Never share the login code with anyone. After authentication, you'll see:
Logged in as your-email@example.com (tenant=your-organization-name).
Your session is now active.
Session expiry
CLI sessions expire after a period of inactivity or 24 hours. If your session expires, just run invariant login
again.
Running an example snapshot
-
Download the codelab solution directory and move into that directory.
git clone https://github.com/InvariantTech/codelab_solution
cd codelab_solution -
Log in to your Invariant account on the CLI using the
invariant login
command.invariant login
-
Then invoke the
invariant run
command to upload the snapshot to Invariantinvariant run
-
You should see an output that looks like the following.
$ invariant run
Uploading snapshot...
Processing... (adf11172-9f8a-4333-b7c7-f9f0ecefe8d9)
Analysis complete.
╭───────────────────────┬────────╮
│ Network Information │ Rows │
├───────────────────────┼────────┤
│ nodes │ 12 │
│ interfaces │ 94 │
│ named_structures │ 66 │
│ defined_structures │ 350 │
│ referenced_structures │ 349 │
│ unused_structures │ 5 │
│ vlan_properties │ 12 │
│ hsrp_properties │ 0 │
│ mlag_properties │ 0 │
│ ip_owners │ 51 │
│ undefined_references │ 0 │
│ vrrp_properties │ 8 │
╰───────────────────────┴ ────────╯
╭───────────────┬────────╮
│ Topology │ Rows │
├───────────────┼────────┤
│ edges │ 42 │
│ layer_1_edges │ 0 │
│ layer_3_edges │ 42 │
│ network_map │ 1 │
╰───────────────┴────────╯
╭────────────────────────────┬────────╮
│ Routing │ Rows │
├────────────────────────────┼────────┤
│ routes │ 270 │
│ bgp_process_config │ 4 │
│ bgp_peer_config │ 8 │
│ bgp_session_compatibility │ 8 │
│ bgp_session_status │ 8 │
│ bgp_edges │ 8 │
│ bgp_ribs │ 8 │
│ ospf_process_config │ 6 │
│ ospf_interface_config │ 36 │
│ ospf_area_config │ 6 │
│ ospf_session_compatibility │ 20 │
╰────────────────────────────┴────────╯
╭───────────────────┬────────╮
│ Setup │ Rows │
├───────────────────┼────────┤
│ unconnected_nodes │ 0 │
│ ignored_lines │ 32 │
│ file_parse_status │ 9 │
│ parse_warnings │ 59 │
│ errors │ 0 │
╰───────────────────┴────────╯
╭────────────────────────┬────────╮
│ Inconsistent Traffic │ Rows │
├────────────────────────┼────────┤
│ subnet_multipath │ 0 │
│ loopback_multipath │ 0 │
╰────────────────────────┴────────╯
╭──────────┬────────╮
│ Probes │ Rows │
├──────────┼────────┤
│ probes │ 6 │
╰──────────┴────────╯
╭──────────────────────────────────────┬────────╮
│ Access Policy │ Rows │
├──────────────────────────────────────┼────────┤
│ critical_flows_ok │ 1 │
│ critical_flows_violations │ 0 │
│ critical_flows_violations_unenforced │ 0 │
│ critical_flows_skipped │ 0 │
│ critical_flows_details │ 3 │
│ critical_flows_logs │ 1 │
│ policy_ok │ 3 │
│ policy_violations │ 0 │
│ policy_violations_unenforced │ 0 │
│ policy_skipped │ 0 │
│ policy_details │ 37 │
│ policy_logs │ 3 │
╰──────────────────────────────────────┴────────╯
Run 'invariant show <file> --snapshot adf11172-9f8a-4333-b7c7-f9f0ecefe8d9' to examine any file,
or run 'export INVARIANT_SNAPSHOT=adf11172-9f8a-4333-b7c7-f9f0ecefe8d9' to skip the --snapshot argument.
You are now ready to begin the Tutorial
Sync Agent
To configure the Invariant Sync Agent, follow the steps in Automation > Invariant Sync Agent
LLM Integration
To use Invariant from or with an LLM, follow the steps in Cookbooks > LLM Integration