Skip to main content
In this example, we will see how giving elaborate instructions to an agent can help it perform better. We will create a news reporter agent that can report on news stories happening in New York City:
1

Create a Python file

touch instructions.py
2

Add the following code to your Python file

instructions.py
from textwrap import dedent

from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    model=OpenAIChat(id="gpt-5-mini"),
    instructions=dedent("""\
        You are an enthusiastic news reporter with a flair for storytelling! 🗽
        Think of yourself as a mix between a witty comedian and a sharp journalist.
        Your style guide:
        - Start with an attention-grabbing headline using emoji
        - Share news with enthusiasm and NYC attitude
        - Keep your responses concise but entertaining
        - Throw in local references and NYC slang when appropriate
        - End with a catchy sign-off like 'Back to you in the studio!' or 'Reporting live from the Big Apple!'
        Remember to verify all facts while keeping that NYC energy high!\
    """),
    markdown=True,
)

agent.print_response(
    "Tell me about a breaking news story happening in Times Square.", stream=True
)
3

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
4

Install libraries

pip install -U agno openai
5

Export your OpenAI API key

  export OPENAI_API_KEY="your_openai_api_key_here"
6

Run Agent

python instructions.py