# google-deepmind/concordia architecture

> Architecture diagram of the GitHub repository google-deepmind/concordia, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/google-deepmind/concordia
- Repository: https://github.com/google-deepmind/concordia

## Overview

Concordia is a library for building generative social simulations. A user configures entity and Game Master prefabs, then runs a simulation engine that selects actors, elicits natural-language actions, resolves them into world outcomes, and returns observations for subsequent turns. Entities combine action-selection and context components, with memory and prompt-building supporting behavior. Documented extension areas include questionnaire-driven simulations, specialized prefabs and components, CLI/GUI authoring, and optional language-model providers. The graph follows README-documented relationships; unsampled subsystem links are omitted where implementation calls could not be verified.

Main entry points: [`concordia/environment/engines/sequential.py`](https://github.com/google-deepmind/concordia/blob/main/concordia/environment/engines/sequential.py) (Turn-taking loops), [`concordia/components/game_master/event_resolution.py`](https://github.com/google-deepmind/concordia/blob/main/concordia/components/game_master/event_resolution.py) (Event resolution), [`concordia/document/interactive_document.py`](https://github.com/google-deepmind/concordia/blob/main/concordia/document/interactive_document.py) (Interactive prompts), [`concordia/environment/engine.py`](https://github.com/google-deepmind/concordia/blob/main/concordia/environment/engine.py) (Simulation engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Configuration and authoring"]
  node_prefabs["Entity prefabs<br/>[basic.py]"]
  node_gm_prefabs["Game Master prefabs"]
  node_sim_prefab["Simulation prefabs<br/>[generic.py]"]
  node_cli["CLI and GUI authoring"]
end

subgraph group_runtime["Simulation runtime"]
  node_engine["Simulation engine<br/>[engine.py]"]
  node_turn_loops["Turn-taking loops<br/>[sequential.py]"]
  node_step_control["Step control<br/>[step_controller.py]"]
end

subgraph group_behavior["Entity behavior"]
  node_entity_agent["Entity agent<br/>[entity_agent.py]"]
  node_entity_contract["Entity contracts<br/>[entity.py]"]
  node_components["Agent components"]
  node_memory_component["Memory component<br/>[memory.py]"]
  node_memory_store[("Associative memory")]
end

subgraph group_world["World and extensions"]
  node_gm_resolution["Event resolution"]
  node_gm_observation["Observation making"]
  node_gm_next["Actor selection<br/>[next_acting.py]"]
  node_specialized["Specialized world systems"]
  node_questionnaires["Questionnaire simulations"]
end

subgraph group_models["Models and context"]
  node_prompt_context["Interactive prompts"]
  node_model_api["Language-model interface<br/>[language_model.py]"]
  node_providers["Model providers"]
end

node_user(("Simulation author"))
node_external_llm(("LLM API"))
node_external_embedder(("Text embedder"))

node_user -->|"configures"| node_prefabs
node_user -->|"configures"| node_gm_prefabs
node_user -->|"instantiates"| node_sim_prefab
node_user -->|"authors with"| node_cli
node_sim_prefab -->|"runs through"| node_engine
node_engine -->|"uses loop"| node_turn_loops
node_engine -.->|"supports stepping"| node_step_control
node_turn_loops -->|"requests actions"| node_entity_agent
node_turn_loops -->|"requests outcomes"| node_gm_resolution
node_turn_loops -->|"requests observations"| node_gm_observation
node_turn_loops -->|"selects actors"| node_gm_next
node_entity_agent -->|"implements"| node_entity_contract
node_entity_agent -->|"runs phases"| node_components
node_components -->|"uses memory"| node_memory_component
node_memory_component -->|"reads and writes"| node_memory_store
node_gm_prefabs -->|"assembles"| node_gm_resolution
node_gm_resolution -->|"queues observations"| node_gm_observation
node_gm_next -->|"builds prompts"| node_prompt_context
node_gm_resolution -->|"builds prompts"| node_prompt_context
node_gm_observation -->|"uses prompts"| node_prompt_context
node_prompt_context -->|"samples responses"| node_model_api
node_providers -->|"implements"| node_model_api
node_model_api -.->|"calls optionally"| node_external_llm
node_memory_store -->|"requires embedding"| node_external_embedder
node_specialized -.->|"extends resolution"| node_gm_resolution
node_user -.->|"runs study"| node_questionnaires

click node_prefabs "https://github.com/google-deepmind/concordia/blob/main/concordia/prefabs/entity/basic.py"
click node_gm_prefabs "https://github.com/google-deepmind/concordia/blob/main/concordia/prefabs/game_master/physically_situated_and_dramaturgic.py"
click node_sim_prefab "https://github.com/google-deepmind/concordia/blob/main/concordia/prefabs/simulation/generic.py"
click node_cli "https://github.com/google-deepmind/concordia/blob/main/concordia/command_line_interface/concordia_session.py"
click node_engine "https://github.com/google-deepmind/concordia/blob/main/concordia/environment/engine.py"
click node_turn_loops "https://github.com/google-deepmind/concordia/blob/main/concordia/environment/engines/sequential.py"
click node_step_control "https://github.com/google-deepmind/concordia/blob/main/concordia/environment/step_controller.py"
click node_entity_agent "https://github.com/google-deepmind/concordia/blob/main/concordia/agents/entity_agent.py"
click node_entity_contract "https://github.com/google-deepmind/concordia/blob/main/concordia/typing/entity.py"
click node_components "https://github.com/google-deepmind/concordia/blob/main/concordia/components/agent/action_spec_ignored.py"
click node_memory_component "https://github.com/google-deepmind/concordia/blob/main/concordia/components/agent/memory.py"
click node_memory_store "https://github.com/google-deepmind/concordia/blob/main/concordia/associative_memory/basic_associative_memory.py"
click node_gm_resolution "https://github.com/google-deepmind/concordia/blob/main/concordia/components/game_master/event_resolution.py"
click node_gm_observation "https://github.com/google-deepmind/concordia/blob/main/concordia/components/game_master/make_observation.py"
click node_gm_next "https://github.com/google-deepmind/concordia/blob/main/concordia/components/game_master/next_acting.py"
click node_specialized "https://github.com/google-deepmind/concordia/tree/main/concordia/contrib/components/game_master"
click node_questionnaires "https://github.com/google-deepmind/concordia/blob/main/concordia/prefabs/simulation/questionnaire_simulation.py"
click node_prompt_context "https://github.com/google-deepmind/concordia/blob/main/concordia/document/interactive_document.py"
click node_model_api "https://github.com/google-deepmind/concordia/blob/main/concordia/language_model/language_model.py"
click node_providers "https://github.com/google-deepmind/concordia/tree/main/concordia/contrib/language_models"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_prefabs,node_gm_prefabs,node_sim_prefab,node_cli toneBlue
class node_engine,node_turn_loops,node_step_control toneAmber
class node_entity_agent,node_entity_contract,node_components,node_memory_component,node_memory_store,node_external_llm toneMint
class node_gm_resolution,node_gm_observation,node_gm_next,node_specialized,node_questionnaires toneRose
class node_prompt_context,node_model_api,node_providers,node_user,node_external_embedder toneIndigo
```

## Components

### Configuration and authoring

- [Entity prefabs](https://github.com/google-deepmind/concordia/blob/main/concordia/prefabs/entity/basic.py): `concordia/prefabs/entity/basic.py`
- [Game Master prefabs](https://github.com/google-deepmind/concordia/blob/main/concordia/prefabs/game_master/physically_situated_and_dramaturgic.py): `concordia/prefabs/game_master/physically_situated_and_dramaturgic.py`
- [Simulation prefabs](https://github.com/google-deepmind/concordia/blob/main/concordia/prefabs/simulation/generic.py): `concordia/prefabs/simulation/generic.py`
- [CLI and GUI authoring](https://github.com/google-deepmind/concordia/blob/main/concordia/command_line_interface/concordia_session.py): `concordia/command_line_interface/concordia_session.py`

### Simulation runtime

- [Simulation engine](https://github.com/google-deepmind/concordia/blob/main/concordia/environment/engine.py): `concordia/environment/engine.py`
- [Turn-taking loops](https://github.com/google-deepmind/concordia/blob/main/concordia/environment/engines/sequential.py): `concordia/environment/engines/sequential.py`
- [Step control](https://github.com/google-deepmind/concordia/blob/main/concordia/environment/step_controller.py): `concordia/environment/step_controller.py`

### Entity behavior

- [Entity agent](https://github.com/google-deepmind/concordia/blob/main/concordia/agents/entity_agent.py): `concordia/agents/entity_agent.py`
- [Entity contracts](https://github.com/google-deepmind/concordia/blob/main/concordia/typing/entity.py): `concordia/typing/entity.py`
- [Agent components](https://github.com/google-deepmind/concordia/blob/main/concordia/components/agent/action_spec_ignored.py): `concordia/components/agent/action_spec_ignored.py`
- [Memory component](https://github.com/google-deepmind/concordia/blob/main/concordia/components/agent/memory.py): `concordia/components/agent/memory.py`
- [Associative memory](https://github.com/google-deepmind/concordia/blob/main/concordia/associative_memory/basic_associative_memory.py): `concordia/associative_memory/basic_associative_memory.py`

### World and extensions

- [Event resolution](https://github.com/google-deepmind/concordia/blob/main/concordia/components/game_master/event_resolution.py): `concordia/components/game_master/event_resolution.py`
- [Observation making](https://github.com/google-deepmind/concordia/blob/main/concordia/components/game_master/make_observation.py): `concordia/components/game_master/make_observation.py`
- [Actor selection](https://github.com/google-deepmind/concordia/blob/main/concordia/components/game_master/next_acting.py): `concordia/components/game_master/next_acting.py`
- [Specialized world systems](https://github.com/google-deepmind/concordia/tree/main/concordia/contrib/components/game_master): `concordia/contrib/components/game_master`
- [Questionnaire simulations](https://github.com/google-deepmind/concordia/blob/main/concordia/prefabs/simulation/questionnaire_simulation.py): `concordia/prefabs/simulation/questionnaire_simulation.py`

### Models and context

- [Interactive prompts](https://github.com/google-deepmind/concordia/blob/main/concordia/document/interactive_document.py): `concordia/document/interactive_document.py`
- [Language-model interface](https://github.com/google-deepmind/concordia/blob/main/concordia/language_model/language_model.py): `concordia/language_model/language_model.py`
- [Model providers](https://github.com/google-deepmind/concordia/tree/main/concordia/contrib/language_models): `concordia/contrib/language_models`

### Other components

- **Simulation author**
- **LLM API**
- **Text embedder**

## Connections

- Simulation author → Entity prefabs: configures (evidence: `README.md`)
- Simulation author → Game Master prefabs: configures (evidence: `README.md`)
- Simulation author → Simulation prefabs: instantiates (evidence: `README.md`)
- Simulation author → CLI and GUI authoring: authors with (evidence: `README.md`)
- Simulation prefabs → Simulation engine: runs through (evidence: `concordia/prefabs/simulation/generic.py`)
- Simulation engine → Turn-taking loops: uses loop (evidence: `concordia/environment/engine.py`)
- Simulation engine → Step control: supports stepping (evidence: `concordia/environment/engine.py`)
- Turn-taking loops → Entity agent: requests actions (evidence: `README.md`)
- Turn-taking loops → Event resolution: requests outcomes (evidence: `README.md`)
- Turn-taking loops → Observation making: requests observations (evidence: `README.md`)
- Turn-taking loops → Actor selection: selects actors (evidence: `README.md`)
- Entity agent → Entity contracts: implements (evidence: `concordia/agents/entity_agent.py`)
- Entity agent → Agent components: runs phases (evidence: `concordia/agents/entity_agent.py`)
- Agent components → Memory component: uses memory (evidence: `concordia/components/agent/memory.py`)
- Memory component → Associative memory: reads and writes (evidence: `concordia/components/agent/memory.py`)
- Game Master prefabs → Event resolution: assembles (evidence: `concordia/prefabs/game_master/physically_situated_and_dramaturgic.py`)
- Event resolution → Observation making: queues observations (evidence: `concordia/components/game_master/event_resolution.py`)
- Actor selection → Interactive prompts: builds prompts (evidence: `concordia/components/game_master/next_acting.py`)
- Event resolution → Interactive prompts: builds prompts (evidence: `concordia/components/game_master/event_resolution.py`)
- Observation making → Interactive prompts: uses prompts (evidence: `concordia/components/game_master/make_observation.py`)
- Interactive prompts → Language-model interface: samples responses (evidence: `concordia/document/interactive_document.py`)
- Model providers → Language-model interface: implements (evidence: `concordia/contrib/language_models/vllm/vllm_model.py`)
- Language-model interface → LLM API: calls optionally (evidence: `README.md`)
- Associative memory → Text embedder: requires embedding (evidence: `README.md`)
- Specialized world systems → Event resolution: extends resolution (evidence: `concordia/contrib/components/game_master/narrative_event_resolution.py`)
- Simulation author → Questionnaire simulations: runs study
