cursorrules

Project rules for building Python applications with the Agno framework, including applications where software agents perform tasks using models and tools.

In plain words
What is it for?
It helps guide Agno agent code, including agent reuse, structured outputs, database selection, and documentation or example-writing conventions.
Why use it?
It keeps implementation choices consistent, such as how agents are created, how responses are structured, and which databases are used in development and production.

Cursor rule for Cursor

Install

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.

agentmods
npx agentmods add rules/agno-agi/agno/cursorrules
Clone the repo
git clone --depth 1 https://github.com/agno-agi/agno

Made for: Cursor.

Per session 1,090 This file is loaded in full into every session.
When invoked 1,090 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.01090 $0.01090
Opus 5 $0.00545 $0.00545
Sonnet 5 $0.00218 $0.00218
Haiku 4.5 $0.00109 $0.00109

Measured yesterday against content hash d400f5971f06, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cursorrules 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 yesterday.

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.

.cursorrules · 187 lines

How it starts

The opening of the file, as written. The whole thing — 187 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert in Python, Agno framework, and AI agent development.

Core Rules

  • NEVER create agents in loops - reuse them for performance
  • Always use output_schema for structured responses
  • PostgreSQL in production, SQLite for dev only
  • Start with single agent, scale up only when needed

Documentation:

  • Don't use f-strings for print lines where there are no variables to format.
  • Don't use emojis in examples and print lines

Basic Agent (start here):

from agno.agent import Agent
from agno.models.openai import OpenAIResponses

agent = Agent(
    model=OpenAIResponses(id="gpt-5.5"),
    instructions="You are a helpful assistant",
    markdown=True,
)
agent.print_response("Your query", stream=True)

Agent with Tools:

from agno.tools.websearch import WebSearchTools

agent = Agent(
    model=OpenAIResponses(id="gpt-5.5"),
    tools=[WebSearchTools()],
    instructions="Search the web for information",
)

CRITICAL: Agent Reuse Performance

# WRONG - Recreates agent every time (significant overhead)
for query in queries:
    agent = Agent(...)  # DON'T DO THIS
    
# CORRECT - Create once, reuse
agent = Agent(...)
for query in queries:
    agent.run(query)

When to Use Each Pattern

Single Agent (90% of use cases):

  • One clear task or domain
  • Can be solved with tools + instructions
  • Example: Search, analyze, generate content

Team (autonomous coordination):

  • Multiple specialized agents with different expertise
  • Agents decide who does what via LLM
  • Complex tasks requiring multiple perspectives
  • Example: Research + Analysis + Writing

Workflow (programmatic control):

  • Sequential steps with clear flow
  • Need conditional logic or branching
  • Full control over execution order
  • Example: Extract → Transform → Load pipelines

Team Pattern:

from agno.team.team import Team

web_agent = Agent(
    name="Researcher",
    model=OpenAIResponses(id="gpt-5.5"),
    tools=[WebSearchTools()],
)

writer_agent = Agent(
    name="Writer",
    model=OpenAIResponses(id="gpt-5.5"),
)

team = Team(
    members=[web_agent, writer_agent],
    model=OpenAIResponses(id="gpt-5.5"),
    instructions="Research and write articles",
)

Workflow Pattern:

from agno.workflow.workflow import Workflow
from agno.db.sqlite import SqliteDb

# Define agents first (researcher, writer)
async def blog_workflow(session_state, topic: str):
    # Step 1: Research
    research = await researcher.arun(topic)
    
    # Step 2: Write
    article = await writer.arun(research.content)
    
    return article

workflow = Workflow(
    name="Blog Generator",
    steps=blog_workflow,
    db=SqliteDb(db_file="tmp/workflow.db"),
)

Knowledge/RAG:

from agno.knowledge.knowledge import Knowledge
from agno.vectordb.lancedb import LanceDb, SearchType
from agno.knowledge.embedder.openai import OpenAIEmbedder

knowledge = Knowledge(
    vector_db=LanceDb(
        uri="tmp/lancedb",
        table_name="knowledge_base",
        search_type=SearchType.hybrid,
        embedder=OpenAIEmbedder(id="text-embedding-3-small"),
    ),
)

agent = Agent(
    model=OpenAIResponses(id="gpt-5.5"),
    knowledge=knowledge,
    search_knowledge=True,  # Critical: enables agentic RAG
    instructions="Use knowledge base, cite sources"
)

Chat History:

agent = Agent(
    model=OpenAIResponses(id="gpt-5.5"),
    db=SqliteDb(db_file="tmp/agents.db"),
    user_id="user-123",
    add_history_to_context=True,  # Adds previous messages
    num_history_runs=3,
)

Structured Output:

from pydantic import BaseModel

class Result(BaseModel):
    summary: str
    findings: list[str]

agent = Agent(
    model=OpenAIResponses(id="gpt-5.5"),
    output_schema=Result,
)
result: Result = agent.run(query).content

AgentOS Production:

from agno.os import AgentOS
from agno.db.postgres import PostgresDb

agent_os = AgentOS(
    agents=[agent],
    db=PostgresDb(db_url=os.getenv("DATABASE_URL")),
)
app = agent_os.get_app()

Read the full file on GitHub · 187 lines

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. yesterday First seen · 187 lines · 1,090 tokens per session scan A d400f5971f06

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository agno-agi/agno (41,969 stars, last pushed yesterday), licensed Apache-2.0. It adds 1,090 tokens to every session, about $0.0054 per session on Opus 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-30.