diff --git a/ctools.services.yml b/ctools.services.yml
index eaa38b8..725e728 100644
--- a/ctools.services.yml
+++ b/ctools.services.yml
@@ -31,6 +31,9 @@ services:
   ctools.context_mapper:
     class: Drupal\ctools\ContextMapper
     arguments: ['@entity.repository']
+  ctools.environment_context_repository_factory:
+    class: Drupal\ctools\EnvironmentAwareContextRepositoryFactory
+    arguments: ['@context.repository']
   ctools.serializable.tempstore.factory:
     class: Drupal\ctools\SerializableTempstoreFactory
     arguments: ['@keyvalue.expirable', '@lock', '@request_stack', '%user.tempstore.expire%']
diff --git a/src/ConfigurableRelationshipContextEnvironmentTrait.php b/src/ConfigurableRelationshipContextEnvironmentTrait.php
new file mode 100644
index 0000000..9308e80
--- /dev/null
+++ b/src/ConfigurableRelationshipContextEnvironmentTrait.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace Drupal\ctools;
+
+/**
+ * Trait to prepare relationship contexts.
+ */
+trait ConfigurableRelationshipContextEnvironmentTrait {
+
+  /**
+   * Get relationship configurations.
+   *
+   * @return array
+   *   An array of relationship configurations keyed by id. Should have the
+   *   keys 'plugin_id' and any other configuration.
+   */
+  public abstract function getRelationships();
+
+  /**
+   * Build provided context values.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   The relationship contexts.
+   */
+  public function getRuntimeRelationshipContexts() {
+  }
+
+  /**
+   * Get the available relationship contexts.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   The relationship contexts without values in.
+   */
+  public function getAvailableRelationshipContexts() {
+    $contexts = [];
+    $relationship_manager = \Drupal::service('plugin.manager.ctools.relationship');
+    foreach ($this->getRelationships() as $id => $configuration) {
+      $relationship = $relationship_manager->createInstance($configuration['plugin_id'], $configuration);
+      $contexts[$id] = new RelationshipLazyContext($relationship);
+    }
+    return $contexts;
+  }
+}
+
diff --git a/src/Context/RelationshipLazyContext.php b/src/Context/RelationshipLazyContext.php
new file mode 100644
index 0000000..7656b81
--- /dev/null
+++ b/src/Context/RelationshipLazyContext.php
@@ -0,0 +1,54 @@
+<?php
+
+namespace Drupal\ctools\Context;
+
+use Drupal\ctools\Plugin\RelationshipInterface;
+use Drupal\Core\Plugin\Context\Context;
+use Drupal\Core\Plugin\Context\ContextDefinitionInterface;
+
+/**
+ * Context for relationships that doesn't execute the the relationship until
+ * absolutely necessary.
+ */
+class RelationshipLazyContext extends Context {
+
+  /**
+   * The relationship plugin.
+   *
+   * @param \Drupal\ctools\Plugin\RelationshipInterface
+   */
+  protected $relationship;
+
+  /**
+   * Construct a RelationshipLazyContext object.
+   *
+   * @param \Drupal\ctools\Plugin\RelationshipInterface
+   *   The relationship plugin.
+   */
+  public function __construct(RelationshipInterface $relationship) {
+    $this->relationship = $relationship;
+    parent::__construct($relationship->getRelationshipContextDefinition());
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getContextValue() {
+    if (!$this->contextData) {
+      $this->setContextValue($relationship->getRelationshipContextValue());
+    }
+    return parent::getContextValue();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function hasContextValue() {
+    // Ensure that the relationship is executed before checking if it exists.
+    if (!$this->contextData) {
+      $this->getContextValue();
+    }
+    return parent::hasContextValue();
+  }
+}
+
diff --git a/src/ContextEnvironmentInterface.php b/src/ContextEnvironmentInterface.php
new file mode 100644
index 0000000..8c1a96e
--- /dev/null
+++ b/src/ContextEnvironmentInterface.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Drupal\ctools;
+
+/**
+ * Interface for context environments.
+ */
+interface ContextEnvironmentInterface {
+
+  /**
+   * Gets runtime context values for the given context IDs.
+   *
+   * @param string[] $context_ids
+   *   Unqualified context IDs relative to the environment.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   The determined contexts, keyed by the unqualified id.
+   */
+  public function getRuntimeEnvironmentContexts(array $context_ids);
+
+  /**
+   * Gets all available contexts for the purposes of configuration.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   All available contexts.
+   */
+  public function getAvailableEnvironmentContexts();
+}
diff --git a/src/ContextEnvironmentTrait.php b/src/ContextEnvironmentTrait.php
new file mode 100644
index 0000000..1172ae6
--- /dev/null
+++ b/src/ContextEnvironmentTrait.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace Drupal\ctools;
+
+/**
+ * Trait for context environments.
+ */
+trait ContextEnvironmentTrait {
+
+  /**
+   * Get the runtime contexts for an environment for given context ids.
+   *
+   * @param string[] $context_ids
+   *   Unqualified context ids associated with this environment.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   The determined contexts, keyed by the unqualified context id.
+   */
+  public function getRuntimeEnvironmentContexts(array $context_ids) {
+    $contexts = [];
+    if (is_callable([$this, 'getRuntimeProvidedContexts'])) {
+      $contexts += $this->getRuntimeProvidedContexts();
+    }
+    if (is_callable([$this, 'getRuntimeRelationshipContexts'])) {
+      $contexts += $this->getRuntimeRelationshipContexts();
+    }
+    if (is_callable([$this, 'getStaticContextValues'])) {
+      $contexts += $this->getStaticContextValues();
+    }
+    // @todo: Collect from relationships.
+    return $contexts;
+  }
+
+  /**
+   * Gets all available contexts for the purposed of configuration.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   All available contexts.
+   */
+  public function getAvailableEnvironmentContexts() {
+    $contexts = [];
+    if (is_callable([$this, 'getAvailableProvidedContexts'])) {
+      $contexts += $this->getAvailableProvidedContexts();
+    }
+    if (is_callable([$this, 'getAvailableRelationshipContexts'])) {
+      $contexts += $this->getAvailableRelationshipContexts();
+    }
+    // Collect static context available contexts. Because these are static
+    // there's no harm in just loading them with values anyway.
+    if (is_callable([$this, 'getStaticContextValues'])) {
+      $contexts += $this->getStaticContextValues();
+    }
+    // @todo: Collect relationship info.
+    return $contexts;
+  }
+}
diff --git a/src/EnvironmentAwareContextRepository.php b/src/EnvironmentAwareContextRepository.php
new file mode 100644
index 0000000..927a6b6
--- /dev/null
+++ b/src/EnvironmentAwareContextRepository.php
@@ -0,0 +1,142 @@
+<?php
+
+namespace Drupal\ctools;
+
+use Drupal\Core\Plugin\Context\ContextRepositoryInterface;
+
+/**
+ * Provides a context repository that is aware of its environment.
+ *
+ * This works like a normal ContextRepository except that it can have an
+ * environment set. This environment can then add to the contexts available.
+ */
+class EnvironmentAwareContextRepository implements ContextRepositoryInterface {
+
+  /**
+   * The global context repository.
+   *
+   * @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface
+   */
+  protected $globalContextRepository = NULL;
+
+  /**
+   * An array of context environment providers.
+   *
+   * @var \Drupal\ctools\EnvironmentContextProviderInterface[]
+   */
+  protected $providers = [];
+
+  /**
+   * The statically cached contexts.
+   *
+   * @var \Drupal\Core\Plugin\Context\ContextInterface[]
+   */
+  protected $contexts = [];
+
+
+  /**
+   * Set the global context repository.
+   *
+   * @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface
+   *   The global context repository interface.
+   */
+  public function setGlobalContextRepository(ContextRepositoryInterface $global_context_repository) {
+    $this->globalContextRepository = $global_context_repository;
+  }
+
+  /**
+   * Set the context environment.
+   *
+   * @param string $name
+   *   Identifier for this provider.
+   * @param \Drupal\ctools\EnvironmentContextProviderInterface $environment;
+   *   The environment provider object to pull contexts from.
+   */
+  public function addEnvironmentContextProvider($name, EnvironmentContextProviderInterface $provider) {
+    $provider->setContextRepository($this);
+    $this->providers[$name] = $provider;
+  }
+
+  /**
+   * Get an environment context provider by name.
+   *
+   * @param string $name
+   *   Identifier for the provider.
+   *
+   * @return \Drupal\ctools\EnvironmentContextProviderInterface
+   */
+  public function getEnvironmentContextProvider($name) {
+    return $this->providers[$name] ? : NULL;
+  }
+
+  /**
+   * Get all available context environments.
+   *
+   * @return \Drupal\ctools\EnvironmentContextProviderInterface[]
+   */
+  public function getEnvironmentContextProviders() {
+    return $this->providers;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRuntimeContexts(array $context_ids) {
+    $contexts = [];
+
+    // Any contexts passed in without an '@env' at the beginning get passed off
+    // to the global context provider. Contexts with '@env' should be of the
+    // form '@env:{environment_name}:{unqualified_context_id}' this allows the
+    // context repository to locate the correct context.
+    $global_context_ids = $environment_context_ids = [];
+    foreach ($context_ids as $id) {
+      if (isset($this->contexts[$id])) {
+        $contexts[$id] = $this->contexts[$id];
+        continue;
+      }
+
+      if (($id[0] === '@') && (strpos($id, ':') !== FALSE) && (substr($id, 0, 4) != '@env')) {
+        $global_context_ids[] = $id;
+      }
+      else if (substr($id, 0, 4) == '@env') {
+        $environmental_context_ids[] = substr($id, 4);
+      }
+    }
+
+    foreach ($this->globalContextRepository->getRuntimeContexts($global_context_ids) as $id => $context) {
+      $this->contexts[$id] = $contexts[$id] = $context;
+    }
+
+    $context_ids_by_provider = [];
+    foreach ($environmental_context_ids as $id) {
+      list($name, $unqualified_context_id) = explode(':', $id, 2);
+      $context_ids_by_environment[$name][] = $unqualified_context_id;
+    }
+
+    foreach ($context_ids_by_provider as $provider_name => $ids) {
+      if ($provider = $this->getEnvironmentContextProvider($provider_name)) {
+        foreach ($provider->getRuntimeEnvironmentContexts($ids, $contexts) as $id => $context) {
+          $long_id = "@env:{$provider_name}:{$id}";
+          $this->contexts[$long_id] = $contexts[$long_id] = $context;
+        }
+      }
+    }
+
+    return $contexts;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getAvailableContexts() {
+    $contexts = $this->globalContextRepository->getAvailableContexts();
+    foreach ($this->getEnvironmentContextProviders() as $name => $provider) {
+      foreach ($provider->getAvailableContexts() as $id => $context) {
+        $long_id = "@env:{$name}:{$id}";
+        $contexts[$long_id] = $context;
+      }
+    }
+    return $contexts;
+  }
+
+}
diff --git a/src/EnvironmentAwareContextRepositoryFactory.php b/src/EnvironmentAwareContextRepositoryFactory.php
new file mode 100644
index 0000000..3635d45
--- /dev/null
+++ b/src/EnvironmentAwareContextRepositoryFactory.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Drupal\ctools;
+
+use Drupal\Core\Plugin\Context\ContextRepositoryInterface;
+
+/**
+ * Service class for building environment away context repositories.
+ */
+class EnvironmentAwareContextRepositoryFactory {
+
+  /**
+   * The global context repository.
+   *
+   * @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface
+   */
+  protected $globalContextRepository;
+
+  /**
+   * Construct a new factory object.
+   *
+   * @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $global_context_repository
+   *   The global context repository service.
+   */
+  public function __construct(ContextRepositoryInterface $global_context_repository) {
+    $this->globalContextRepository = $global_context_repository;
+  }
+
+  /**
+   * Build an environment aware context repository.
+   *
+   * @param \Drupal\ctools\EnvironmentContextProviderInterface[] $environments
+   *   Array of environment context providers keyed by provider name..
+   *
+   * @return \Drupal\ctools\EnvironmentAwareContextRepository
+   *   A context repository that is aware of the environmental contexts.
+   */
+  public function getContextRepository(array $providers) {
+    $repository = new EnvironmentAwareContextRepository();
+    $repository->setGlobalContextRepository($this->globalContextRepository);
+    foreach ($providers as $name => $provider) {
+      $repository->addEnvironmentContextProvider($name, $provider);
+    }
+    return $repository;
+  }
+
+}
diff --git a/src/EnvironmentContextProviderBase.php b/src/EnvironmentContextProviderBase.php
new file mode 100644
index 0000000..f7e3295
--- /dev/null
+++ b/src/EnvironmentContextProviderBase.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\ctools;
+
+use Drupal\Core\Plugin\Context\ContextRepositoryInterface;
+
+/**
+ * Base class for EnvironmentContextProvider classes.
+ */
+abstract class EnvironmentContextProviderBase implements EnvironmentContextProviderInterface {
+
+  /**
+   * The context repository this provider is acting for. This can be used to
+   * request further contexts if required.
+   *
+   * @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface
+   */
+  protected $repository;
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setContextRepository(ContextRepositoryInterface $repository) {
+    $this->repository = $repository;
+  }
+}
+
diff --git a/src/EnvironmentContextProviderInterface.php b/src/EnvironmentContextProviderInterface.php
new file mode 100644
index 0000000..8956b5d
--- /dev/null
+++ b/src/EnvironmentContextProviderInterface.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Drupal\ctools;
+
+use Drupal\Core\Plugin\Context\ContextRepositoryInterface;
+
+interface EnvironmentContextProviderInterface {
+
+  /**
+   * Set the Context Repository for this provider.
+   *
+   * @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $repository
+   *   The repository to this provider is acting for.
+   */
+  public function setContextRepository(ContextRepositoryInterface $repository);
+
+  /**
+   * Gets runtime context values for the given context IDs.
+   *
+   * Given that context providers might not return contexts for the given
+   * context IDs, it is also not guaranteed that the context repository returns
+   * contexts for all specified IDs.
+   *
+   * @param string[] $context_ids
+   *   Fully qualified context IDs, which looks like
+   *   @env:{unqualified_context_id}, so for example @env:node.
+   * @param \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   Contexts that have already been collected by other providers.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   The determined contexts, keyed by the fully qualified context ID.
+   */
+  public function getRuntimeContexts(array $context_ids, array $contexts);
+
+  /**
+   * Gets all available contexts for the purposes of configuration.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   All available contexts.
+   */
+  public function getAvailableContexts();
+
+}
diff --git a/src/EnvironmentProvidedContextProvider.php b/src/EnvironmentProvidedContextProvider.php
new file mode 100644
index 0000000..6abdbf1
--- /dev/null
+++ b/src/EnvironmentProvidedContextProvider.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Drupal\ctools;
+
+use Drupal\Core\Plugin\Context\Context;
+
+class EnvironmentProvidedContextProvider extends EnvironmentContextProviderBase {
+
+  /**
+   * A EnvironmentWithProvidedContextInterface object.
+   *
+   * @var \Drupal\ctools\EnvironmentWithProvidedContextInterface
+   */
+  protected $environment;
+
+  /**
+   * Constructs a EnvironmentProvidedContextProvider object.
+   *
+   * @param \Drupal\ctools\EnvironmentWithProvidedContextInterface
+   *   The environment object.
+   */
+  public function __construct(EnvironmentWithProvidedContextInterface $environment) {
+    $this->environment = $environment;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRuntimeContexts(array $context_ids, array $contexts) {
+    $new_contexts = [];
+    foreach ($context_ids as $id) {
+      if ($new_context = $this->environment->getContext($id)) {
+        $new_contexts[$id] = $new_context;
+      }
+    }
+    return $new_contexts;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getAvailableContexts() {
+    $new_contexts = [];
+    foreach ($this->environment->getContextDefinitions() as $id => $context_definition) {
+      $new_contexts[$id] = new Context($context_definition);
+    }
+    return $new_contexts;
+  }
+}
diff --git a/src/EnvironmentRelationshipContextProvider.php b/src/EnvironmentRelationshipContextProvider.php
new file mode 100644
index 0000000..5337edb
--- /dev/null
+++ b/src/EnvironmentRelationshipContextProvider.php
@@ -0,0 +1,74 @@
+<?php
+
+namespace Drupal\ctools;
+
+class EnvironmentRelationshipContextProvider extends EnvironmentContextProviderBase {
+
+  /**
+   * A EnvironmentWithProvidedContextInterface object.
+   *
+   * @var \Drupal\ctools\EnvironmentWithStaticContextInterface
+   */
+  protected $environment;
+
+  /**
+   * Constructs a EnvironmentProvidedContextProvider object.
+   *
+   * @param \Drupal\ctools\EnvironmentWithStaticContextInterface
+   *   The environment object.
+   */
+  public function __construct(EnvironmentWithRelationshipContextInterface $environment) {
+    $this->environment = $environment;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRuntimeContexts(array $context_ids, array $contexts) {
+    $new_contexts = [];
+    $relationship_manager = \Drupal::service('plugin.manager.ctools.relationship');
+    foreach ($this->environment->getRelationships() as $id => $relationship) {
+      if (!in_array($id, $context_ids)) {
+        continue;
+      }
+
+      $relationship = $relationship_manager->createInstance($relationship['plugin_id'], $relationship);
+      $context_mapping = $relationship->getContextMapping();
+      $missing_contexts = [];
+      foreach ($context_mapping as $plugin_context_id => $full_context_id) {
+        list(,$provider,$local_id) = explode(':', $full_context_id);
+        if (isset($contexts[$full_context_id])) {
+          $relationship->setContextValue($plugin_context_id, $contexts[$full_context_id]->getContextData());
+        }
+        else if (isset($new_contexts[$local_id]) && ($this->repository->getEnvironmentContextProvider($provider) === $this)) {
+          $relationship->setContextValue($plugin_context_id, $new_contexts[$local_id]->getContextData());
+        }
+        else {
+          $missing_contexts[$plugin_context_id] = $full_context_id;
+        }
+      }
+      if (!empty($missing_contexts)) {
+        $collected_missing_contexts = $this->repository->getRuntimeContexts(array_values($missing_contexts));
+        foreach ($missing_contexts as $plugin_context_id => $full_context_id) {
+          $relationship->setContextValue($plugin_context_id, $collected_missing_contexts[$full_context_id]->getContextData());
+        }
+      }
+
+      $new_contexts[$id] = $relationship->getRelationship();
+    }
+    return $new_contexts;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getAvailableContexts() {
+    $contexts = [];
+    $relationship_manager = \Drupal::service('plugin.manager.ctools.relationship');
+    foreach ($this->environment->getRelationships() as $id => $relationship) {
+      $contexts[$id] = $relationship_manager->createInstance($relationship['plugin_id'], $relationship)->getRelationship();
+    }
+    return $contexts;
+  }
+
+}
diff --git a/src/EnvironmentStaticContextProvider.php b/src/EnvironmentStaticContextProvider.php
new file mode 100644
index 0000000..1f292fa
--- /dev/null
+++ b/src/EnvironmentStaticContextProvider.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Drupal\ctools;
+
+class EnvironmentStaticContextProvider extends EnvironmentContextProviderBase {
+
+  /**
+   * A EnvironmentWithProvidedContextInterface object.
+   *
+   * @var \Drupal\ctools\EnvironmentWithStaticContextInterface
+   */
+  protected $environment;
+
+  /**
+   * Constructs a EnvironmentProvidedContextProvider object.
+   *
+   * @param \Drupal\ctools\EnvironmentWithStaticContextInterface
+   *   The environment object.
+   */
+  public function __construct(EnvironmentWithStaticContextInterface $environment) {
+    $this->environment = $environment;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRuntimeContexts(array $context_ids, array $contexts) {
+    return \Drupal::service('ctools.context_mapper')->getContextValues($this->environment->getStaticContexts());
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getAvailableContexts() {
+    return \Drupal::service('ctools.context_mapper')->getContextValues($this->environment->getStaticContexts());
+  }
+
+}
diff --git a/src/EnvironmentWithProvidedContextInterface.php b/src/EnvironmentWithProvidedContextInterface.php
new file mode 100644
index 0000000..522dfe3
--- /dev/null
+++ b/src/EnvironmentWithProvidedContextInterface.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\ctools;
+
+interface EnvironmentWithProvidedContextInterface {
+
+  /**
+   * Get the context option for a given unqualified ID.
+   *
+   * @param string $id
+   *   The unqualified context id to get.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface
+   *   The context requested.
+   */
+  public function getContext($id);
+
+  /**
+   * Get the context definitions for any provided contexts.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextDefinitionInterface[]
+   *   Array of context definitions keyed by unqualified context id.
+   */
+  public function getContextDefinitions();
+
+}
diff --git a/src/EnvironmentWithRelationshipContextInterface.php b/src/EnvironmentWithRelationshipContextInterface.php
new file mode 100644
index 0000000..03f2f6a
--- /dev/null
+++ b/src/EnvironmentWithRelationshipContextInterface.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Drupal\ctools;
+
+interface EnvironmentWithRelationshipContextInterface {
+
+  /**
+   * Get the relationship configurations keyed by Id.
+   *
+   * @return array[]
+   *   Array of relationship plugin configurations keyed by id.
+   */
+  public function getRelationships();
+
+}
diff --git a/src/EnvironmentWithStaticContextInterface.php b/src/EnvironmentWithStaticContextInterface.php
new file mode 100644
index 0000000..1bd0e79
--- /dev/null
+++ b/src/EnvironmentWithStaticContextInterface.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Drupal\ctools;
+
+interface EnvironmentWithStaticContextInterface {
+
+  /**
+   * Get the static contexts keyed by unqualified ID.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
+   *   The contexts
+   */
+  public function getStaticContexts();
+
+}
diff --git a/src/Form/ManageContext.php b/src/Form/ManageContext.php
index 4ac3b84..b916adb 100644
--- a/src/Form/ManageContext.php
+++ b/src/Form/ManageContext.php
@@ -192,6 +192,7 @@ abstract class ManageContext extends FormBase {
   protected function renderRows($cached_values) {
     $contexts = array();
     foreach ($this->getContexts($cached_values) as $row => $context) {
+      if (!is_object($context)) { print $row; print_r($context); }
       list($route_name, $route_parameters) = $this->getContextOperationsRouteInfo($cached_values, $this->machine_name, $row);
       $build = array(
         '#type' => 'operations',
diff --git a/src/Plugin/Relationship/TypedDataEntityRelationship.php b/src/Plugin/Relationship/TypedDataEntityRelationship.php
index ce96841..52d590b 100644
--- a/src/Plugin/Relationship/TypedDataEntityRelationship.php
+++ b/src/Plugin/Relationship/TypedDataEntityRelationship.php
@@ -15,11 +15,17 @@ class TypedDataEntityRelationship extends TypedDataRelationship {
   /**
    * {@inheritdoc}
    */
-  public function getRelationship() {
+  public function getRelationshipContextDefinition() {
     $plugin_definition = $this->getPluginDefinition();
 
     $entity_type = $this->getData($this->getContext('base'))->getDataDefinition()->getSetting('target_type');
-    $context_definition = new ContextDefinition("entity:$entity_type", $plugin_definition['label']);
+    return new ContextDefinition("entity:$entity_type", $pnugin_definition['label']);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRelationshipContextValue() {
     $context_value = NULL;
 
     // If the 'base' context has a value, then get the property value to put on
@@ -29,6 +35,16 @@ class TypedDataEntityRelationship extends TypedDataRelationship {
       $context_value = $this->getData($this->getContext('base'))->entity;
     }
 
+    return $context_value;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRelationship() {
+    $context_definition = $this->getRelationshipContextDefinition();
+    $context_value = $this->getRelationshipContextValue();
+
     $context_definition->setDefaultValue($context_value);
     return new Context($context_definition, $context_value);
   }
diff --git a/src/Plugin/Relationship/TypedDataLanguageRelationship.php b/src/Plugin/Relationship/TypedDataLanguageRelationship.php
index c198231..7fac27d 100644
--- a/src/Plugin/Relationship/TypedDataLanguageRelationship.php
+++ b/src/Plugin/Relationship/TypedDataLanguageRelationship.php
@@ -15,10 +15,15 @@ class TypedDataLanguageRelationship extends TypedDataRelationship {
   /**
    * {@inheritdoc}
    */
-  public function getRelationship() {
+  public function getRelationshipContextDefinition() {
     $plugin_definition = $this->getPluginDefinition();
+    return new ContextDefinition("language", $plugin_definition['label']);
+  }
 
-    $context_definition = new ContextDefinition("language", $plugin_definition['label']);
+  /**
+   * {@inheritdoc}
+   */
+  public function getRelationshipContextValue() {
     $context_value = NULL;
 
     // If the 'base' context has a value, then get the property value to put on
@@ -28,6 +33,16 @@ class TypedDataLanguageRelationship extends TypedDataRelationship {
       $context_value = $this->getData($this->getContext('base'))->language;
     }
 
+    return $context_value;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRelationship() {
+    $context_definition = $this->getRelationshipContextDefinition();
+    $context_value = $this->getRelationshipContextValue();
+
     $context_definition->setDefaultValue($context_value);
     return new Context($context_definition, $context_value);
   }
diff --git a/src/Plugin/Relationship/TypedDataRelationship.php b/src/Plugin/Relationship/TypedDataRelationship.php
index d795f28..cfc7aad 100644
--- a/src/Plugin/Relationship/TypedDataRelationship.php
+++ b/src/Plugin/Relationship/TypedDataRelationship.php
@@ -24,11 +24,18 @@ class TypedDataRelationship extends RelationshipBase {
   /**
    * {@inheritdoc}
    */
-  public function getRelationship() {
+  public function getRelationshipContextDefinition() {
     $plugin_definition = $this->getPluginDefinition();
 
     $data_type = $plugin_definition['data_type'];
     $context_definition = new ContextDefinition($data_type, $plugin_definition['label']);
+    return $context_definition;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRelationshipContextValue() {
     $context_value = NULL;
 
     // If the 'base' context has a value, then get the property value to put on
@@ -40,6 +47,16 @@ class TypedDataRelationship extends RelationshipBase {
       $context_value = $data->get($property)->getValue();
     }
 
+    return $context_value;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRelationship() {
+    $context_definition = $this->getRelationshipContextDefinition();
+    $context_value = $this->getRelationshipContextValue();
+
     $context_definition->setDefaultValue($context_value);
     return new Context($context_definition, $context_value);
   }
diff --git a/src/Plugin/RelationshipBase.php b/src/Plugin/RelationshipBase.php
index 9f1e1cf..352d828 100644
--- a/src/Plugin/RelationshipBase.php
+++ b/src/Plugin/RelationshipBase.php
@@ -3,8 +3,17 @@
 namespace Drupal\ctools\Plugin;
 
 use Drupal\Core\Plugin\ContextAwarePluginBase;
+use Drupal\ctools\Context\RelationshipLazyContext;
 
 /**
  * Base class for Relationship plugins.
  */
-abstract class RelationshipBase extends ContextAwarePluginBase implements RelationshipInterface {}
+abstract class RelationshipBase extends ContextAwarePluginBase implements RelationshipInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getRelationship() {
+    return new RelationshipLazyContext($this);
+  }
+}
diff --git a/src/Plugin/RelationshipInterface.php b/src/Plugin/RelationshipInterface.php
index 0372a0e..8a6c41f 100644
--- a/src/Plugin/RelationshipInterface.php
+++ b/src/Plugin/RelationshipInterface.php
@@ -11,6 +11,21 @@ use Drupal\Core\Plugin\ContextAwarePluginInterface;
 interface RelationshipInterface extends ContextAwarePluginInterface, DerivativeInspectionInterface {
 
   /**
+   * Get the context definition that this relationship provides.
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextDefinitionInterface
+   */
+  public function getRelationshipContextDefinition();
+
+  /**
+   * Get the context data value for this relationship.
+   *
+   * @return mixed|NULL
+   *   The context data.
+   */
+  public function getRelationshipContextValue();
+
+  /**
    * Generates a context based on this plugin's configuration.
    *
    * @return \Drupal\Core\Plugin\Context\ContextInterface
