TwinGraph SDK
Graph-Based, In-Memory, Digital Twins
Define, Deploy, Manage, and Orchestrate In-Memory and Persistent Graph-Based Digital Twins.
Build Powerful Digital Twins
Define
Model graph-based digital twins, TwinGraphs, programmatically via the SDK.
Deploy
Instantiate locally and publish to external datastores. Pull twins from repositories for processing.
Manage
Use the SDK to manage TwinGraph operations. Monitor and observe twins with built-in observability features.
Orchestrate
Coordinate TwinGraph operations across multiple applications, systems, and environments.
TwinGraphs point and connect to digital and physical data sources, applications, systems, and AI agents directly in-memory for real-time analytics, simulation, and optimization.
Connect Everything In-Memory
Deploy TwinGraphs to persistent graph data stores with one line of code, and pull from them just as easily.
Deploy & Persist with Ease
1. Natively via SDK
Define and instantiate TwinGraphs directly using SDK methods.
# Step 1: Install TwinGraph
!pip install twingraph
# Step 2: Import TwinGraph
import twingraph as tg
# Step 3: Create TwinGraph object
my_twin = tg.Twin.create({"name": "my_twin"})
# Step 4: Add components, etc.
import twin_components as components
my_twin.add_component(...)
# Step 5: Visualize
my_twin.display()
Multiple ways to instantiate your TwinGraph digital twins
Creating a TwinGraph is Simple
2. TwinGraph Import
Import a TwinGraph from local or remote sources.
# Step 1: Install TwinGraph
!pip install twingraph
#Step 2: Import TwinGraph
import twingraph as tg
# Step 3: Import a TwinGraph
import twin_repo as repo
my_twin = repo.my_twin
# Step 4: Visualize and observe your TwinGraph
my_twin.display()
3. External Graph Import
Fetch data from external datastores to instantiate TwinGraphs in-memory.
# Step 1: Install TwinGraph
!pip install twingraph
# Step 2: Import TwinGraph
import twingraph as tg
# Step 3: Create TwinGraph object
my_twin = tg.Twin.create({"name": "my_twin"})
# Step 4: Add a graph database connection
my_twin.add_graph_connection(
name="ProductionGraph",
connection_type="neo4j",
uri="bolt://localhost:7687",
username=os.getenv("PRODUCTION_GRAPH_USERNAME"),
password=os.getenv("PRODUCTION_GRAPH_PASSWORD")
)
# Step 5: Instantiate local TwinGraph from graph database hosted TwinGraph
my_twin.load_graph_twin_instance(graph_connection_name="ProductionGraph", remote_twin_name="my_neo4j_twin")
# Step 6: Visualize and observe your TwinGraph
my_twin.display()