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

# Basic State

> Store and update a shopping list in agent session state backed by SQLite.

Create an agent with basic session state that keeps a shopping list across interactions, stored in SQLite.

**1. Create a Python file**

```python session_state_basic.py theme={null}
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
from agno.run import RunContext


def add_item(run_context: RunContext, item: str) -> str:
    """Add an item to the shopping list."""
    if run_context.session_state is None:
        run_context.session_state = {}

    run_context.session_state["shopping_list"].append(item)
    return f"The shopping list is now {run_context.session_state['shopping_list']}"


agent = Agent(
    model=OpenAIResponses(id="gpt-5.2"),
    session_state={"shopping_list": []},
    db=SqliteDb(db_file="tmp/agents.db"),
    tools=[add_item],
    instructions="Current state (shopping list) is: {shopping_list}",
    markdown=True,
)

agent.print_response("Add milk, eggs, and bread to the shopping list", stream=True)
print(f"Final session state: {agent.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 Agent**

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


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