mirror of
https://github.com/agno-agi/agno.git
synced 2026-10-11 22:09:58 +00:00
## Summary CLAUDE.md's "Don't" section still pointed cookbook authors at `gpt-5.4`, but the current cookbooks have standardized on `gpt-5.5` (50 uses across `cookbook/08_learning/` and `cookbook/01_demo/`, the most recently refreshed folders). This PR updates the guidance and fixes the same staleness in `.cursorrules`: - **CLAUDE.md**: "use `gpt-5.4` instead" → "use `gpt-5.5` instead" - **.cursorrules**: all 8 example snippets used `OpenAIChat(id="gpt-4o")` — both the banned model *and* the banned class per CLAUDE.md's own rules. Updated to `OpenAIResponses(id="gpt-5.5")` (matching the import convention used in the cookbooks). Checked but intentionally not changed: - `.github/` CI prompts: no stale model references found. - The 2 remaining `gpt-5.2` mentions in `cookbook/08_learning/TEST_LOG.md` are historical test-log records (one documents the gpt-5.2 → gpt-5.5 migration itself), so they were left as-is. - Older cookbook folders (e.g. `90_models/`, `02_agents/`) still use `gpt-5.2`/`gpt-5.4` widely (~830 references); migrating those is out of scope for this guidance-only chore. ## Type of change - [ ] Bug fix - [ ] New feature - [ ] Breaking change - [x] Improvement - [ ] Model update - [x] Other: docs/tooling guidance chore --- ## Checklist - [x] Code complies with style guidelines - [x] Ran format/validation scripts (`./scripts/format.sh` and `./scripts/validate.sh`) - [x] Self-review completed - [x] Documentation updated (comments, docstrings) - [ ] Examples and guides: Relevant cookbook examples have been included or updated (if applicable) - [ ] Tested in clean environment - [ ] Tests added/updated (if applicable) ### Duplicate and AI-Generated PR Check - [x] I have searched existing [open pull requests](../../pulls) and confirmed that no other PR already addresses this issue - [ ] If a similar PR exists, I have explained below why this PR is a better approach - [x] Check if this PR was entirely AI-generated (by Copilot, Claude Code, Cursor, etc.) --- ## Additional Notes No runtime code changes — only `CLAUDE.md` and `.cursorrules`. Both format and validate scripts pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <[email protected]>
187 lines
4.3 KiB
Plaintext
187 lines
4.3 KiB
Plaintext
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):
|
|
```python
|
|
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:
|
|
```python
|
|
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
|
|
```python
|
|
# 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:
|
|
```python
|
|
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:
|
|
```python
|
|
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:
|
|
```python
|
|
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:
|
|
```python
|
|
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:
|
|
```python
|
|
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:
|
|
```python
|
|
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()
|
|
```
|
|
|
|
Common Mistakes
|
|
- Creating agents in loops (massive performance hit)
|
|
- Using Team when single agent would work
|
|
- Forgetting search_knowledge=True with knowledge
|
|
- Using SQLite in production
|
|
- Not adding history when context matters
|
|
- Missing output_schema validation
|
|
|
|
Production
|
|
- Use PostgresDb not SqliteDb
|
|
- Set show_tool_calls=False, debug_mode=False
|
|
- Wrap agent.run() in try-except
|
|
|
|
Docs: https://docs.agno.com
|