agent2: Cursor rule for Cursor

.cursorrules

cursorrules is a cursor rule for Cursor from Artesiana/agent2. It costs 399 tokens per session, scanned A, original, MIT.

A set of coding rules for Agent2, a Python framework for building AI agents with web APIs, authentication, approvals, and knowledge search.

In plain words
What is it for?
Use it when creating or modifying Agent2 agents, their tools, configuration, API services, prompts, and typed outputs.
Why use it?
It keeps agent code consistent and prevents developers from bypassing the framework’s required structure and shared runtime.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

This is Artesiana/agent2's own configuration. It tells Cursor how to work on agent2 itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything agent2 configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Artesiana/agent2. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Artesiana/agent2/main/.cursorrules
Clone the repo
git clone --depth 1 https://github.com/Artesiana/agent2

Made for: Cursor.

Wrote 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.

agentmods badge for cursorrules

README.md
[![agentmods](https://agentmods.dev/badge/rules/artesiana/agent2/cursorrules/github.svg)](https://agentmods.dev/rules/artesiana/agent2/cursorrules)
Your own site
<a href="https://agentmods.dev/rules/artesiana/agent2/cursorrules"><img src="https://agentmods.dev/badge/rules/artesiana/agent2/cursorrules/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.

agentmods 80×15 button for cursorrules

Your own site · 80×15
<a href="https://agentmods.dev/rules/artesiana/agent2/cursorrules"><img src="https://agentmods.dev/badge/rules/artesiana/agent2/cursorrules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 399 This file is loaded in full into every session.
When invoked 399 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00399 $0.00399
Opus 5.5 $0.00160 $0.00160
Sonnet 5.5 $0.00080 $0.00080
Haiku 4.5 $0.00040 $0.00040

Measured 2mo ago against content hash 8087baa08bc4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cursorrules scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- Docker: docker compose up -d && curl localhost:8001/health
.cursorrules · 40 lines

What it actually says

Agent2 — Production Runtime for AI Agents

What this repo is

Agent2 is a framework for building production AI agents with typed HTTP APIs. PydanticAI handles the agent loop. Agent2 handles everything else: API, auth, pause/resume, approvals, provider routing, knowledge search.

Key patterns

  • Agents live in agents// with: schemas.py, agent.py, tools.py, config.yaml, main.py
  • create_agent() from shared/runtime.py is the ONLY way to build agents
  • create_app() from shared/api.py is the ONLY way to build FastAPI apps
  • Use instructions= (not system_prompt=) for agent prompts
  • Use toolsets= for MCP server connections
  • Output schemas are Pydantic BaseModel classes passed as output_type=

Code style

  • Python 3.12+, type hints on all signatures
  • from future import annotations in all shared/ modules
  • RFC 7807 error responses via ProblemError
  • Config uses frozen dataclasses with from_env(), not pydantic-settings
  • OpenRouter models: OpenAIChatModel + OpenRouterProvider

Architecture rules

  • shared/ is framework code — never modify it for agent-specific logic
  • Each agent is a separate Docker service
  • Prompts are code-first; Langfuse is optional for observability
  • Knowledge is in R2R, accessed via Knowledge MCP

Testing

  • uv run pytest tests/ -v (unit tests, no Docker needed)
  • Docker: docker compose up -d && curl localhost:8001/health

Creating a new agent

  1. cp -r agents/_template agents/my-agent
  2. Edit schemas.py (Pydantic output model)
  3. Edit agent.py (create_agent + tools)
  4. Edit config.yaml (name, model, collections)
  5. Edit main.py (create_app call)
  6. Add to docker-compose.yml
Changes

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.

  1. 2mo ago First seen · 40 lines · 399 tokens per session scan A 8087baa08bc4

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository Artesiana/agent2 (37 stars, last pushed 6mo ago), licensed MIT. It adds 399 tokens to every session, about $0.0016 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

cursorrules compared with cursor rules from other repositories

cursorrules next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
cursorrulesArtesiana/agent2Cursor rule376mo agoMITA399Cursor
cursor-aidumemmonkey2jack/aiduMEICursor rule212d agoMITA0Cursor
desktop-release-gateopensquad-ai/opensquadCursor rule717d agoMITA0Cursor
branch-dev-mainopensquad-ai/opensquadCursor rule717d agoMITA187Cursor
commitPukakiii/Job-AgentCursor rule24mo agononeA123Cursor
rolesPukakiii/Job-AgentCursor rule24mo agononeA23Cursor
global-rulesPukakiii/Job-AgentCursor rule24mo agononeA17Cursor