Skip to content

C# Custom Process in a Workflow

Use this when you have existing or new C# / .NET logic that a workflow should call as a step. MeshFlows does not run inline C# through SES (script.execute). Instead, expose the logic as a capability provider and call it with a normal service_call.

SES covers JavaScript, Python, and Bash only — see Script steps.

When to choose this path

Need Prefer
Short transform / glue in JS, Python, or Bash SES script.execute
Real C# business logic, NuGet packages, typed models C# capability provider (this page)
One-off HTTP call to an existing .NET API you already run egress.http.call (or wrap that API as a provider for designer UX)

A “custom process” in MeshFlows terms is: your compiled C# HTTP endpoint + registry registration + one workflow step.

Pattern (end-to-end)

C# ASP.NET service (your process)
  → registers capabilities with the capability-registry
  → Orchestrator resolves capability_name via registry
  → workflow service_call POSTs to your path
  → JSON response becomes the step output

You do not change the Orchestrator for each C# process.

Minimal steps

  1. Implement a small ASP.NET Minimal API (or Web API) that:
  2. registers with POST /v1/registry/services/register
  3. heartbeats on the lease
  4. exposes your process as POST /… (JSON in → JSON out)
  5. serves GET /internal/capabilities and GET /healthz
  6. Deploy the service so Orchestrator can reach SERVICE_URL (in-cluster DNS).
  7. Call it from workflow YAML with type: service_call.

Full starter (register, heartbeat, POST /echo) in C#: Add a Capability Provider — C# tab.
Shipped demo: engine/services/example-echo-csharp/ (example.echo.csharp), workflow flows/workflows/example_echo_csharp_demo.yaml, HTTP POST /v1/api/examples/echo-csharp.
Credentials + connection type + trigger: Integration end-to-end.

Workflow YAML

Same shape as any other capability — only capability_name and path change:

name: example_echo_csharp_demo
description: Calls the shipped C# echo capability provider.

steps:
  - id: run_custom_process
    type: service_call
    capability_name: example.echo.csharp
    capability_version: "^1.0"
    path: /echo
    message: "hello from MeshFlows"
    timeout_seconds: 30

Reference service page: Example Echo (C#). There is also a Go twin: Example Echo (Go) (example.echo.go).

Pass the previous step body

If your C# endpoint expects the raw step payload (not named form fields), use payload_from and map that body in the provider (same contract as other egress services):

  - id: enrich
    type: service_call
    capability_name: myorg.orders.enrich
    capability_version: "^1.0"
    path: /enrich
    payload_from: previous
    timeout_seconds: 60

In C#, bind the POST body to your DTO and return JSON; the Orchestrator stores the response body as the step output.

Designer

Register metadata.designer + form_fields (with yaml_path) so the Dashboard can drop the step without hand-editing YAML. The echo sample shows the minimal field set (capability_name, path, plus your own inputs) with compose_payload_from_fields: false.

Checklist

  • [ ] Capability name / version / kind: workflow_step match the contract
  • [ ] service_url is reachable from Orchestrator (not localhost in Kubernetes)
  • [ ] Registration + heartbeat succeed (CAPABILITY_REGISTRY_TOKEN if required)
  • [ ] Workflow capability_name + path match public_paths
  • [ ] First-class fields match designer yaml_path (no provider-specific Orchestrator fields)
  • [ ] For Engine-style images/CI: Deploy integration