Skip to content

docs(agents): update agent instructions to honor API rate limits and quotas #129

Closed

Description

@dan-petty

Problem Statement

AI agents (Claude, Copilot, Cursor, Codex) interacting with external APIs (GitHub REST/GraphQL, LLM inference endpoints, container registries, Valkey/Qdrant, and remote observability backends) can encounter HTTP 429 Too Many Requests, secondary rate limits, or GraphQL node/complexity exhaustion during high-frequency operations, batch scans, and multi-step reviews. Currently, AGENTS.md and src/devops_cli/ai/instruction_generator.py lack explicit instructions directing AI agents to proactively inspect, respect, and adapt to API rate limits.

Proposed Architectural Solution

  1. Update AGENTS.md with explicit policies and operational guidelines for honoring API rate limits:
    • Proactive Rate Limit Inspection & Budgeting: Instruct agents to monitor rate limits (gh api rate_limit, x-ratelimit-remaining, x-ratelimit-reset, HTTP 429, Retry-After).
    • GraphQL vs REST Adaptive Fallback: Fall back gracefully from complexity-constrained or rate-limited GraphQL queries to targeted REST API endpoints.
    • Exponential Backoff with Jitter: Avoid tight busy-waiting retry loops; respect reset windows and back off dynamically.
    • Batching & Caching: Maximize local cache utilization (.data/, Valkey) and batch requests to minimize external roundtrips.
    • LLM Token & Concurrency Rate Limits: Honor token-per-minute (TPM) and request-per-minute (RPM) quotas, adaptive batching, and semaphore-bounded concurrency.
  2. Synchronize src/devops_cli/ai/instruction_generator.py so newly scaffolded agent instructions inherit rate limiting rules.
  3. Validate all documentation and test suites with devops docs check and targeted tests.

Acceptance Criteria

  • AGENTS.md updated with dedicated rate limit guidelines under Section 1 (Engineering Philosophy) and Section 3 (GitHub & Remote API Integration).
  • src/devops_cli/ai/instruction_generator.py updated to match canonical instructions.
  • Unit tests in tests/test_instruction_generator.py updated and passing.
  • Full devops docs check passes with zero drift.

Activity

  1. added this to the v0.2.16 milestone on Sep 10, 2026
  2. added
    type/docs
    scope/ai
    priority/p2-medium
    status/in-progress
    on Sep 10, 2026
  3. added 2 commits that reference this issue on Sep 10, 2026
    0bcf652
    1bdbf51
  4. added a commit that references this issue on Sep 12, 2026
    2ed28d4
  5. removed
    status/in-progress
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2-mediumscope/aitype/docs

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions