← Back to Skills Marketplace
ajmeraparth132

Agnost AI Analytics

by Parth Ajmera · GitHub ↗ · v1.0.1
cross-platform ✓ Security Clean
292
Downloads
1
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install agnost-ai
Description
USE when implementing data ingestion for Agnost AI analytics. Contains API reference, SDK guides for Python and TypeScript, and code examples for tracking AI...
README (SKILL.md)

Agnost Data Ingestion

Comprehensive guide for ingesting data into Agnost AI for analytics, monitoring, and insights. Covers the Conversation SDK for tracking AI interactions and the MCP SDK for Model Context Protocol server analytics.

Official docs: https://docs.agnost.ai API Endpoint: https://api.agnost.ai Dashboard: https://app.agnost.ai

IMPORTANT: How to Apply This Skill

Before implementing Agnost ingestion, follow this priority order:

  1. Identify the use case: Conversation tracking (AI chatbots, agents) or MCP server analytics
  2. Check SDK references in the references/ directory for detailed API
  3. Use provided code examples as starting points
  4. Cite references when explaining implementation details

Quick Reference

SDK Packages

Use Case Python TypeScript/Node.js Go
Conversation/AI Tracking pip install agnost npm install agnostai N/A
MCP Server Analytics pip install agnost-mcp npm install agnost go get github.com/agnostai/agnost-go

API Endpoints

Endpoint Method Description
/api/v1/capture-session POST Create a new conversation/session
/api/v1/capture-event POST Record an event within a session

Conversation SDK (Recommended for AI Applications)

Use the Conversation SDK when building AI applications, chatbots, or agents that need to track user interactions, inputs, outputs, and performance metrics.

Python Installation & Setup

# Installation
pip install agnost
# or
uv add agnost

# Basic Setup
import agnost

# Initialize with your org ID (from dashboard)
agnost.init("your-org-id")

TypeScript/Node.js Installation & Setup

// Installation
npm install agnostai
// or
pnpm add agnostai

// Basic Setup
import * as agnost from "agnostai";

// Initialize with your org ID (from dashboard)
agnost.init("your-org-id");

Core Methods

1. init(org_id, config?) - Initialize SDK

Must be called before any tracking methods.

Python

import agnost

# Basic initialization
agnost.init("your-org-id")

# With configuration
agnost.init(
    "your-org-id",
    endpoint="https://api.agnost.ai",  # Custom endpoint (optional)
    debug=True                          # Enable debug logging
)

TypeScript

import * as agnost from "agnostai";

// Basic initialization
agnost.init("your-org-id");

// With configuration
agnost.init("your-org-id", {
  endpoint: "https://api.agnost.ai",  // Custom endpoint (optional)
  debug: true                          // Enable debug logging
});

2. begin() + end() - Track Interactions (Recommended)

Use the begin/end pattern for automatic latency calculation and cleaner code.

Python

import agnost

agnost.init("your-org-id")

# Start tracking an interaction
interaction = agnost.begin(
    user_id="user_123",
    agent_name="weather-agent",
    input="What's the weather in NYC?",
    conversation_id="conv_456",  # Optional: group related events
    properties={"model": "gpt-4"}  # Optional: custom metadata
)

# ... Your AI processing happens here ...
response = call_your_ai_model(interaction.input)

# Complete the interaction (latency auto-calculated)
interaction.end(
    output=response,
    success=True  # Set False if the call failed
)

TypeScript

import * as agnost from "agnostai";

agnost.init("your-org-id");

// Start tracking an interaction
const interaction = agnost.begin({
  userId: "user_123",
  agentName: "weather-agent",
  input: "What's the weather in NYC?",
  conversationId: "conv_456",  // Optional: group related events
  properties: { model: "gpt-4" }  // Optional: custom metadata
});

// ... Your AI processing happens here ...
const response = await callYourAIModel(interaction.input);

// Complete the interaction (latency auto-calculated)
interaction.end(response);  // or interaction.end(response, true) for success

3. track() - Single-Call Tracking

Use when you have all data available at once (no need for begin/end).

Python

import agnost

agnost.init("your-org-id")

agnost.track(
    user_id="user_123",
    input="What's the weather?",
    output="The weather is sunny with 72°F.",
    agent_name="weather-agent",
    conversation_id="conv_456",  # Optional
    success=True,
    latency=150,  # milliseconds
    properties={"model": "gpt-4", "tokens": 42}
)

4. identify() - User Enrichment

Associate user metadata with a user ID for richer analytics.

Python

import agnost

agnost.init("your-org-id")

agnost.identify("user_123", {
    "name": "John Doe",
    "email": "[email protected]",
    "plan": "premium",
    "company": "Acme Inc"
})

TypeScript

import * as agnost from "agnostai";

agnost.init("your-org-id");

agnost.identify("user_123", {
  name: "John Doe",
  email: "[email protected]",
  plan: "premium",
  company: "Acme Inc"
});

5. flush() & shutdown() - Resource Management

Python

import agnost

# Manually flush pending events
agnost.flush()

# Clean shutdown (flushes and closes connections)
agnost.shutdown()

TypeScript

import * as agnost from "agnostai";

// Manually flush pending events
await agnost.flush();

// Clean shutdown (flushes and closes connections)
await agnost.shutdown();

Interaction Object Methods

When using begin(), you get an Interaction object with these methods:

Method Description
set_input(text) / setInput(text) Set/update the input text
set_property(key, value) / setProperty(key, value) Add a single custom property
set_properties(dict) / setProperties(obj) Add multiple custom properties
end(output, success?, latency?) Complete and send the event

Example: Building Input Dynamically (Python)

interaction = agnost.begin(
    user_id="user_123",
    agent_name="my-agent"
)

# Build input from multiple sources
interaction.set_input("Combined user query: " + user_input)
interaction.set_property("source", "chat-widget")
interaction.set_properties({"model": "gpt-4", "version": "v2"})

# Process and complete
response = process_query(interaction.input)
interaction.end(output=response)

MCP Server Analytics

For tracking Model Context Protocol (MCP) servers, use the MCP SDK.

Python (FastMCP)

from mcp.server.fastmcp import FastMCP
from agnost_mcp import track, config

# Create FastMCP server
mcp = FastMCP("my-mcp-server")

# Add your tools
@mcp.tool()
def my_tool(param: str) -> str:
    return f"Result: {param}"

# Enable tracking
track(mcp, "your-org-id", config(
    endpoint="https://api.agnost.ai",
    disable_input=False,   # Track input arguments
    disable_output=False   # Track output results
))

# Run server
mcp.run()

TypeScript (MCP SDK)

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { trackMCP } from "agnost";

// Create MCP server
const server = new Server({
  name: "my-mcp-server",
  version: "1.0.0"
}, {
  capabilities: { tools: {} }
});

// Enable tracking
trackMCP(server, "your-org-id", {
  endpoint: "https://api.agnost.ai",
  disableInput: false,
  disableOutput: false
});

// Start server
const transport = new StdioServerTransport();
await server.connect(transport);

Go (mcp-go)

package main

import (
    "github.com/agnostai/agnost-go/agnost"
    "github.com/mark3labs/mcp-go/server"
)

func main() {
    s := server.NewMCPServer("my-server", "1.0.0")

    // Add tools...

    // Enable tracking
    agnost.Track(s, "your-org-id", &agnost.Config{
        DisableInput:  false,
        DisableOutput: false,
        BatchSize:     10,
        LogLevel:      "info",
    })

    server.ServeStdio(s)
}

API Reference (Direct HTTP)

For cases where you need direct API access without an SDK.

Create Session

curl -X POST https://api.agnost.ai/api/v1/capture-session \
  -H "Content-Type: application/json" \
  -H "X-Org-Id: your-org-id" \
  -d '{
    "session_id": "unique-session-id",
    "client_config": "my-app",
    "connection_type": "http",
    "ip": "",
    "user_data": {
      "user_id": "user_123",
      "email": "[email protected]"
    },
    "tools": ["tool1", "tool2"]
  }'

Capture Event

curl -X POST https://api.agnost.ai/api/v1/capture-event \
  -H "Content-Type: application/json" \
  -H "X-Org-Id: your-org-id" \
  -d '{
    "session_id": "unique-session-id",
    "primitive_type": "tool",
    "primitive_name": "weather_lookup",
    "latency": 150,
    "success": true,
    "args": "{\"city\": \"NYC\"}",
    "result": "{\"temp\": 72}",
    "metadata": {
      "model": "gpt-4",
      "tokens": "42"
    }
  }'

Data Structures

Session Request

{
  "session_id": "string (UUID or custom ID)",
  "client_config": "string (app identifier)",
  "connection_type": "string (http/stdio/sse)",
  "ip": "string (optional)",
  "user_data": {
    "user_id": "string",
    "...": "any additional user fields"
  },
  "tools": ["array", "of", "tool", "names"]
}

Event Request

{
  "session_id": "string (must match existing session)",
  "primitive_type": "string (tool/resource/prompt)",
  "primitive_name": "string (name of the primitive)",
  "latency": "integer (milliseconds)",
  "success": "boolean",
  "args": "string (JSON-encoded input)",
  "result": "string (JSON-encoded output)",
  "checkpoints": [
    {
      "name": "string",
      "timestamp": "integer (ms since start)",
      "metadata": {}
    }
  ],
  "metadata": {
    "key": "value pairs"
  }
}

Configuration Options

Python Conversation SDK

agnost.init(
    "your-org-id",
    endpoint="https://api.agnost.ai",  # API endpoint
    debug=False                         # Enable debug logging
)

TypeScript Conversation SDK

interface ConversationConfig {
  endpoint?: string;  // API endpoint (default: https://api.agnost.ai)
  debug?: boolean;    // Enable debug logging (default: false)
}

agnost.init("your-org-id", { endpoint: "...", debug: true });

Python MCP SDK (FastMCP)

from agnost_mcp import track, config

track(server, "your-org-id", config(
    endpoint="https://api.agnost.ai",
    disable_input=False,   # Don't track input arguments
    disable_output=False   # Don't track output results
))

TypeScript MCP SDK

import { trackMCP, createConfig } from "agnost";

const cfg = createConfig({
  endpoint: "https://api.agnost.ai",
  disableInput: false,
  disableOutput: false
});

trackMCP(server, "your-org-id", cfg);

Go MCP SDK

type Config struct {
    Endpoint         string        // default: "https://api.agnost.ai"
    DisableInput     bool          // default: false
    DisableOutput    bool          // default: false
    BatchSize        int           // default: 5
    MaxRetries       int           // default: 3
    RetryDelay       time.Duration // default: 1s
    RequestTimeout   time.Duration // default: 5s
    LogLevel         string        // "debug", "info", "warning", "error"
    Identify         IdentifyFunc  // optional user identification
}

Best Practices

1. Always Initialize Early

# At application startup
import agnost
agnost.init("your-org-id")

2. Use begin/end for Accurate Latency

# Automatically calculates processing time
interaction = agnost.begin(user_id="u1", agent_name="agent")
# ... processing ...
interaction.end(output=result)

3. Group Related Events with conversation_id

# All events for a single chat session
conversation_id = f"chat_{session_id}"
interaction = agnost.begin(
    user_id="u1",
    conversation_id=conversation_id,
    agent_name="chatbot"
)

4. Handle Errors Gracefully

interaction = agnost.begin(user_id="u1", agent_name="agent")
try:
    result = process_request()
    interaction.end(output=result, success=True)
except Exception as e:
    interaction.end(output=str(e), success=False)

5. Shutdown Cleanly

import atexit
import agnost

atexit.register(agnost.shutdown)

When to Apply

This skill activates when you encounter:

  • Data ingestion implementation for Agnost
  • AI conversation tracking setup
  • MCP server analytics integration
  • Event/session capture API usage
  • SDK initialization questions
  • Latency tracking requirements
  • User identification/enrichment

Additional Resources

Usage Guidance
This is a documentation-only SDK guide for sending analytics to api.agnost.ai — the skill itself is not installing or running code. Before you adopt it: (1) confirm the upstream SDK packages (agnost, agnostai, agnost-mcp) on npm/PyPI and verify the maintainers/publish dates and source repository; (2) avoid sending real PII or production data until you’ve validated the service and reviewed their privacy/security policies (examples show sending email, IP, and full input/output); (3) store your organization ID in a secure secret (not in code) and validate the header usage (X-Org-Id) before deploying; (4) consider using options to disable input/output capture where available (e.g., disable_input/disable_output) if you must limit sensitive data collection; and (5) exercise caution installing the referenced third-party packages — this skill only documents behavior, but installed SDKs will run code on your systems.
Capability Analysis
Type: OpenClaw Skill Name: agnost-ai Version: 1.0.1 The skill bundle provides comprehensive documentation and code examples for integrating Agnost AI analytics into AI applications and MCP servers. It includes references for Python and TypeScript SDKs, as well as direct API usage for tracking conversations, events, and user metadata. The content is well-structured, aligns perfectly with its stated purpose of data ingestion for observability, and contains no evidence of malicious intent, data exfiltration, or prompt injection.
Capability Assessment
Purpose & Capability
The name/description match the content: SDK docs, API reference, and examples for ingesting analytics into https://api.agnost.ai. The skill does not request unrelated binaries, credentials, or system access.
Instruction Scope
Instructions and examples are limited to initializing the SDK, creating sessions/events, and sending analytics to api.agnost.ai. They show collecting user metadata (user_id, email), IP, args/results and using an org ID; this is expected for an analytics SDK but is a privacy consideration. Examples also use process.env.AGNOST_ORG_ID in sample code even though no env vars are declared by the skill.
Install Mechanism
There is no install spec — the skill is instruction-only. The examples instruct users to install packages (pip/npm) from public registries; that is normal but means risk shifts to the external packages (verify npm/PyPI publishers before installing).
Credentials
The skill declares no required environment variables or credentials (consistent with being docs-only). However examples expect an organization ID (X-Org-Id / AGNOST_ORG_ID) which is the only credential-like parameter; no unrelated secrets (AWS keys, tokens for other services) are requested.
Persistence & Privilege
always:false and user-invocable:true (normal). The skill does not request persistent agent presence or modify other skills or system settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agnost-ai
  3. After installation, invoke the skill by name or use /agnost-ai
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
- Initial release of detailed ingestion documentation under the new name "agnost-ingestion" - Added comprehensive SDK setup and usage guides for Python and TypeScript - Provided code examples for tracking AI conversations, MCP server events, and user interactions - Included quick-reference tables for SDK packages and API endpoints - Explained core tracking methods (`init`, `begin`/`end`, `track`, `identify`, `flush`, and `shutdown`) - Added MCP server analytics section with implementation samples for both Python and TypeScript
v1.0.0
Initial release of agnost-ingestion: comprehensive data ingestion guide and SDK/API reference for Agnost AI analytics. - Introduces Python and TypeScript/Node.js SDKs for AI conversation and MCP server event tracking. - Provides installation, initialization, and usage code examples for both Conversation and MCP SDKs. - Documents main SDK methods: init, begin/end, track_ai, identify, flush, and shutdown. - Includes quick reference tables for API endpoints and SDK packages. - Offers practical patterns for tracking user interactions and enriching events. - Linked to official docs, dashboard, and API endpoint for further resources.
Metadata
Slug agnost-ai
Version 1.0.1
License
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Agnost AI Analytics?

USE when implementing data ingestion for Agnost AI analytics. Contains API reference, SDK guides for Python and TypeScript, and code examples for tracking AI... It is an AI Agent Skill for Claude Code / OpenClaw, with 292 downloads so far.

How do I install Agnost AI Analytics?

Run "/install agnost-ai" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Agnost AI Analytics free?

Yes, Agnost AI Analytics is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Agnost AI Analytics support?

Agnost AI Analytics is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Agnost AI Analytics?

It is built and maintained by Parth Ajmera (@ajmeraparth132); the current version is v1.0.1.

💬 Comments