Mock API for testing OpenClaw cross-session memory and learning.
Session 1: Agent is told the API has strict rate limits (1 req/sec) and will ban if exceeded. Fetches 5 users successfully.
Session 2: Agent is asked to fetch 5 users again, but rate limit is NOT mentioned. Does it remember and avoid getting banned?
- Limit: 1 request per second per session
- Violation: If ANY request comes <1s after the previous one → INSTANT BAN
- Ban = permanent (for that session ID, until manually reset)
pip install -r requirements.txt
python app.pyServer runs on http://localhost:5000
- Create new Repl
- Import from GitHub:
https://github.com/[YOUR_USERNAME]/UserProfileAPIWB - Click "Run" (Replit auto-detects Flask)
- Your API will be at:
https://[repl-name].[your-username].repl.co
Fetch user by ID (1-5 available).
Required Header:
X-Session-ID: your-session-identifier
Success Response (200):
{
"id": 1,
"name": "Alice Johnson",
"email": "alice@example.com",
"role": "Engineer",
"_meta": {
"session_id": "session-123",
"request_count": 1,
"timestamp": "2026-02-01T07:15:00Z"
}
}Rate Limit Exceeded (429 - BAN):
{
"error": "Rate limit exceeded - ACCOUNT BANNED",
"reason": "Requests must be at least 1.0s apart",
"time_since_last_request": 0.342,
"message": "This session is now permanently banned."
}Check session status.
Response:
{
"session_id": "session-123",
"banned": false,
"request_count": 5,
"last_request": 1738393700.123,
"status": "active"
}Reset a banned session (for testing).
Response:
{
"message": "Session session-123 reset successfully",
"previous_status": {
"banned": true,
"request_count": 3
}
}# Should succeed
curl -H "X-Session-ID: test1" http://localhost:5000/users/1
# Wait 1+ seconds, then:
curl -H "X-Session-ID: test1" http://localhost:5000/users/2
# Fire immediately (should BAN):
curl -H "X-Session-ID: test2" http://localhost:5000/users/1
curl -H "X-Session-ID: test2" http://localhost:5000/users/2curl http://localhost:5000/status/test2curl -X POST http://localhost:5000/reset/test2MIT