Documentation Index
Fetch the complete documentation index at: https://docs-v1.agno.com/llms.txt
Use this file to discover all available pages before exploring further.
This example shows how to pass a function as instructions to an agent.
Code
cookbook/agent_concepts/other/instructions_via_function.py
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,
show_tool_calls=True,
)
agent.print_response("Who are you?", stream=True)
Usage
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Set your API key
export OPENAI_API_KEY=xxx
Install libraries
pip install -U openai agno
Run Agent
python cookbook/agent_concepts/other/instructions_via_function.py