Skip to main content
Loading navigation

Build a Multi-Tenant Token Budget and Latency Guardrail Sentinel

Monitor real-time client API token consumption and request durations across internal enterprise teams calling hosted Claude. Reconcile departmental budgets and formulate token quota adjustments.

EngineeringHosted by Vera

What you are building

Monitor real-time client API token consumption and request durations across internal enterprise teams calling hosted Claude. Reconcile departmental budgets and formulate token quota adjustments.

Enterprise AI Governance Manager

Ingest structured client proxy logs recording tenant headers, token tallies, and response latencies.

Reconcile daily token burn against allocated departmental monthly spending caps.

Detect abnormal burst token usage or runaway agent loops from specific tenant API keys.

Generate a Claude-assisted governance digest with suggested dynamic rate-limit thresholds.

Executive compliance web dashboard showing tenant quota consumption and automated alerts.

Construct a synthetic JSONL log of 10,000 proxy calls representing 5 distinct enterprise business units. Starter examples below are synthetic. They are not downloaded records.

Anthropic Python SDK Apply Anthropic client message interaction models and token tracking fields from the official Python SDK.

pydantic-ai, anthropic, sqlite3. pydantic-ai parses multi-tenant budget configurations and guarantees validated governance rules. Hosted Claude API accessed through the official Python SDK for anomaly narrative generation.

Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

Aggregates token consumption across multiple tenant API keys within configurable time windows.

Flags tenant keys exceeding 90 percent of allocated budget or displaying runaway retry volume.

Produces structured JSON budget enforcement actions for API gateway quota middleware.

```json [ { "input": { "tenant_id": "customer-analytics", "monthly_budget_usd": 500, "mtd_spend_usd": 485.5, "consecutive_error_spikes": 34, "avg_latency_ms": 1850 }, "expected_output": { "budget_status": "NEAR_EXHAUSTION", "utilization_pct": 97.1, "action": "THROTTLE_TIER_2", "gateway_directive": "enforce_rate_limit_10_rpm" } }, { "input": { "tenant_id": "hr-operations", "monthly_budget_usd": 200, "mtd_spend_usd": 45, "consecutive_error_spikes": 0, "avg_latency_ms": 950 }, "expected_output": { "budget_status": "NORMAL", "utilization_pct": 22.5, "action": "ALLOW", "gateway_directive": "standard_quota" } } ] ```

Monitors client-side usage data only without modifying Anthropic organization credentials or production firewalls. Use mock external writes. Require human review before any real deployment.

Rules

Monitors client-side usage data only without modifying Anthropic organization credentials or production firewalls. Use mock external writes and human review.

How work is evaluated

Evaluation

Aggregates token consumption across multiple tenant API keys within configurable time windows. Flags tenant keys exceeding 90 percent of allocated budget or displaying runaway retry volume. Produces structured JSON budget enforcement actions for API gateway quota middleware.

Submission format

Runnable source, pinned dependencies, setup commands, working interface, example outputs, recorded demo, tests, and action logs.

Datasets

Public datasets, plus the private datasets you have access to.

How submissions are scored

Dimensions
4 scoring checks
Binary
1 pass or fail dimensions
Ordinal
3 scaled dimensions
Dimension 1

Complete workflow

Ingest structured client proxy logs recording tenant headers, token tallies, and response latencies. Reconcile daily token burn against allocated departmental monthly spending caps. Detect abnormal burst token usage or runaway agent loops from specific tenant API keys. Generate a Claude-assisted governance digest with suggested dynamic rate-limit thresholds.

Score scale
012
Score 0

Missing or incorrect.

Score 1

Partly complete, with documented gaps.

Score 2

Complete, with reproducible evidence.

Dimension 2

Correctness and evidence

Aggregates token consumption across multiple tenant API keys within configurable time windows. Flags tenant keys exceeding 90 percent of allocated budget or displaying runaway retry volume. Produces structured JSON budget enforcement actions for API gateway quota middleware.

Score scale
012
Score 0

Missing or incorrect.

Score 1

Partly complete, with documented gaps.

Score 2

Complete, with reproducible evidence.

Dimension 3

Review interface

Executive compliance web dashboard showing tenant quota consumption and automated alerts.

Score scale
012
Score 0

Missing or incorrect.

Score 1

Partly complete, with documented gaps.

Score 2

Complete, with reproducible evidence.

Dimension 4

Safe execution

Monitors client-side usage data only without modifying Anthropic organization credentials or production firewalls.

Binary check

This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.

Learning goals

  • Ingest structured client proxy logs recording tenant headers, token tallies, and response latencies.

  • Reconcile daily token burn against allocated departmental monthly spending caps.

  • Detect abnormal burst token usage or runaway agent loops from specific tenant API keys.

  • Generate a Claude-assisted governance digest with suggested dynamic rate-limit thresholds.

Resources

Dataset notes

Construct a synthetic JSONL log of 10,000 proxy calls representing 5 distinct enterprise business units. Supplied starter examples are synthetic, not source extracts.

Challenge setup

Challenge input

Input details are not configured.

Pydantic AI

Typed Python agent framework.

Evaluated output

No output checks are configured.

Evaluation checks
  • Ingest structured client proxy logs recording tenant headers, token tallies, and response latencies. Reconc...
  • Aggregates token consumption across multiple tenant API keys within configurable time windows. Flags tenant...
  • Executive compliance web dashboard showing tenant quota consumption and automated alerts.
Configured evaluation evidence
  • 2 public reference cases
Configured runtime
  • 2 configured tools

Shows the first task, up to three tools, and up to three evidence items.

View technical recipe

Configured tools

Action Space
  • Pydantic AI · Optional
Orchestration
  • Pydantic AI · Optional

Evaluation contract

  • Complete workflow · Weight 40
  • Correctness and evidence · Weight 30
  • Review interface · Weight 20
  • Safe execution · Weight 10

Reference cases

  • 2 public reference cases

Workflow tasks

No workflow tasks are configured.

Recipe freeze marker

No recipe freeze time is recorded.

Frequently Asked Questions about Build a Multi-Tenant Token Budget and Latency Guardrail Sentinel