For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
    • NVIDIA Switch Infrastructure
    • I want to...
  • Quick Start
    • Start Here
    • Getting Started with Config Manager
    • TUI Wizard Reference
    • Configuration Samples
    • Interfaces
    • Local Development Quick Start
    • First Run Tour
  • Config Manager Overview
    • Config Manager Concepts
    • Getting Started with Nautobot
  • User Guides
    • New Site Bringup
    • Workflow Lifecycle
  • Deployment
    • Hosting Options
    • Network Topology Requirements
    • Firewall Ports
    • Airgapped Deployment
    • Troubleshooting
  • Services
      • Network Infrastructure Automation with Temporal
      • Temporal Deployment Process
      • Temporal CLI
      • Workflows for Day 2 Operations
      • Temporal API
        • GETHealthcheck
        • GETRBAC Config Status
        • GETCurrent User Info
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogo
On this page
  • Overview
  • System Components
  • WorkflowMetadataMixin
  • Dynamic API Generator
  • Workflow Examples
  • Integrated Benefits
  • Technical Implementation
  • Workflow Definition with Metadata
  • Automatic Endpoint Generation
  • Key Benefits
  • Single Source of Truth
  • Automatic Discovery
  • Easy Maintenance
  • Comprehensive Documentation
  • Type Safety
  • Architecture
  • Workflow Discovery Flow
  • Components
  • WorkflowMetadataMixin (src/nv_config_manager/temporal/common/mixins/metadata.py)
  • Dynamic Endpoint Generator (src/nv_config_manager/temporal/api/dynamic_endpoints.py)
  • Registration System
  • Adding New Workflows
  • Create Workflow with Metadata
  • Create Input Model
  • Register Workflow
  • That’s It
  • Workflow Discovery API
  • List All Workflows
  • Get Registered Workflow Types
  • Get Workflow Info
  • Testing
  • Unit Tests
  • Integration Tests
  • Summary
ServicesTemporal Service

Dynamic API Implementation

||View as Markdown|
Previous

VPC Deletion

Next

Healthcheck

Overview

The dynamic API endpoint generation system automatically creates FastAPI endpoints from workflow metadata. This creates a single source of truth for workflow definitions and provides excellent maintainability.

System Components

WorkflowMetadataMixin

The WorkflowMetadataMixin allows workflows to define their API metadata directly in the workflow class:

  • workflow_description: Human-readable description
  • workflow_input_class: Pydantic input model
  • workflow_api_endpoint: API endpoint path
  • workflow_namespace: Workflow namespace

Dynamic API Generator

The dynamic API generator:

  • Automatically discovers workflows with complete metadata
  • Generates FastAPI endpoint functions dynamically
  • Handles proper routing, documentation, and parameter validation
  • Provides consistent error handling and response formatting

Workflow Examples

All workflows use the metadata system, including:

  • BackupWorkflow: /ngc/backup - “Backup network device configuration to Config Store”
  • DeployWorkflow: /ngc/deploy - “Deploy intended configuration to network device with approval workflow”
  • VpcCreationWorkflow: /ngc/vpc_creation - “Create VPC with route distinguisher assignment and VRF provisioning”
  • VpcDeletionWorkflow: /ngc/vpc_deletion - “Delete VPC and associated VRFs with validation checks”
  • ReprovisionWorkflow: /ngc/reprovision - “Reprovision network device using ZTP and perform post-provision backup”
  • ConnectedHostMetadataWorkflow: /ngc/connected_host_metadata - “Discover and analyze connected hosts through MAC table and LLDP neighbor data”
  • HelloWorld: /hello_world - “Simple hello world workflow for testing and demonstration”
  • HelloWorldApproval: /hello_world_approval - “Hello world workflow with approval step for testing staged workflows”

Integrated Benefits

  • CLI automatically discovers workflows and generates commands
  • OpenAPI documentation is automatically generated
  • Consistent parameter validation across all interfaces
  • Single source of truth for workflow definitions

Technical Implementation

Workflow Definition with Metadata

1# Workflows define their metadata directly in the class
2@workflow.defn
3class BackupWorkflow(WorkflowMetadataMixin, StageMixin, DeviceMixin, ArchiveMixin):
4 """Network device configuration backup workflow."""
5
6 # Workflow metadata
7 workflow_description = "Backup network device configuration to Config Store"
8 workflow_input_class = BackupInput
9 workflow_api_endpoint = "/ngc/backup"
10 workflow_namespace = "ngc"
11
12 @workflow.run
13 async def run(self, input_data: BackupInput) -> str:
14 # Workflow implementation
15 pass

Automatic Endpoint Generation

1# In dynamic_endpoints.py - Automatic discovery and registration
2def register_dynamic_endpoints(router: APIRouter) -> None:
3 """Register all workflow endpoints dynamically."""
4 for workflow_class in get_registered_workflows():
5 if hasattr(workflow_class, 'has_complete_metadata') and workflow_class.has_complete_metadata():
6 endpoint_path = workflow_class.get_workflow_api_endpoint()
7 input_class = workflow_class.get_workflow_input_class()
8 endpoint_func = create_workflow_endpoint(workflow_class, input_class, endpoint_path)
9 router.add_api_route(
10 endpoint_path,
11 endpoint_func,
12 methods=["POST"],
13 response_model=WorkflowResponse,
14 name=f"{workflow_class.__name__.lower()}_endpoint"
15 )

Key Benefits

Single Source of Truth

  • Workflow metadata is defined once in the workflow class
  • API endpoints, CLI help, and documentation all derive from the same source
  • Consistent information across all interfaces

Automatic Discovery

  • New workflows are automatically discovered and exposed using the API
  • CLI automatically generates commands for new workflows
  • No manual endpoint registration required

Easy Maintenance

  • Adding a new workflow requires only:
    1. Adding WorkflowMetadataMixin to the workflow class
    2. Setting the metadata attributes
    3. Adding to REGISTERED_WORKFLOWS list
  • System automatically handles the rest

Comprehensive Documentation

  • Workflow descriptions appear in:
    • OpenAPI/Swagger documentation
    • CLI help text
    • Workflow discovery endpoints
  • Consistent documentation across all interfaces

Type Safety

  • Pydantic input models ensure type safety
  • FastAPI automatically generates request/response schemas
  • CLI parameter validation matches API validation

Architecture

Workflow Discovery Flow

Components

WorkflowMetadataMixin (src/nv_config_manager/temporal/common/mixins/metadata.py)

1class WorkflowMetadataMixin:
2 """Mixin for defining workflow metadata."""
3
4 workflow_description: str = ""
5 workflow_input_class: Type[BaseModel]
6 workflow_api_endpoint: str = ""
7 workflow_namespace: str = ""
8 workflow_cli_name: Optional[str] = None
9
10 @classmethod
11 def get_workflow_description(cls) -> str:
12 """Get the workflow description."""
13 return cls.workflow_description or cls.__doc__.strip().split('\n')[0]
14
15 @classmethod
16 def has_complete_metadata(cls) -> bool:
17 """Check if the workflow has complete metadata defined."""
18 return bool(cls.workflow_description and cls.workflow_input_class and cls.workflow_api_endpoint)

Dynamic Endpoint Generator (src/nv_config_manager/temporal/api/dynamic_endpoints.py)

1def create_workflow_endpoint(workflow_class: Type, input_class: Type[BaseModel], endpoint_path: str):
2 """Create a FastAPI endpoint function for a workflow."""
3
4 async def workflow_endpoint(body: BaseModel, request: Request) -> WorkflowResponse:
5 """Execute the workflow with provided parameters."""
6 if start_workflow is None:
7 raise RuntimeError("start_workflow function not set.")
8
9 # Auto-populate user fields from request auth data
10 user = getattr(request.state, 'user', 'unknown')
11 if hasattr(body, 'user') and not body.user:
12 body.user = user
13 if hasattr(body, 'user_domain') and not body.user_domain:
14 body.user_domain = user.split("@")[1] if "@" in user else "nvidia.com"
15
16 workflow_id = await start_workflow(request, workflow_class, body)
17 return WorkflowResponse(id=workflow_id)
18
19 # Set function metadata for FastAPI
20 workflow_endpoint.__name__ = f"{workflow_class.__name__.lower()}_endpoint"
21 workflow_endpoint.__doc__ = f"Execute the {workflow_class.__name__} workflow."
22 workflow_endpoint.__annotations__ = {
23 'body': input_class,
24 'request': Request,
25 'return': WorkflowResponse
26 }
27
28 return workflow_endpoint

Registration System

1def register_dynamic_endpoints(router: APIRouter) -> None:
2 """Register all workflow endpoints dynamically."""
3 workflows = get_registered_workflows()
4
5 for workflow_class in workflows:
6 workflow_class = cast(Type[WorkflowMetadataMixin], workflow_class)
7
8 if workflow_class.has_complete_metadata():
9 endpoint_path = workflow_class.get_workflow_api_endpoint()
10 input_class = workflow_class.get_workflow_input_class()
11
12 endpoint_func = create_workflow_endpoint(workflow_class, input_class, endpoint_path)
13
14 router.add_api_route(
15 endpoint_path,
16 endpoint_func,
17 methods=["POST"],
18 response_model=WorkflowResponse,
19 name=f"{workflow_class.__name__.lower()}_endpoint",
20 summary=workflow_class.get_workflow_description()
21 )

Adding New Workflows

Create Workflow with Metadata

1from nv_config_manager.temporal.common.mixins.metadata import WorkflowMetadataMixin
2
3@workflow.defn
4class MyNewWorkflow(WorkflowMetadataMixin, StageMixin):
5 """My new workflow for doing amazing things."""
6
7 # Workflow metadata
8 workflow_description = "Perform amazing network operations with validation"
9 workflow_input_class = MyNewWorkflowInput
10 workflow_api_endpoint = "/ngc/my_new_workflow"
11 workflow_namespace = "ngc"
12
13 @workflow.run
14 async def run(self, input_data: MyNewWorkflowInput) -> str:
15 # Workflow implementation
16 pass

Create Input Model

1class MyNewWorkflowInput(BaseModel):
2 """Input model for MyNewWorkflow."""
3
4 device_id: str
5 operation_type: str
6 validate_before: bool = True

Register Workflow

1# In src/nv_config_manager/temporal/ngc/workflows/__init__.py
2REGISTERED_WORKFLOWS = [
3 # ... existing workflows
4 MyNewWorkflow,
5]

That’s It

The workflow is now automatically:

  • Available using the API at /v1/workflow/ngc/my_new_workflow
  • Documented in OpenAPI/Swagger
  • Available in CLI as uv run workflow-cli my-new-workflow
  • Included in workflow discovery endpoints

Workflow Discovery API

List All Workflows

$GET /v1/workflow/

Returns metadata for all registered workflows.

Get Registered Workflow Types

$GET /v1/workflow/types

Returns the list of registered workflow type names.

Get Workflow Info

The following endpoint returns metadata for a specific registered workflow:

1{
2 "workflows": [
3 {
4 "name": "BackupWorkflow",
5 "description": "Backup network device configuration to Config Store",
6 "endpoint": "/ngc/backup",
7 "namespace": "ngc",
8 "cli_name": "backup",
9 "input_class": "BackupInput"
10 }
11 ]
12}

Testing

Unit Tests

1def test_workflow_metadata():
2 """Test that workflow has complete metadata."""
3 assert BackupWorkflow.has_complete_metadata()
4 assert BackupWorkflow.get_workflow_description() == "Backup network device configuration to Config Store"
5 assert BackupWorkflow.get_workflow_api_endpoint() == "/ngc/backup"
6 assert BackupWorkflow.get_workflow_input_class() == BackupInput
7
8def test_dynamic_endpoint_generation():
9 """Test that endpoints are generated correctly."""
10 router = APIRouter()
11 register_dynamic_endpoints(router)
12
13 # Check that backup endpoint was registered
14 backup_route = next((route for route in router.routes if route.path == "/ngc/backup"), None)
15 assert backup_route is not None
16 assert "POST" in backup_route.methods

Integration Tests

1def test_backup_workflow_endpoint():
2 """Test the dynamically generated backup endpoint."""
3 response = client.post(
4 "/v1/workflow/ngc/backup",
5 json={"device_id": "test-device-id"},
6 headers={"ssl-client-cert": test_cert}
7 )
8 assert response.status_code == 200
9 assert "id" in response.json()
10 assert "href" in response.json()

Summary

The dynamic API system provides a clean, maintainable approach to workflow management. By defining metadata directly in workflow classes, the system automatically generates consistent APIs, CLI commands, and documentation. This approach scales well as new workflows are added and ensures consistency across all interfaces.