zhourenke/dsh-agent-rate-limit

zhourenke★ 0TypeScript最后同步: 2026-08-18

在 GitHub 打开

README 摘要

@zhourenke/dsh-agent-rate-limit English 中文 Agent loop rate limiter — prevents TPM (Tokens Per Minute) and RPM (Requests Per Minute) limit violations by intercepting the LLM streaming pipeline and adding adaptive delays between requests. When model providers enforce rate limits (e.g., Alibaba Cloud Bailian's 15,000 RPM + 1,200,000 TPM for deepseek-v4-flash), the agent loop can trigger these limits every few steps, causing errors and interruptions. This plugin solves that by: - Tracking token usage in a sliding 60-second window - Estimating input tokens from messages before each request - Counting output tokens from stream chunks as they arrive - Adding adaptive delays when approaching TPM or RPM limits - Exponential backoff on rate-limit errors (auto-retry with { kind: 'retry' } ) How it works The plugin intercepts two Waterfall events: Event Purpose llm/stream Check rate limits → delay if needed → stream tokens → count output tokens → update window agent/request-error Detect rate-limit errors (429) → return { kind: 'retry' } with exponential backoff Installation This plugin is a DSH profile bundle . The only supported installation method is to place the package folder directly into…

在 GitHub 查看完整 README →
Agent/智能体dsh-pluginagent

分类