You are browsing as a guest. Sign up (or log in) to start making projects!

Open comments for this post

5h 44m 54s logged

dev vlog 3”What’s up, builders! Today we are fundamentally changing how SwarmTrace works. We’re tearing out the local SQLite restrictions and turning this project into a distributed, multi-tenant AI agent monitoring platform. The goal? Anyone can install our package, drop in an API key, and instantly view their agent’s execution traces on a sleek, hosted Next.js dashboard powered by Clerk and Supabase—without hosting a single thing themselves.”

What We’re Solving Today:
The “Localhost” Trap: Right now, the FastAPI backend expects to live on the same machine as the SQLite database. If a user runs an agent on their machine, they can’t easily see it on a globally hosted dashboard.

Multi-Tenancy: We need to make sure User A never sees User B’s logs. Every single trace must be bound to an organization or user ID.

Zero-Infra for the User: The developer using tracely should only have to pip-install it, provide a SWARMTRACE_API_KEY, and let our remote backend handle the rest.

📐 The SaaS Architecture Blueprint
Here is how data will flow across the internet from your user’s local python script straight to your Vercel-hosted frontend dashboard:

[ User’s Local Machine ]
└── Running AI Agent (LangChain/CrewAI/AutoGen)
└── Tracely SDK (Decorators)

▼ (Async Background HTTP POST /ingest)
[ Vercel Serverless / API Gateway ] ─── (Validates SWARMTRACE_API_KEY)

▼ (Writes Log Payload)
[ Hosted Database: Supabase / Postgres ]
└── traces table (Schema: id, user_id, execution_time, trace_payload)

│ (Fetches user-specific traces via Clerk JWT auth)
[ Vercel Frontend: Next.js + Clerk ]
└── Protected Dashboard View (Only shows rows matching user_id)
🗂️ The Technical Roadmap
To pull this off, we have to transform four key elements of your repository:

  1. The SDK (tracely/scraper.py & tracer.py)
    Current: Writes to a local SQLite database via storage.py.

SaaS Modification: Introduce a background background-worker thread or async pool. When a trace finishes, it sends an HTTP POST request to https://api.swarmtrace.dev/v1/ingest carrying the payload and an Authorization: Bearer st_live_… header.

  1. The Backend Engine (api.py)
    Current: Reads from local SQLite.

SaaS Modification: Drop SQLite. Migrate to a hosted Postgres instance (Supabase is perfect here).

Add an /ingest route for incoming agent metrics.

Add middleware to validate incoming user requests from the frontend using Clerk JWT tokens.

  1. The Authentication Layer (Clerk)
    Wrap your frontend-next/ layout inside a .

Set up a pipeline where a user logs in, generates an “Agent API Key” from their settings dashboard, and pastes that key into their Python .env file.
also tracely is maded by me it is the part of swarm trace.

0

Comments 0

No comments yet. Be the first!