AnotherAI
AnotherAI
Use CasesFundamentals

Metrics and Views

Query your AI agents' data with natural language, create persistent dashboards, and integrate with your tools via API for advanced use cases

One of the core features we wanted to unlock with AnotherAI was to allow users to access all their agent data in a way that would allow them to see the information that was important to them.

You can start by asking questions directly in natural language through your AI assistant, build persistent views in the web app for metrics you want to monitor regularly, and for more advanced use cases, access the data directly via REST API to integrate with your existing tools or build your own customizable dashboards.

Types of Data You Can Query

Organization-wide data, including:

  • Total spending across all agents
  • Most used agents and models
  • Agents with the highest failure rates

Organization Daily Spending Graph

Agent-level data, including:

  • Individual agent costs and usage
  • Latency and performance metrics
  • User feedback and annotations left my team members

Agent Level Daily Spending Graph

Type of Views You Can Create

There are two main types of views in AnotherAI:

1. Table Views

  • Display tabular data with rows and columns
  • Best for individual completions, detailed records, or spreadsheet-style data
  • Example uses: Recent completions, error logs, cost breakdowns

Example of a table view: Table view example showing completions with annotations

2. Chart/Graph Views

  • Multiple visualization types for aggregated data:
    • Line graphs: Time-series data and trends
    • Bar charts: Compare values across categories (can be stacked)
    • Pie charts: Show proportional data as segments
    • Scatter plots: Plot relationships between two numeric variables
  • Best for aggregated metrics, trends, and visual analysis -Example uses: Cost trends over time, agent performance comparisons, model usage distribution

Example of a chart view: Organization Daily Spending Graph

Key difference: Tables show individual records while charts show aggregated data with visual representations.

Query methods

Using Natural Language via AI Assistant

The AnotherAI MCP allows you to ask questions about your completions data in plain English. Your AI assistant will automatically translate your request into the appropriate SQL query and retrieve the results. This means you don't need to know SQL to analyze your data.

For example, you can ask questions like:

  • "What's my total spend this week?"

  • "Which agents are failing most often?"

  • "Show me the average latency for each model"

  • "How many completions did we process yesterday?"

Your AI assistant will handle the query and present the results in a clear format.

Creating Views in AnotherAI

You can also create persistent views in the web app to monitor important metrics over time. Simply describe what you want to see visualized.

For example: suppose you have an agent is becoming increasingly popular in your product. You want to keep an eye on the overall spend on that agent to ensure you don't go over budget. You also want to keep an eye on the speed of the models you're using, so that your customers aren't left with long wait times. You may ask your AI assistant to create the following views as such:

Describe the view or goal you want to your preferred AI assistant

Create a view in AnotherAI that shows me the daily cost of 
anotherai/agent/calendar-event-extraction

Calendar Event Extraction Daily Cost or

Create a view in AnotherAI that shows me the total number of completions per day
across all agents for the last week

Daily Completions Count Bar Chart or

Create a view in AnotherAI that shows all the completion outputs and annotations
for anotherai/agent/calendar-event-extraction

Calendar Event Completions and Annotations

After creating a view, you can always make adjustments to it

Update anotherai/views/calendar-event-extraction-completions-annotations to include 
the completion inputs as well

Calendar Event Completions and Annotations with Inputs

Can I access metrics via an API?

Yes! If you want to integrate AnotherAI data into your existing business intelligence tools, you can also access the data via the /v1/completions/query endpoint. This provides the same functionality as the query_completions MCP tool but through HTTP requests, enabling you to further customize how you utilize the data available to you.

Recommended approach: For building integrations with the AnotherAI API, we recommend using an AI coding assistant with the AnotherAI MCP connected. The MCP gives your AI assistant direct access to:

  • Complete API documentation
  • The ability to explore the SQL schema using query_completions with DESCRIBE statements
  • Real-time testing of queries before implementing them in code

This approach significantly speeds up development and ensures your integration uses the API correctly. See the Getting Started guide for MCP setup instructions.

Endpoint

GET https://api.anotherai.dev/v1/completions/query

Authentication

Include your AnotherAI API key in the Authorization header:

Authorization: Bearer aai-your-api-key

Parameters

ParameterTypeRequiredDescription
querystringYesSQL query to execute on the completions table

Response

Returns an array of objects representing the query results:

[
  {
    "completion_id": "comp_123",
    "agent_id": "email-classifier",
    "model": "gpt-4o",
    "created_at": "2024-01-15T10:30:00Z",
    "total_tokens": 150,
    "cost_usd": 0.002
  }
]

Example usage

curl -X GET "https://api.anotherai.dev/v1/completions/query?query=SELECT%20*%20FROM%20completions%20WHERE%20agent_id%20%3D%20%27email-classifier%27%20LIMIT%2010" \
  -H "Authorization: Bearer aai-your-api-key" \
  -H "Content-Type: application/json"
import requests

url = "https://api.anotherai.dev/v1/completions/query"
headers = {
    "Authorization": "Bearer aai-your-api-key",
    "Content-Type": "application/json"
}
params = {
    "query": "SELECT * FROM completions WHERE agent_id = 'email-classifier' LIMIT 10"
}

response = requests.get(url, headers=headers, params=params)
data = response.json()
const url = new URL("https://api.anotherai.dev/v1/completions/query");
url.searchParams.append("query", "SELECT * FROM completions WHERE agent_id = 'email-classifier' LIMIT 10");

const response = await fetch(url, {
    headers: {
        "Authorization": "Bearer aai-your-api-key",
        "Content-Type": "application/json"
    }
});

const data = await response.json();

Common queries

Here are some useful SQL queries for analyzing your completion data:

-- Get completions for a specific agent in the last 24 hours
SELECT * FROM completions 
WHERE agent_id = 'my-agent' 
AND created_at >= NOW() - INTERVAL 1 DAY
ORDER BY created_at DESC;

-- Analyze cost and token usage by model
SELECT model, COUNT(*) as completion_count, 
       SUM(total_tokens) as total_tokens, 
       SUM(cost_usd) as total_cost
FROM completions 
GROUP BY model
ORDER BY total_cost DESC;

-- Find slow completions (over 5 seconds)
SELECT completion_id, agent_id, model, duration_ms
FROM completions 
WHERE duration_ms > 5000
ORDER BY duration_ms DESC;

How is this guide?