> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Team History

> Share conversation history across team members with add_team_history_to_members so one agent can recall context another agent received.

In this team, the leader routes requests to the appropriate member and the members respond directly to the user.

Using `add_team_history_to_members=True`, each team member has access to the shared history of the team, allowing them to use context from previous interactions with other members.

## How it Works

When `add_team_history_to_members=True`, team history is appended to tasks sent to members:

```
<team_history_context>
[run-1]
input: Hallo, wie heißt du? Mein Name ist John.
response: Ich heiße ChatGPT.

</team_history_context>
```

This allows the Spanish agent to recall the name "John" that was originally shared with the German agent.

## Code

```python team_history.py theme={null}
from uuid import uuid4

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

german_agent = Agent(
    name="German Agent",
    role="You answer German questions.",
    model=OpenAIResponses(id="gpt-5.2"),
)

spanish_agent = Agent(
    name="Spanish Agent",
    role="You answer Spanish questions.",
    model=OpenAIResponses(id="gpt-5.2"),
)


multi_lingual_q_and_a_team = Team(
    name="Multi Lingual Q and A Team",
    model=OpenAIResponses(id="gpt-5.2"),
    members=[german_agent, spanish_agent],
    instructions=[
        "You are a multi lingual Q and A team that can answer questions in English and Spanish. You MUST delegate the task to the appropriate member based on the language of the question.",
        "If the question is in German, delegate to the German agent. If the question is in Spanish, delegate to the Spanish agent.",
        "Always translate the response from the appropriate language to English and show both the original and translated responses.",
    ],
    db=SqliteDb(
        db_file="tmp/multi_lingual_q_and_a_team.db"
    ),  # Add a database to store the conversation history. This is a requirement for history to work correctly.
    determine_input_for_members=False,  # Send the input directly to the member agents without the team leader synthesizing its own input.
    respond_directly=True,
    add_team_history_to_members=True,  # Send all interactions between the user and the team to the member agents.
)


session_id = f"conversation_{uuid4()}"

# First give information to the team
## Ask question in German
multi_lingual_q_and_a_team.print_response(
    "Hallo, wie heißt du? Meine Name ist John.", stream=True, session_id=session_id
)

# Then watch them recall the information (the question below states: "Tell me a 2-sentence story using my name")
## Follow up in Spanish
multi_lingual_q_and_a_team.print_response(
    "Cuéntame una historia de 2 oraciones usando mi nombre real.",
    stream=True,
    session_id=session_id,
)
```

## Usage

<Steps>
  <Step title="Create a Python file">
    Create `team_history.py` with the code above.
  </Step>

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai sqlalchemy
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```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"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run Team">
    ```bash theme={null}
    python team_history.py
    ```
  </Step>
</Steps>
