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/altaidevorg/rules-for-aiWrote 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/altaidevorg/rules-for-ai/runner)<a href="https://agentmods.dev/rules/altaidevorg/rules-for-ai/runner"><img src="https://agentmods.dev/badge/rules/altaidevorg/rules-for-ai/runner/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/altaidevorg/rules-for-ai/runner"><img src="https://agentmods.dev/badge/rules/altaidevorg/rules-for-ai/runner.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.03155 | $0.03155 |
| Opus 5.5 | $0.01262 | $0.01262 |
| Sonnet 5.5 | $0.00631 | $0.00631 |
| Haiku 4.5 | $0.00315 | $0.00315 |
Grade A, and why
runner 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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 235 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Chapter 1: Runner
Welcome to the google-adk tutorial! This first chapter introduces the Runner, a fundamental component responsible for managing the entire lifecycle of an agent interaction within the framework.
Motivation and Use Case
Imagine you have built an agent, perhaps using an LLM, that can interact with users. How do you actually run this agent? You need a system that can:
- Receive user input.
- Maintain the conversation history (Session).
- Manage persistent state (State).
- Handle file uploads/downloads (Artifacts).
- Potentially retrieve relevant long-term memories.
- Invoke the correct agent logic.
- Stream back the agent's response (Events).
- In complex systems with multiple agents, decide which agent should handle the current turn.
The Runner is the orchestrator that handles all these tasks. It acts as the main entry point for interacting with any agent built using google-adk.
Central Use Case: A user sends a message ("What's the weather in London?") to your weather agent via an application. The application uses a Runner instance. The Runner retrieves the ongoing conversation session, appends the new user message, determines the weather agent should handle it, calls the agent's execution logic, and streams the resulting events (like the agent thinking, calling a weather tool, and finally responding) back to the application.
Key Concepts
- Orchestration: The
Runnercoordinates the flow of information and control between the user, the agent(s), and various backing services. - Agent Execution: It provides methods like
run_async(asynchronous, recommended for production) andrun(synchronous wrapper for testing) to execute an agent turn. It also supports an experimentalrun_livefor real-time streaming interactions (e.g., voice). - Service Integration: It requires and utilizes services for managing different aspects of the interaction:
BaseSessionService: Manages conversational Sessions, including history (Events) and State.BaseArtifactService: Handles storage and retrieval of binary data (e.g., files uploaded by the user or generated by the agent). (Optional)BaseMemoryService: Provides access to long-term memory for the agent. (Optional)
- Agent Selection: In systems with a hierarchy of agents (an agent containing sub-agents), the
Runnerdetermines which agent is best suited to handle the current turn based on the session history and agent capabilities (using_find_agent_to_run). It checks if the last responding agent can "transfer" control back up the hierarchy if needed. - Input Processing: Before invoking the agent, the
Runnerprocesses the incoming user message (new_message). This includes potentially saving any attached binary data as artifacts (ifsave_input_blobs_as_artifactsis true in theRunConfig) and appending the user message as an Event to the Session. - Event Streaming: The
run_asyncandrun_livemethods are asynchronous generators thatyieldEvents as they occur during the agent's execution (e.g., intermediate thoughts, tool calls, final response parts).
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.
- 2mo ago First seen · 235 lines · 3,155 tokens per session scan A 0cbfbc2f89b9
runner is a cursor rule published in the GitHub repository altaidevorg/rules-for-ai (2 stars, last pushed 1y ago), licensed MIT. It adds 3,155 tokens to every session, about $0.0126 per session on Opus 5.5. 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.
Other cursor rules, from other repositories
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
config-validation-and-normalization
Config validation and normalization responsibilities (defineConfig normalizes, the orm section schema validates and resolves paths, the loader reports per-section diagnostics).
control-plane-descriptors
Control plane descriptor and instance implementation patterns.