> ## 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 Manual Door

> learning= is the automatic door: the framework injects context, instructions and tools for you.

An agent with no learning= has no automatic capture: the manual door is agentic by nature - the agent captures by calling the tools you handed it.

```python basic.py theme={null}
"""
Composition: The Manual Door
============================
learning= is the automatic door: the framework injects context, instructions
and tools for you. This folder is the other door - no learning= at all. You
place the three public surfaces yourself, the way FileSystem composes:

- learning.get_tools(...)      the capture tools
- learning.instructions()      the guidance block (how to use them)
- learning.build_context(...)  the recalled-data block

An agent with no learning= has no automatic capture: the manual door is
agentic by nature - the agent captures by calling the tools you handed it.

Run:
    .venvs/demo/bin/python cookbook/08_learning/11_composition/basic.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

# ---------------------------------------------------------------------------
# Build the machine, place its surfaces by hand
# ---------------------------------------------------------------------------

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

# The manual door injects nothing: without learning= nobody hands the machine
# the agent's model, and capture is a model call.
learning = LearningMachine(
    db=db,
    model=OpenAIResponses(id="gpt-5.5"),
    user_memory=UserMemoryConfig(mode=LearningMode.AGENTIC),
    entity_memory=True,
)

USER_ID = "composer@example.com"

agent = Agent(
    model=OpenAIResponses(id="gpt-5.5"),
    db=db,
    tools=[*learning.get_tools(user_id=USER_ID)],
    instructions=[
        "You are a research assistant.",
        learning.instructions(),
    ],
    user_id=USER_ID,
    markdown=True,
)

# ---------------------------------------------------------------------------
# Run
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    agent.print_response(
        "Remember that I prefer sources with primary data, and track the "
        "Meridian project - Priya runs it.",
        stream=True,
    )

    print("\n--- what the manual door placed (guidance + data) ---")
    print(learning.instructions()[:400])
    print("...")
    print(learning.build_context(user_id=USER_ID, message="what about meridian?"))
```

## 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 `basic.py`, then run:

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

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