🚪Entry Groups
This guide builds on the Build the Quickstart guide by extending the example to support multiple entry points using entry groups. You'll take the original math_branching.json DAG and add an alternative entry path that allows users to directly provide two numbers for multiplication instead of adding a constant to the input.
The Tool FQNs and schemas in this follow-on page are illustrative placeholders, not provisioned deployment identities. Replace every <provider-...> FQN, port, output variant, and value type with the exact nexus tool inspect --tool-fqn <fqn> result or a provider-reviewed MetaSchema record before saving, validating, publishing, or scheduling. If the target provider has not supplied the inspection tuple, stop; do not treat the historical-looking math names below as runnable Tools.
What You'll Learn
How to add multiple entry points to a DAG
How to define and use entry groups
How to ensure DAG validity with multiple entry paths
How different entry groups affect execution flow
Understanding Entry Groups
Entry groups define named sets of entry points for a DAG. They allow you to:
Provide multiple ways to start a DAG execution
Group related entry vertices
Explicitly specify which vertices should be considered entry points
Why Use Entry Groups?
The explanation above should allow you to understand why, given a certain DAG definition, you might want to have explicit control over how the DAG execution can start. However, you might be thinking: Why design the DAG like this in the first place? Could you not simply split this up into independent DAGs? The answer is yes, yes you could. Whether you choose to split up different entry configurations into separate DAGs or define a composite DAG with flexibility through entry groups, will be a design choice depending on your specific preferences and use case. Nexus is agnostic to these design choices and provides you the ability to do both!
The Extended DAG
We'll extend our original branching math DAG by:
Adding a new vertex
mul_inputsthat takes two user-provided inputs and multiplies themConnecting this multiplication result to the same comparison step as the original addition result
Creating two explicit entry groups to select between the addition path and the multiplication path
Here's a visual representation of the extended workflow:
xyz.taluslabs.math.i64.add@1; mul_entry binds independent User Input: a and User Input: b into xyz.taluslabs.math.i64.mul@1.xyz.taluslabs.math.i64.add@1 and xyz.taluslabs.math.i64.mul@1 feed xyz.taluslabs.math.i64.cmp@1; the shared comparison result remains one guarded decision.xyz.taluslabs.math.i64.cmp@1 selects lt, gt, and eq; xyz.taluslabs.math.i64.mul@1 serves the lt and gt branches; xyz.taluslabs.math.i64.add@1 serves eq; defaults are b = -3, b = 7, and b = 1, and one terminal result per branch.This diagram shows the extended workflow with two entry paths:
The original addition path that takes one input and adds
-3to itA new multiplication path that takes two inputs and multiplies them
Both paths connect to the same comparison vertex, which then branches based on whether the result is negative, positive, or zero. Entry groups ensure only one path is active during execution.
Step-by-Step Construction
Let's build the math_branching_entry_group.json file step by step.
Any jsonc block below is an illustrative fragment with comments or omitted siblings. Save, validate, and publish only the strict complete json block under Putting It All Together.
1. Define Vertices (vertices list)
We'll start with the vertices from our original DAG and add the new mul_inputs vertex:
Note that we explicitly list both a and b as entry_ports for the mul_inputs vertex because both will be provided by the user, not by default values or edges.
2. Define Edges (edges list)
Now we'll define the edges, including a new edge from our new mul_inputs vertex to the comparison step:
The key addition is the second edge, which connects the output of our new mul_inputs vertex to the same input port of the is_negative vertex that add_input_and_default connects to.
3. Set Default Values (default_values list)
We'll keep the same default values as the original DAG:
4. Specify outputs (outputs list)
Outputs will also remain identical.
Notice that we do not add any default values for the mul_inputs vertex, as both its input ports will be provided by the user.
4. Define Entry Groups (entry_groups list)
This is where the major addition happens. We'll define two entry groups:
Each entry group has a name and a list of vertices When executing the DAG, you'll specify which entry group to use, and the DAG will expect inputs for entry ports defined on the specified vertices.
5. Why Entry Groups Are Required
Without entry groups, the DAG would have an issue: both add_input_and_default and mul_inputs would be considered entry vertices, but both connect to the same input port of is_negative. This creates a potential race condition against the DAG input model described in the dag and graph reference pages. With entry groups, we explicitly specify which entry paths are valid and ensure they won't be active simultaneously.
Putting It All Together
Combining these sections gives us the complete math_branching_entry_group.json:
Validation and Execution
The JSON remains a template until the exact provider Tool inspection tuple has replaced every placeholder. A successful local JSON shape check is not deployment evidence; stop before these commands when the provider FQNs, MetaSchema, or deployment/registry tuple is unavailable.
Validating the DAG
Use the nexus dag validate command to validate the DAG structure:
This ensures your DAG conforms to all the rules, including those related to entry groups and potential race conditions.
Publishing the DAG
After validation, publish the DAG:
Executing the DAG with Different Entry Groups
The key difference when executing this DAG is that you must specify which entry group to use:
These --dag-id examples use the operator-provisioned default Agent and executor. Preflight it before either schedule:
If the readback reports AgentRegistry missing default agent or EDefaultDagExecutorMissing, stop and hand the deployment to the network operator; do not continue with a failing schedule or attempt to bootstrap the shared executor from this guide.
Using the Addition Entry Group
Using the Multiplication Entry Group
Note that with the mul_entry group, you must provide values for both input ports a and b of the mul_inputs vertex.
The Power of Entry Groups
This example demonstrates several key advantages of entry groups:
Multiple Entry Points: The DAG now supports two different ways to start execution.
Explicit Control: Each entry group clearly defines which values need to be provided.
Conflict Prevention: Without entry groups, having both paths active could cause a race condition at the
is_negative.ainput port.Runtime Selection: Users can choose which entry point to use when executing the DAG.
Summary
In this guide, we extended our original branching math DAG to support multiple entry points using entry groups. We:
Added a new vertex that provides an alternative way to generate a value for comparison
Connected this vertex to the same downstream processing flow
Created explicit entry groups to control which entry path is active
Demonstrated how to execute the DAG with different entry groups
Entry groups are a powerful feature of Nexus DAGs that enable more flexible and modular workflows while maintaining the safety guarantees of the DAG execution model. They allow a single DAG to support multiple different starting states and input combinations while preventing potential race conditions.
For more advanced usage of entry groups and other DAG features, refer to the DAG Construction Guide.
Last updated

