Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /limit_request_rate /stateset_stateset-agents.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Entity", | |
| "status": "missing", | |
| "symbol": "", | |
| "file": "", | |
| "lines": "", | |
| "notes": "The caller of the FastAPI app (stateset_agents/api/main.py) is an outside HTTP client. Looked at stateset_agents/cli_remote.py:397 and stateset_agents/remote/serve_session.py:604, but they only print curl commands for, or call, remote serving pods (/v1/chat/completions), not the in-repo rate-limited API. Tests do not count." | |
| }, | |
| { | |
| "role": "Enforcer", | |
| "status": "present", | |
| "symbol": "dispatch", | |
| "file": "stateset_agents/api/middleware.py", | |
| "lines": "494", | |
| "notes": "dispatch in RateLimitMiddleware (a Starlette BaseHTTPMiddleware) is registered by setup_middleware at stateset_agents/api/middleware.py:772, which create_app calls at stateset_agents/api/main.py:224. It derives the bucket id with _rate_limit_key (a hashed validated API key/JWT, otherwise the client IP), calls _check_rate_limit at line 515 and returns HTTP 429 with Retry-After when the request is blocked. Otherwise it calls call_next." | |
| }, | |
| { | |
| "role": "Limiter", | |
| "status": "present", | |
| "symbol": "check", | |
| "file": "stateset_agents/api/rate_limiter.py", | |
| "lines": "56", | |
| "notes": "Reached from Enforcer dispatch via _check_rate_limit (middleware.py:431, :471) and then UnifiedRateLimiter.is_allowed (rate_limiter.py:125). check in UnifiedRateLimiter prunes expired timestamps, compares the count against the limit and returns RateLimitResult(allowed=...). The default backend is 'memory'. An optional Redis fixed-window limiter (RedisSlidingWindowLimiter.is_allowed, middleware.py:292) is used only when API_RATE_LIMIT_BACKEND=redis." | |
| }, | |
| { | |
| "role": "HistoryProvider", | |
| "status": "present", | |
| "symbol": "_windows", | |
| "file": "stateset_agents/api/rate_limiter.py", | |
| "lines": "49", | |
| "notes": "The Limiter check reads history at rate_limiter.py:73 (self._windows[key]) and updates it at :93 (window.append(now)). _windows is an in-memory dict of per-key timestamp deques in UnifiedRateLimiter. It is cited as a field because no separate get or update method exists; the access is inline in check. cleanup (line 154) prunes it periodically from dispatch." | |
| }, | |
| { | |
| "role": "PolicyProvider", | |
| "status": "present", | |
| "symbol": "from_env", | |
| "file": "stateset_agents/api/config.py", | |
| "lines": "204", | |
| "notes": "RateLimitConfig.from_env loads requests_per_minute (API_RATE_LIMIT_PER_MIN, default 60), window_seconds and enabled from the environment. dispatch reads it via get_config() (config.py:406) and passes config.rate_limit.requests_per_minute to the Limiter at middleware.py:515-517, and the window into UnifiedRateLimiter at middleware.py:410. One global policy applies to all ids; the Limiter receives the policy as an argument and does not fetch it." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "chat_v1", | |
| "file": "stateset_agents/api/routers/v1.py", | |
| "lines": "497", | |
| "notes": "When the request is allowed, Enforcer dispatch forwards it via call_next (middleware.py:552) to the routed handlers included in main.py:227-234. Example: chat_v1 in the v1 router (prefix /api/v1, POST /conversations), which runs inference. Every non-health route is behind the same middleware." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 3.41 kB
- Xet hash:
- 785ac9617659205c161bd3be981ad0e92ac97a34ce1e178dc48633c6fdd914e7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.