Share Member Interactions
This example demonstrates how to enable sharing of member interactions within a team. When share_member_interactions is set to True, team members can see and build upon each other's responses, creating a collaborative workflow.
Create a Python file
1from kern.agent import Agent2from kern.db.sqlite import SqliteDb3from kern.models.openai import OpenAIResponses4from kern.team import Team5from kern.tools.hackernews import HackerNewsTools67db = SqliteDb(db_file="tmp/agents.db")89research_agent = Agent(10 name="Research Agent",11 model=OpenAIResponses(id="gpt-5.2"),12 tools=[HackerNewsTools()],13 instructions="You are a research agent that finds information on HackerNews.",14)1516report_agent = Agent(17 name="Report Agent",18 model=OpenAIResponses(id="gpt-5.2"),19 instructions="You are a report agent that writes reports from research.",20)2122team = Team(23 model=OpenAIResponses(id="gpt-5.2"),24 db=db,25 members=[research_agent, report_agent],26 share_member_interactions=True,27 instructions=[28 "You are a team of agents that can research topics and write reports.",29 "First, research the topic using HackerNews.",30 "Then, use your report agent to write a report from the research.",31 ],32 show_members_responses=True,33)3435team.print_response("What are the latest AI trends?", stream=True)Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateInstall dependencies
1uv pip install -U kern-ai openaiExport your OpenAI API key
Set OpenAI Key
Set your OPENAI_API_KEY as an environment variable. You can get one from OpenAI.
1export OPENAI_API_KEY=sk-***1setx OPENAI_API_KEY sk-***Run Team
1python share_member_interactions.py