1
Create a Python file
session_state_in_instructions.py
2
Set up your virtual environment
3
Install dependencies
4
Export your OpenAI API key
5
Run Agent
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create a Python file
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
session_state={"user_name": "John"},
instructions="Users name is {user_name}",
markdown=True,
)
agent.print_response("What is my name?", stream=True)
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno openai
Export your OpenAI API key
OPENAI_API_KEY as an environment variable. You can get one from OpenAI.export OPENAI_API_KEY=sk-***
setx OPENAI_API_KEY sk-***
Run Agent
python session_state_in_instructions.py
Was this page helpful?