> ## Documentation Index
> Fetch the complete documentation index at: https://phidatainc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

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

```python theme={null}
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 reason over goes in a shared knowledge base, searched per query. Reuse one configured instance when agents share the same corpus.

```python theme={null}
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. The agent retrieves relevant profiles and analyses for each question, which keeps the full library out of the prompt.

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

```python theme={null}
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](/use-cases/deep-research/institutional-learning) |
| End in an auditable artifact    | [Structured deliverable](/use-cases/deep-research/structured-deliverable) |

## Developer Resources

* [Knowledge](/knowledge/overview)
* [Context engineering](/context/overview)
