Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

🚪Entry Groups

Audience: Nexus adopters and integrators.

Goal: Extend a branching DAG with explicit entry groups and verify that each supported input path produces the intended execution.

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.

Prerequisites: complete the setup guide before extending the DAG.

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:

  1. Adding a new vertex mul_inputs that takes two user-provided inputs and multiplies them

  2. Connecting this multiplication result to the same comparison step as the original addition result

  3. Creating two explicit entry groups to select between the addition path and the multiplication path

Here's a visual representation of the extended workflow:

Choose add_entry or mul_entry inputs
Phase 1: Bind independent add_entry and mul_entry inputs. Keyed facts: add_entry binds User Input: a plus fixed b = -3 into xyz.taluslabs.math.i64.add@1; mul_entry binds independent User Input: a and User Input: b into xyz.taluslabs.math.i64.mul@1.
Use one comparison result for all conditional paths
Phase 2: Use one comparison result for all conditional paths. Keyed facts: 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.
Conditional Tool branches produce final variants
Phase 3: Route guarded branches to exact Tool results. Keyed facts: 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:

  1. The original addition path that takes one input and adds -3 to it

  2. A 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:

Complete DAG Definition

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:

  1. Multiple Entry Points: The DAG now supports two different ways to start execution.

  2. Explicit Control: Each entry group clearly defines which values need to be provided.

  3. Conflict Prevention: Without entry groups, having both paths active could cause a race condition at the is_negative.a input port.

  4. 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:

  1. Added a new vertex that provides an alternative way to generate a value for comparison

  2. Connected this vertex to the same downstream processing flow

  3. Created explicit entry groups to control which entry path is active

  4. 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