In-Memory Storage for Teams
Store team sessions and run history in the current Python process with InMemoryDb.
InMemoryDb stores a Team's sessions and run history in the current Python process. Data is lost when the process exits.
Usage
Start in a virtual environment and set the model key before running the example.
Set OpenAI Key
Set your OPENAI_API_KEY as an environment variable. You can get one from OpenAI.
export OPENAI_API_KEY=sk-***Install dependencies:
uv pip install agno openai ddgsfrom agno.agent import Agent
from agno.db.in_memory import InMemoryDb
from agno.models.openai import OpenAIResponses
from agno.team import Team
from agno.tools.hackernews import HackerNewsTools
from agno.tools.websearch import WebSearchTools
hn_researcher = Agent(
name="HackerNews Researcher",
model=OpenAIResponses(id="gpt-5.2"),
tools=[HackerNewsTools()],
)
web_searcher = Agent(
name="Web Searcher",
model=OpenAIResponses(id="gpt-5.2"),
tools=[WebSearchTools()],
)
db = InMemoryDb()
team = Team(
name="Research Team",
members=[hn_researcher, web_searcher],
db=db,
)
team.print_response("Find top AI news")Run the Example
Save the code as in_memory_for_team.py, complete the prerequisites above, then run:
python in_memory_for_team.py