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

> Enable agentic session state so a team and its member agent update shared state autonomously during a conversation.

Enable agentic session state so teams and agents manage and update their own session state during interactions. The agents modify the state autonomously based on the conversation context.

**1. Create a Python file**

```python agentic_session_state.py theme={null}
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
from agno.team import Team

db = SqliteDb(db_file="tmp/agents.db")

shopping_agent = Agent(
    name="Shopping List Agent",
    role="Manage the shopping list",
    model=OpenAIResponses(id="gpt-5.2"),
    db=db,
    add_session_state_to_context=True,  # Required so the agent is aware of the session state
    enable_agentic_state=True,
)

team = Team(
    members=[shopping_agent],
    session_state={"shopping_list": []},
    db=db,
    add_session_state_to_context=True,  # Required so the team is aware of the session state
    enable_agentic_state=True,
    description="You are a team that manages a shopping list and chores",
    show_members_responses=True,
)

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()}")
```

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

**2. Install dependencies**

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

**3. Export your OpenAI API key**

<Snippet file="set-openai-key.mdx" />

**4. Run Team**

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


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