# 속도 제한 및 쓰로틀링

### **보안 고려사항**

```javascript
/**
 * API 호출을 위한 간단한 속도 제한기
 */
const rateLimiter = {
  lastCallTime: 0,
  minInterval: 200, // 200ms = 초당 5회 호출
  
  async limit<T>(fn: () => Promise<T>): Promise<T> {
    const now = Date.now();
    const timeToWait = this.lastCallTime + this.minInterval - now;
    
    if (timeToWait > 0) {
      await new Promise(resolve => setTimeout(resolve, timeToWait));
    }
    
    this.lastCallTime = Date.now();
    return fn();
  }
};

// 사용 예시
async function testBuyer() {
  // 속도 제한을 적용해 에이전트 탐색
  const agents = await rateLimiter.limit(() => 
    acpClient.browseAgent("aixbt", "hedgefund")
  );
  
  // 속도 제한을 적용해 각 에이전트 처리
  for (const agent of agents) {
    // 각 API 호출에 속도 제한 적용
    const details = await rateLimiter.limit(() => 
      acpClient.getAgentDetails(agent.id)
    );
    
    // 세부 정보로 무언가 수행...
  }
  
  // 속도 제한을 적용해 작업 시작
  if (selectedOffering) {
    const jobId = await rateLimiter.limit(() => 
      selectedOffering.initiateJob(serviceRequirement, expiredAt)
    );
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaper.virtuals.io/virtuals-protocol-whitepaper-ko/acp/acp-dev/best-practices-guide/rate-limiting-and-throttling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
