> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/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

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno "psycopg[binary]" openai sqlalchemy
```

**2. Export your OpenAI API key**

```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"
```

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

**3. Run the example**

Save the code above as `basic.py`, then run:

```bash theme={null}
python basic.py
```

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)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.