Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/WangTingYeYe/llm-agent-studyWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/wangtingyeye/llm-agent-study/gradio)<a href="https://agentmods.dev/rules/wangtingyeye/llm-agent-study/gradio"><img src="https://agentmods.dev/badge/rules/wangtingyeye/llm-agent-study/gradio/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/wangtingyeye/llm-agent-study/gradio"><img src="https://agentmods.dev/badge/rules/wangtingyeye/llm-agent-study/gradio.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.00507 |
| Opus 5.5 | $0.00000 | $0.00203 |
| Sonnet 5.5 | $0.00000 | $0.00101 |
| Haiku 4.5 | $0.00000 | $0.00051 |
Grade A, and why
gradio scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
description: 该规则解释了 Gradio 机器学习模型部署和客户端调用的约定和最佳实践。 globs: **/*.py alwaysApply: false
Gradio 规则
客户端使用规范
- 使用
gradio_client库而非完整的gradio包以获得更轻量级的体验 - 安装命令:
pip install gradio_client - 使用
Client类连接到 Gradio 应用:client = Client("app_url")
API 调用规范
- 使用
client.predict()进行阻塞式 API 调用,直接获取结果 - 使用
client.submit()进行非阻塞式调用,返回 Job 对象用于后台处理 - 文件参数使用
file()函数包装:file("path/to/file") - API 调用时使用与原应用相同的关键字参数名称
流式处理规范
- 对于流式输出,使用
submit()方法并迭代结果:
for result in client.submit("prompt"):
print(result)
错误处理规范
- 确保上游应用设置
show_error=True或使用gr.Error异常 - 客户端会抛出与上游应用相同的异常
- 使用适当的异常处理机制捕获和处理错误
作业管理规范
- 使用
job.status()检查作业状态和队列位置 - 使用
job.done()检查作业是否完成 - 支持作业取消和队列状态监控
- 在长时间运行的任务中定期检查作业状态
部署和集成规范
- 客户端可在任何 Python 环境中运行(包括 Flask、Django 等)
- 支持 Hugging Face Spaces 以及自定义服务器
- 在生产环境中使用时考虑认证和安全性
- 使用合适的超时设置避免长时间阻塞
最佳实践
- 对于生产应用,使用非阻塞的
submit()方法 - 实现适当的重试机制处理网络问题
- 在多线程环境中注意客户端的线程安全性
- 缓存客户端实例避免重复连接开销
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 61 lines · 0 tokens per session scan A 1d95c326b398
gradio is a cursor rule published in the GitHub repository WangTingYeYe/llm-agent-study (4 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 507 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
gradio compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| gradioWangTingYeYe/llm-agent-study | Cursor rule | 4 | 1y ago | MIT | A | 0 | Cursor |
| python_testsstreamlit/streamlit | Cursor rule | 47k | today | Apache-2.0 | A | 0 | Cursor |
| djangosanjeed5/awesome-cursor-rules-mdc | Cursor rule | 3.6k | 9d ago | CC0-1.0 | A | 2,043 | Cursor |
| richsanjeed5/awesome-cursor-rules-mdc | Cursor rule | 3.6k | 9d ago | CC0-1.0 | A | 1,749 | Cursor |
| python-llm-ml-workflow-cursorrules-prompt-filePatrickJS/awesome-cursorrules | Cursor rule | 41k | 6mo ago | CC0-1.0 | A | 1,530 | Cursor |
| pythonPatrickJS/awesome-cursorrules | Cursor rule | 41k | 6mo ago | CC0-1.0 | A | 734 | Cursor |
| python-containerization-cursorrules-prompt-filePatrickJS/awesome-cursorrules | Cursor rule | 41k | 6mo ago | CC0-1.0 | A | 56 | Cursor |