Skip to content

Rate limit tokens per minute #1086

@widarlein

Description

@widarlein

Hi!

First of all thanks for what seems like a great framework! Seems like so much thought was put into this, well done!

Secondly, I'm hitting a rate limit quota when using google Gemini and the playwright MCP. The moment the rate limit is hit, the execution stops. Is there a way of limiting the speed of the agent execution in order to not hit the ceiling of tokens per minute?

Agent setup:

Agent(
    instructions="You are an autonomous agent...",
    api_key = api_key,
    llm="gemini/gemini-2.5-flash",
    tools=MCP(
        command="npx",
        args=["@playwright/mcp@latest"],
        timeout=120,
    ),
    self_reflect=True,
    verbose=True
)

The error I'm getting:

{
    "error": {
        "code": 429,
        "message": "You exceeded your current quota, please check your plan and billing details. For more information on this error, head to: https://ai.google.dev/gemini-api/docs/rate-limits.",
        "status": "RESOURCE_EXHAUSTED",
        "details": [
            {
                "@type": "type.googleapis.com/google.rpc.QuotaFailure",
                "violations": [
                    {
                        "quotaMetric": "generativelanguage.googleapis.com/generate_content_paid_tier_input_token_count",
                        "quotaId": "GenerateContentPaidTierInputTokensPerModelPerMinute",
                        "quotaDimensions": {
                            "location": "global",
                            "model": "gemini-2.5-flash"
                        },
                        "quotaValue": "1000000"
                    }
                ]
            },
            {
                "@type": "type.googleapis.com/google.rpc.Help",
                "links": [
                    {
                        "description": "Learn more about Gemini API quotas",
                        "url": "https://ai.google.dev/gemini-api/docs/rate-limits"
                    }
                ]
            },
            {
                "@type": "type.googleapis.com/google.rpc.RetryInfo",
                "retryDelay": "58s"
            }
        ]
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions