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

# Agentic Session State

> Demonstrates team and member agentic state updates on shared session state.

```python agentic_session_state.py theme={null}
"""
Agentic Session State
=====================

Demonstrates team and member agentic state updates on shared session state.
"""

from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
from agno.team import Team

# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
db = SqliteDb(db_file="tmp/agents.db")

# ---------------------------------------------------------------------------
# Create Members
# ---------------------------------------------------------------------------
shopping_agent = Agent(
    name="Shopping List Agent",
    role="Manage the shopping list",
    model=OpenAIResponses(id="gpt-5-mini"),
    db=db,
    add_session_state_to_context=True,
    enable_agentic_state=True,
)

# ---------------------------------------------------------------------------
# Create Team
# ---------------------------------------------------------------------------
team = Team(
    members=[shopping_agent],
    session_state={"shopping_list": []},
    db=db,
    add_session_state_to_context=True,
    enable_agentic_state=True,
    description="You are a team that manages a shopping list and chores",
    show_members_responses=True,
)

# ---------------------------------------------------------------------------
# Run Team
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    team.print_response("Add milk, eggs, and bread to the shopping list")
    team.print_response("I picked up the eggs, now what's on my list?")
    print(f"Session state: {team.get_session_state()}")
```

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno 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"
```

**3. Run the example**

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

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

Full source: [cookbook/03\_teams/21\_state/agentic\_session\_state.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/03_teams/21_state/agentic_session_state.py)


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