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

# Composition: The Data Block via additional_context

> build_context() returns the recalled-data block on its own, for when you want the data injected but not the tools - a read-only view of what the machine knows, placed exactly where you choose.

```python context_block.py theme={null}
"""
Composition: The Data Block via additional_context
==================================================
build_context() returns the recalled-data block on its own, for when you
want the data injected but not the tools - a read-only view of what the
machine knows, placed exactly where you choose.

Run:
    .venvs/demo/bin/python cookbook/08_learning/11_composition/context_block.py
"""

from agno.agent import Agent
from agno.db.postgres import PostgresDb
from agno.learn import LearningMachine, LearningMode, UserMemoryConfig
from agno.models.openai import OpenAIResponses

db = PostgresDb(db_url="postgresql+psycopg://ai:ai@localhost:5532/ai")

learning = LearningMachine(
    db=db,
    model=OpenAIResponses(id="gpt-5.5"),  # the manual door injects nothing
    user_memory=UserMemoryConfig(mode=LearningMode.AGENTIC),
)

USER_ID = "composer@example.com"

# Seed a memory through the data API so the read-only agent has something to see
store = learning.user_memory_store
store.get_tools(user_id=USER_ID)[0]("Prefers conclusions first, then supporting detail")

# No learning=, no tools: just the data block, placed as additional context
agent = Agent(
    model=OpenAIResponses(id="gpt-5.5"),
    db=db,
    additional_context=learning.build_context(user_id=USER_ID),
    user_id=USER_ID,
    markdown=True,
)

if __name__ == "__main__":
    agent.print_response("Summarize why teams adopt vector databases.", stream=True)
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno "psycopg[binary]" openai sqlalchemy
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Snippet file="run-pgvector-step.mdx" />

  <Step title="Run the example">
    Save the code above as `context_block.py`, then run:

    ```bash theme={null}
    python context_block.py
    ```
  </Step>
</Steps>

Full source: [cookbook/08\_learning/11\_composition/context\_block.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/08_learning/11_composition/context_block.py)
