Skip to content

Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI

updated gitignore (#1223)

Alex Reibman52f93065adc0
diff --git a/app/dashboard/.env.example b/app/dashboard/.env.example
new file mode 100644
index 00000000..ec7bc6ae
--- /dev/null
+++ b/app/dashboard/.env.example
@@ -0,0 +1,76 @@
+# AgentOps Dashboard Environment Configuration
+# Copy this file to .env.local and fill in your actual values
+
+# =============================================================================
+# SUPABASE CONFIGURATION
+# =============================================================================
+
+# Supabase Project Settings (Public)
+NEXT_PUBLIC_SUPABASE_URL="https://your-project-id.supabase.co"
+NEXT_PUBLIC_SUPABASE_ANON_KEY="your-supabase-anon-key"
+
+# Supabase Service Role (Server-side only)
+SUPABASE_SERVICE_ROLE_KEY="your-supabase-service-role-key"
+SUPABASE_PROJECT_ID="your-project-id"
+
+# =============================================================================
+# APPLICATION URLS
+# =============================================================================
+
+# API Backend URL
+NEXT_PUBLIC_API_URL="http://localhost:8000"
+
+# Application URLs
+NEXT_PUBLIC_APP_URL="http://localhost:3000"
+NEXT_PUBLIC_SITE_URL="http://localhost:3000"
+
+# =============================================================================
+# STRIPE BILLING CONFIGURATION
+# =============================================================================
+
+# Stripe Public Key (safe to expose in frontend)
+NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_your_stripe_publishable_key"
+
+# Stripe Secret Keys (server-side only)
+STRIPE_SECRET_KEY="sk_test_your_stripe_secret_key"
+STRIPE_WEBHOOK_SECRET="whsec_your_webhook_secret"
+
+# =============================================================================
+# ANALYTICS & MONITORING
+# =============================================================================
+
+# PostHog Analytics
+NEXT_PUBLIC_POSTHOG_KEY="your-posthog-key"
+NEXT_PUBLIC_POSTHOG_HOST="https://app.posthog.com"
+
+# Sentry Error Monitoring
+NEXT_PUBLIC_SENTRY_DSN="your-sentry-dsn"
+NEXT_PUBLIC_SENTRY_ORG="your-sentry-org"
+NEXT_PUBLIC_SENTRY_PROJECT="your-sentry-project"
+NEXT_PUBLIC_SENTRY_ENVIRONMENT="development"
+
+# =============================================================================
+# FEATURE FLAGS & CONFIGURATION
+# =============================================================================
+
+# Authentication Methods
+NEXT_PUBLIC_SIGNIN_METHODS="email,oauth"
+
+# Environment Type
+NEXT_PUBLIC_ENVIRONMENT_TYPE="development"
+
+# Feature Toggles
+NEXT_PUBLIC_PLAYGROUND="true"
+NEXT_PUBLIC_FALLBACK_API_KEY=""
+
+# =============================================================================
+# PRODUCTION OVERRIDES
+# =============================================================================
+
+# Uncomment and modify for production
+# NEXT_PUBLIC_API_URL="https://api.yourdomain.com"
+# NEXT_PUBLIC_APP_URL="https://yourdomain.com"
+# NEXT_PUBLIC_SITE_URL="https://yourdomain.com"
+# NEXT_PUBLIC_ENVIRONMENT_TYPE="production"
+# NEXT_PUBLIC_PLAYGROUND="false"
+# NEXT_PUBLIC_SENTRY_ENVIRONMENT="production"
diff --git a/app/dashboard/.gitignore b/app/dashboard/.gitignore
new file mode 100644
index 00000000..31788a6a
--- /dev/null
+++ b/app/dashboard/.gitignore
@@ -0,0 +1,78 @@
+# Dashboard-specific gitignore
+# This overrides parent .gitignore patterns that shouldn't apply to the Next.js app
+
+# === IMPORTANT: Negate Python patterns that shouldn't apply here ===
+# Allow lib directories (needed for app source code)
+!lib/
+!*/lib/
+!app/lib/
+
+# Allow .env.example (documentation for environment variables)
+!.env.example
+
+# === Node/JavaScript/TypeScript specific ignores ===
+# Dependencies
+node_modules/
+.pnp
+.pnp.js
+
+# Testing
+coverage/
+.nyc_output
+cypress/screenshots/
+cypress/videos/
+cypress/downloads/
+cypress/reports/
+
+# Next.js
+.next/
+out/
+build/
+dist/
+
+# Debug
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+.pnpm-debug.log*
+
+# Local env files
+.env*.local
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+# Vercel
+.vercel
+
+# TypeScript
+*.tsbuildinfo
+next-env.d.ts
+
+# Bundle analysis
+bundle_analytics/*
+!bundle_analytics/README.md
+
+# Lock files (if you want to ignore them)
+# bun.lockb
+# package-lock.json
+# yarn.lock
+# pnpm-lock.yaml
+
+# IDE
+.idea/
+.vscode/
+.cursor/
+*.swp
+*.swo
+*~
+
+# OS
+.DS_Store
+Thumbs.db
+
+# Misc
+.cache
+.temp
+.tmp
diff --git a/app/dashboard/app/lib/span-colors.ts b/app/dashboard/app/lib/span-colors.ts
new file mode 100644
index 00000000..68e228d8
--- /dev/null
+++ b/app/dashboard/app/lib/span-colors.ts
@@ -0,0 +1,92 @@
+// Define type for span color definitions
+export type SpanColorDefinition = {
+ bg: string;
+ border: string;
+ text: string;
+ selectedBorder: string;
+};
+
+export type SpanTypeColorMap = {
+ [key: string]: SpanColorDefinition;
+ session: SpanColorDefinition;
+ agent: SpanColorDefinition;
+ operation: SpanColorDefinition;
+ task: SpanColorDefinition;
+ workflow: SpanColorDefinition;
+ llm: SpanColorDefinition;
+ tool: SpanColorDefinition;
+ tool_usage: SpanColorDefinition;
+ error: SpanColorDefinition;
+ other: SpanColorDefinition;
+ default: SpanColorDefinition;
+};
+
+// Shared color definitions for span types used across the application
+export const spanTypeColors: SpanTypeColorMap = {
+ session: {
+ bg: 'rgba(20, 27, 52, 0.4)',
+ border: 'rgba(222, 224, 244, 1)',
+ text: 'text-slate-800', // Dark blue/slate for session
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ agent: {
+ bg: 'rgba(36, 0, 255, 0.6)',
+ border: 'rgba(222, 224, 244, 0.1)',
+ text: 'text-blue-600', // Deeper blue for agent
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ operation: {
+ bg: 'rgba(75, 196, 152, 1)',
+ border: 'rgba(75, 196, 152, 1)',
+ text: 'text-emerald-500', // Green for operation
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ task: {
+ bg: 'rgba(75, 196, 152, 1)',
+ border: 'rgba(75, 196, 152, 1)',
+ text: 'text-emerald-500', // Green for task
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ workflow: {
+ bg: 'rgba(222, 224, 244, 0.7)',
+ border: 'rgba(222, 224, 244, 1)',
+ text: 'text-slate-400', // Light slate for workflow
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ llm: {
+ bg: 'rgba(1, 178, 255, 1)',
+ border: 'rgba(01, 178, 255, 0.7)',
+ text: 'text-sky-500', // Bright blue for LLM
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ tool: {
+ bg: 'rgba(237, 216, 103, 0.9)',
+ border: 'rgba(237, 216, 103, 1)',
+ text: 'text-yellow-500', // Yellow for tool usage
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ tool_usage: {
+ bg: 'rgba(237, 216, 103, 0.9)',
+ border: 'rgba(237, 216, 103, 1)',
+ text: 'text-yellow-500', // Yellow for tool usage
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ error: {
+ bg: 'rgba(230, 90, 126, 1)',
+ border: 'rgba(230, 90, 126, 0.7)',
+ text: 'text-red-500', // Red for error
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ other: {
+ bg: 'rgba(20, 27, 52, 0.5)',
+ border: 'rgba(20, 27, 52, 0.7)',
+ text: 'text-slate-600', // Darker slate for other
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+ default: {
+ bg: '#94A3B8',
+ border: '#94A3B8',
+ text: 'text-slate-400', // Light slate for default
+ selectedBorder: 'rgba(225, 227, 242, 1)',
+ },
+};
diff --git a/app/dashboard/app/lib/span-utils.ts b/app/dashboard/app/lib/span-utils.ts
new file mode 100644
index 00000000..00314d33
--- /dev/null
+++ b/app/dashboard/app/lib/span-utils.ts
@@ -0,0 +1,99 @@
+export interface ParsedSpanName {
+ baseName: string; // The main part of the name, typically including framework and entity type.
+ typeSuffix: string; // The final segment of the name (e.g., a specific task name, action, or empty if no dot).
+}
+
+/**
+ * Parses a span name string, which often follows conventions like `framework.entity_type.specific_name`,
+ * into a `baseName` and a `typeSuffix`. The split occurs at the last dot.
+ * This is a general utility. Specific components might apply further logic based on these parsed parts.
+ *
+ * Examples based on common conventions:
+ * - "adk.agent.HumanApprovalWorkflow" -> { baseName: "adk.agent", typeSuffix: "HumanApprovalWorkflow" }
+ * - "crewai.task.ResearchTask" -> { baseName: "crewai.task", typeSuffix: "ResearchTask" }
+ * - "my_custom_tool" (no dots) -> { baseName: "my_custom_tool", typeSuffix: "" }
+ * - "llm.generation" -> { baseName: "llm", typeSuffix: "generation" }
+ * - ".RawEventType" -> { baseName: "", typeSuffix: "RawEventType" }
+ * - "FrameworkOnly." -> { baseName: "FrameworkOnly", typeSuffix: "" }
+ *
+ * @param spanNameToParse The span name string to parse.
+ * @returns An object with `baseName` and `typeSuffix`.
+ */
+export const parseSpanName = (spanNameToParse: string): ParsedSpanName => {
+ const lastDotIndex = spanNameToParse.lastIndexOf('.');
+
+ if (lastDotIndex !== -1) {
+ // If a dot is found, split the string.
+ // This handles cases like ".foo" (baseName="", typeSuffix="foo")
+ // and "foo." (baseName="foo", typeSuffix="") correctly based on substring behavior.
+ return {
+ baseName: spanNameToParse.substring(0, lastDotIndex),
+ typeSuffix: spanNameToParse.substring(lastDotIndex + 1),
+ };
+ }
+
+ // No dot found, the entire string is the baseName, and typeSuffix is empty.
+ return { baseName: spanNameToParse, typeSuffix: '' };
+};
+
+export interface SpanDisplayDetails {
+ displayName: string;
+ eventType: string;
+}
+
+/**
+ * Determines the display name and event type from a raw span name and its attributes.
+ * Handles ADK-specific naming conventions (e.g., "adk.agent.SpecificName") and falls back to generic parsing.
+ * For ADK agent spans, it prioritizes `spanAttributes.agent.name` if available.
+ * @param rawSpanName The raw span name string.
+ * @param spanAttributes Optional span attributes, used for ADK agent name override.
+ * @returns An object with `displayName` and `eventType`.
+ */
+export const getSpanDisplayDetails = (
+ rawSpanName: string,
+ spanAttributes?: any, // Using any for flexibility, consider a more specific type if available
+): SpanDisplayDetails => {
+ let displayName: string;
+ let eventType: string;
+
+ if (rawSpanName.startsWith('adk.')) {
+ const parts = rawSpanName.split('.');
+ eventType = parts.length > 1 ? parts[1] : 'adk';
+ displayName =
+ parts.length > 2 ? parts.slice(2).join('.') : parts.length > 1 ? parts[1] : rawSpanName;
+
+ if (eventType.toLowerCase() === 'agent' && spanAttributes?.agent?.name) {
+ displayName = spanAttributes.agent.name;
+ // Check if this ADK agent has sub_agents, making it a workflow
+ if (spanAttributes?.agent?.sub_agents?.length > 0) {
+ eventType = 'workflow';
+ }
+ }
+ } else if (rawSpanName.startsWith('ag2.')) {
+ // Handle AG2 spans similar to ADK
+ const parts = rawSpanName.split('.');
+ eventType = parts.length > 1 ? parts[1] : 'ag2';
+ displayName =
+ parts.length > 2 ? parts.slice(2).join('.') : parts.length > 1 ? parts[1] : rawSpanName;
+
+ // For AG2 agents, use the agent name from attributes if available
+ if (eventType.toLowerCase() === 'agent' && spanAttributes?.agent?.name) {
+ displayName = spanAttributes.agent.name;
+ }
+ } else {
+ const parsed = parseSpanName(rawSpanName);
+ displayName = parsed.baseName;
+ eventType = parsed.typeSuffix;
+
+ if (!displayName && parsed.typeSuffix) {
+ displayName = parsed.typeSuffix;
+ } else if (!displayName && !parsed.typeSuffix) {
+ displayName = rawSpanName;
+ }
+ // If eventType is empty after parsing a non-ADK name, it means the original name had no dot.
+ // In such cases, the eventType might be implicitly derived or considered 'unknown'/default by the caller.
+ // For now, we leave eventType as potentially empty, as per parseSpanName's behavior for no-dot names.
+ }
+
+ return { displayName, eventType };
+};