Bragi Docs Help

Code Configs

Code Configs in Bragi let you write custom C# in the Bragi UI. By implementing the ICodeConfigCode interface, you can run your own logic in Bragi pipelines.

When to Use

  • Custom data transformation after ingestion.

  • Pulling data from external or non-standard APIs.

  • Handling complex conditional logic or business rules.

  • Anything not suited to SQL.

Field

Description

Display Name

Human-friendly name for the Code Config, shown in Bragi’s UI.

Description

Concise summary of what your code does. Useful for teammates and future maintenance.

Manual Lifecycle Handling

If enabled, you manage data table lifecycles; Bragi will not truncate/overwrite tables automatically. Leave disabled unless you need this control.

The New Code Config screen

Read the best practises for naming configs for guidance on consistent and clear naming formats for configs.

Creating a Code Config

Bragi provides this template for new Code Configs:

using System; using System.Linq; using System.Data; using System.Threading.Tasks; using System.Text.Json; using System.Net.Http; using Bragi.CodeExternal; using Bragi.Util; public class MyCodeConfigImpl : ICodeConfigCode { public async Task<BragiCodeResult> CodeImpl(IBragiCodeUtil bragiCodeUtil) { try { // Todo: Code here var env = await bragiCodeUtil.GetEnvironmentDetails(); bragiCodeUtil.LogInformation("Running code in " + env.Name); return new BragiCodeResult(BragiCodeResultCode.Success); } catch (Exception ex) { return new BragiCodeResult(BragiCodeResultCode.Fatal, ex.Message); } } }

Code Execution & Interface

  • Your class must implement ICodeConfigCode.

  • The entry point is: Task<BragiCodeResult> CodeImpl(IBragiCodeUtil bragiCodeUtil)

  • Bragi injects bragiCodeUtil with helpers (logging, variable access, data operations, etc.).

  • Your method must return a BragiCodeResult to signal completion.

  • Always catch exceptions to prevent pipeline failures.

See Also

09 March 2026