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

# Instructions via Function

> Generate agent instructions from a function that reads the agent's own properties, such as its name.

Pass a function as `instructions` to generate them dynamically from the agent's properties.

## Code

```python instructions_via_function.py theme={null}
from typing import List

from agno.agent import Agent


def get_instructions(agent: Agent) -> List[str]:
    return [
        f"Your name is {agent.name}!",
        "Talk in haiku's!",
        "Use poetry to answer questions.",
    ]


agent = Agent(
    name="AgentX",
    instructions=get_instructions,
    markdown=True,
)
agent.print_response("Who are you?", stream=True)
```

## Usage

**1. Create a Python file**

Create `instructions_via_function.py` with the code above.

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

**2. Install dependencies**

```bash theme={null}
uv pip install -U agno openai
```

**3. 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"
```

**4. Run Agent**

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


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