How mathankarthik18/imagent works
imagent is a self-hosted AI-agent observability product. An application instruments agent runs through the Python SDK, which emits OpenTelemetry spans to the server; the server ingests and stores them, and the UI supports trace exploration, live status, blueprints, and comparisons. Experiments replay recorded runs with model changes and judging. Edges are limited to relationships shown in excerpts, the SOURCE INDEX, or README; some UI-to-server wiring is documented only at the product level.
Main entry points: main.py HTTP API and ingest · api.ts API client and state · runtime.py Tracing runtime · integrations Framework integrations
Components 24
Python SDK
- Tracing runtime
sdk/src/imagent/runtime.py - Framework integrations
sdk/src/imagent/integrations - Span conventions
sdk/src/imagent/integrations/_spans.py - Blueprint capture
sdk/src/imagent/blueprint.py - Experiment replay
sdk/src/imagent/experiments.py - Replay engine
sdk/src/imagent/replay.py
Ingest and services
- HTTP API and ingest
server/imagent_server/main.py - Trace queries
server/imagent_server/queries.py - Live run status
server/imagent_server/live.py - Blueprint service
server/imagent_server/blueprints.py - Experiment service
server/imagent_server/experiments.py - AI judging
server/imagent_server/judge.py - Projects and keys
server/imagent_server/projects.py - Cost pricing
server/imagent_server/pricing.py
Persistence and pricing
- ClickHouse
server/imagent_server/db.py - Price catalog sync
server/imagent_server/price_sync.py
Web application
- API client and state
ui/src/lib/api.ts - Trace exploration
ui/src/components/FlowView.tsx - Blueprint canvas
ui/src/pages/Blueprint.tsx - Experiment interface
ui/src/components/NewExperiment.tsx - Run comparison
ui/src/components/CompareView.tsx - Project interface
ui/src/pages/Projects.tsx
Other components
- Agent application
- OpenTelemetry backend
Connections 27
- Agent application → Tracing runtime: initializes tracing
- Tracing runtime → Framework integrations: installs integrations
sdk/src/imagent/runtime.py - Framework integrations → Span conventions: creates spans
sdk/src/imagent/integrations/_spans.py - Framework integrations → Blueprint capture: captures structure
sdk/src/imagent/integrations/crewai.py - Framework integrations → Experiment replay: supports replay
sdk/src/imagent/integrations/llamaindex.py - Tracing runtime → Blueprint capture: publishes blueprint
sdk/src/imagent/runtime.py - Tracing runtime → Experiment replay: starts experiments
sdk/src/imagent/runtime.py - Experiment replay → Replay engine: delegates replay
sdk/src/imagent/experiments.py - Tracing runtime → OpenTelemetry backend: exports spans
- OpenTelemetry backend → HTTP API and ingest: sends OTLP
- HTTP API and ingest → ClickHouse: stores spans
server/imagent_server/main.py - HTTP API and ingest → Trace queries: routes queries
server/imagent_server/main.py - HTTP API and ingest → Live run status: reads live status
server/imagent_server/main.py - HTTP API and ingest → Blueprint service: routes blueprint calls
server/imagent_server/main.py - HTTP API and ingest → Experiment service: routes experiment calls
server/imagent_server/main.py - HTTP API and ingest → Projects and keys: routes project calls
server/imagent_server/main.py - Experiment service → ClickHouse: reads and writes
server/imagent_server/experiments.py - Experiment service → AI judging: requests judging
server/imagent_server/main.py - Cost pricing → ClickHouse: uses price data
- Price catalog sync → Cost pricing: syncs catalog
server/imagent_server/price_sync.py - Price catalog sync → ClickHouse: stores prices
server/imagent_server/price_sync.py - API client and state → HTTP API and ingest: calls endpoints
- Trace exploration → API client and state: loads trace data
ui/src/components/FlowView.tsx - Blueprint canvas → API client and state: loads blueprint
ui/src/pages/Blueprint.tsx - Experiment interface → API client and state: submits experiments
ui/src/components/NewExperiment.tsx - Run comparison → API client and state: loads comparisons
ui/src/components/CompareView.tsx - Project interface → API client and state: manages projects