Grounding research
Give each research agent a mandate, a shared research library, and access to prior work.
Ground each research agent with three forms of context: rules in the prompt, shared source material in a knowledge base, and complete prior work in an archive. Each layer supports a distinct part of the review.
| Layer | Holds | Mechanism |
|---|---|---|
| Static context | The mandate, policy, and process shared across queries | Injected into every system prompt |
| Research library | Company profiles, sector analyses, source documents | RAG over a vector database |
| Prior work | Past decisions and memos | File navigation tools |
Layer 1: static context in the prompt
Place rules that apply to every question in the prompt. Load them once and inject them into every agent.
These are composition examples adapted from the Investment Team application. Follow its clone, database, credentials, and research-loading setup for a complete application. Its agents/, teams/, and workflows/ define the components referenced here; agents/settings.py supplies shared knowledge and paths.
Import those components into your application module, or define your own before composing them. The application uses Gemini; the OpenAI variants on these pages require uv pip install "agno[openai]" and OPENAI_API_KEY as well. Shared knowledge/storage still needs the application's database and embedding-provider setup. Prose context, analyst-output variables, and local archives must be supplied by your application.
from pathlib import Path
CONTEXT_DIR = Path(__file__).parent / "context"
def load_context() -> str:
sections = [f.read_text() for f in sorted(CONTEXT_DIR.glob("*.md"))]
return "\n\n---\n\n".join(sections)
COMMITTEE_CONTEXT = load_context()
instructions = f"""\
You are the Risk Officer on a $10M investment team.
## Committee Rules (ALWAYS FOLLOW)
{COMMITTEE_CONTEXT}
## Your Role
Enforce position limits and sector caps on every recommendation.
"""Mandate, risk policy, and process are markdown files. The loader places the same text in each agent's instructions. Model instructions guide behavior; enforce position limits and other hard policy in code or tool permissions.
Layer 2: the research library in RAG
The corpus the agents can search goes in a shared knowledge base. Reuse one configured instance when agents share the same corpus.
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
# Shared instance, imported from a settings module
from agents.settings import team_knowledge
analyst = Agent(
model=OpenAIResponses(id="gpt-5.5"),
knowledge=team_knowledge,
search_knowledge=True,
instructions="Search the research library before forming a view. Cite what you used.",
)
reply = analyst.run("What does our research say about semiconductor supply?").content
# The instruction tells the analyst to search and cite retrieved material.search_knowledge is on by default and exposes a model-selected search tool. The instructions ask for retrieval, but do not guarantee a search on every question. For mandatory retrieval, fetch context in application code before the run and supply it to the agent.
Layer 3: prior work on disk
Keep complete past memos as files when a reviewer needs the original reasoning trail. Give the reading agent file tools scoped to that archive.
from pathlib import Path
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.file import FileTools
memos_dir = Path(__file__).parent / "memos"
archivist = Agent(
model=OpenAIResponses(id="gpt-5.5"),
tools=[
FileTools(
base_dir=memos_dir,
enable_save_file=False,
enable_replace_file_chunk=False,
)
],
instructions="Check prior memos before drawing new conclusions.",
)Give the memo writer write access. This archival agent receives read and search tools. Keep sensitive files outside memos_dir because every file under the tool's base directory may be readable.
What each layer contributes
| Layer | Contribution |
|---|---|
| Prompt | Instructions and context shared across queries |
| RAG | Retrieval from a corpus too large to inline |
| Archive | The reasoning trail behind past decisions |
Together, the layers cover operating rules, available research, and prior decisions.
Next steps
| Task | Guide |
|---|---|
| Make grounded research compound | Institutional learning |
| End in an auditable artifact | Structured deliverable |