Skip to content

feat: multi-tenant cloud architecture for AgentWatch Cloud (closes #394)#460

Open
arcgod-design wants to merge 4 commits into
sreerevanth:mainfrom
arcgod-design:feat/issue-394-cloud-saas
Open

feat: multi-tenant cloud architecture for AgentWatch Cloud (closes #394)#460
arcgod-design wants to merge 4 commits into
sreerevanth:mainfrom
arcgod-design:feat/issue-394-cloud-saas

Conversation

@arcgod-design

Copy link
Copy Markdown
Contributor

Summary

Implements multi-tenant cloud architecture for AgentWatch to support managed SaaS deployments (PLT-007).

Changes

New Files

  • �gentwatch/models/tenant.py — Tenant, ApiKey, UsageRecord models with plan tiers (Free/Starter/Professional/Enterprise)
  • �gentwatch/core/config.py — CloudConfig with environment variable loading
  • �gentwatch/api/tenant_auth.py — TenantStore with API key CRUD, usage tracking, and rate limiting
  • �gentwatch/telemetry/ingestion.py — TenantIngestionPipeline with per-tenant rate limiting, batching, and usage recording

Modified Files

  • �gentwatch/core/models.py — Added enant_id column to SessionRecord, EventRecord, MemoryEntryRecord with indexes
  • �gentwatch/api/server.py — Tenant-aware API key guard, tenant management endpoints (CRUD, API keys, usage)

Acceptance Criteria

  • Multi-tenant data isolation enforced at ORM layer ( enant_id on all models)
  • Users can generate and revoke API keys via the API
  • Events are properly attributed to the correct enant_id via ingestion pipeline
  • Per-tenant usage tracking for Stripe billing integration

API Endpoints Added

Method Path Description
POST /api/v1/tenants Create tenant
GET /api/v1/tenants List tenants
GET /api/v1/tenants/{id} Get tenant
POST /api/v1/tenants/{id}/api-keys Generate API key
GET /api/v1/tenants/{id}/api-keys List API keys
DELETE /api/v1/tenants/{id}/api-keys/{key_id} Revoke API key
GET /api/v1/tenants/{id}/usage Get usage stats

Testing

  • Ruff lint: ✅
  • Ruff format: ✅
  • Existing tests pass (83 tests)

Closes #394

…eerevanth#394)

- agentwatch/models/tenant.py: Tenant, ApiKey, UsageRecord models with plan tiers
- agentwatch/core/config.py: CloudConfig with env var loading
- agentwatch/api/tenant_auth.py: TenantStore with API key CRUD and usage tracking
- agentwatch/telemetry/ingestion.py: TenantIngestionPipeline with rate limiting and batching
- agentwatch/core/models.py: Add tenant_id column to SessionRecord, EventRecord, MemoryEntryRecord
- agentwatch/api/server.py: Tenant-aware API key guard, tenant management endpoints

Acceptance Criteria:
- Multi-tenant data isolation enforced at ORM layer (tenant_id on all models)
- API key generation and revocation per tenant
- Events attributed to correct tenant_id via ingestion pipeline
- Per-tenant usage tracking for billing integration
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@arcgod-design, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 26 minutes and 1 second. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 34032c2c-b55e-4edf-904a-a7f6a342c52d

📥 Commits

Reviewing files that changed from the base of the PR and between fdc8184 and 1bf17be.

📒 Files selected for processing (7)
  • agentwatch/api/server.py
  • agentwatch/api/tenant_auth.py
  • agentwatch/core/config.py
  • agentwatch/core/models.py
  • agentwatch/models/__init__.py
  • agentwatch/models/tenant.py
  • agentwatch/telemetry/ingestion.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🧪 PR Test Results

Check Result
Tests (pytest tests/) ✅ success
Lint (ruff check .) ❌ failure
Coverage (agentwatch) 73.30%

Python 3.12 · commit 1bf17be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Premium] PLT-007: AgentWatch Cloud (Managed SaaS Deployment)

1 participant