CLI Tool

Metrics for humans and agents

A CLI built for both humans and coding agents. Claude Code, Codex, Devin, and other AI assistants can query your metrics and manage dashboards autonomously.

Quick install

With pip:

pip install metricly-cli

With uv:

uv tool install metricly-cli

Query from anywhere

Run metric queries from your terminal, scripts, or CI/CD pipelines. No browser required.

Agent-native design

Built for coding agents like Claude Code, Codex, and Devin. Structured output they can parse and act on.

Multiple output formats

JSON for agents, CSV for spreadsheets, YAML for config files, tables for humans.

CI/CD integration

Validate metrics in your pipeline. Catch data issues before they reach production.

Powerful commands

Query metrics, manage dashboards, and update your semantic layer from the terminal.

Authentication

metricly login

Authenticate via Google OAuth

metricly whoami

Show current user and organization

metricly org switch <id>

Switch to different organization

Querying

metricly query -m revenue -g month

Query revenue by month

metricly query -m revenue -d region --limit 10

Top 10 regions by revenue

metricly query -m mrr,churn -f json

Multiple metrics as JSON

Dashboards

metricly dashboards list

List your dashboards

metricly dashboards show <id>

Show dashboard details

metricly dashboards create "Sales"

Create new dashboard

Metrics & Models

metricly metrics list

List available metrics

metricly metrics show total_revenue

Show metric definition

metricly manifest upload manifest.yaml

Import semantic layer

Built for coding agents

AI assistants use the CLI to understand your data while they work.

Claude Code

Analyzing business metrics while reviewing code

You: Check if the revenue calculation matches what's in the database
Agent: Running `metricly metrics show total_revenue` to get the metric definition...
Agent: The metric uses SUM(amount) WHERE status = 'paid'. Let me compare with the code...

Codex / Devin

Automated reporting workflow

Task: Generate weekly metrics report
Agent: Querying this week's data: `metricly query -m revenue,orders,churn -g day --start 2024-01-08 -f json`
Agent: Parsing results... Revenue: $124K (+8%), Orders: 1,847 (+12%), Churn: 2.1% (-0.3%)

Works with popular coding agents

Claude CodeOpenAI CodexDevinGitHub Copilot WorkspaceCursor AgentAider

Flexible output formats

Tables for humans, JSON for agents, CSV for spreadsheets.

Table

-f table

Human-readable ASCII tables

┌────────────┬───────────┐
│ month      │ revenue   │
├────────────┼───────────┤
│ 2024-01    │ $1,234,567│
│ 2024-02    │ $1,345,678│
└────────────┴───────────┘

JSON

-f json

Structured data for agents

{
  "data": [
    {"month": "2024-01", "revenue": 1234567},
    {"month": "2024-02", "revenue": 1345678}
  ]
}

CSV

-f csv

Spreadsheet-compatible

month,revenue
2024-01,1234567
2024-02,1345678

CI/CD integration

Validate metrics in your pipeline. Catch data issues before they reach production.

  • Validate metric definitions on PR
  • Alert on unexpected metric changes
  • Test queries before deployment
  • Works with GitHub Actions, GitLab CI, CircleCI

Example GitHub Action:

- name: Validate metrics
  run: |
    metricly metrics list -f json > metrics.json
    metricly query -m revenue \
      --start ${{ env.START_DATE }} \
      -f json > revenue.json

    # Assert revenue is positive
    jq -e '.data[0].revenue > 0' revenue.json

Frequently asked questions

How do coding agents use the CLI?

Coding agents like Claude Code and Codex can execute metricly commands directly. They parse the JSON output to understand your metrics, validate data assumptions, and make informed decisions while writing code.

Can I use the CLI in CI/CD pipelines?

Yes. Use `metricly query` with JSON output to validate metrics in your pipeline. Set up alerts when key metrics change unexpectedly or data quality issues arise.

What authentication methods are supported?

The CLI uses Google OAuth for authentication. Run `metricly login` to open a browser and authenticate. Credentials are stored securely in ~/.metricly/credentials.json.

Is the CLI open source?

The CLI is part of the Metricly backend package and included with your subscription. Documentation and examples are available in our public docs.

Ready to query metrics from anywhere?

Install the CLI and start querying in minutes.