# .NET: credit assessment example

Instrument an ASP.NET Core request and add explicit business and AI observations.

## 1. Install the packages

Use the local NuGet source supplied by the portal. ASP.NET Core applications use Sigillum.Finans.Sdk.AspNetCore; workers and console applications use the core package.

~~~bash
dotnet add package Sigillum.Finans.Sdk.AspNetCore --version 0.11.0 --source ./packages
~~~

Resolve dependencies through an approved NuGet source. Keep the service configuration outside public files and source control. The downloadable project reads its absolute path from SIGILLUM_CONFIG.

## 2. Register the SDK

builder.Services.AddSigillum() registers the SDK. app.UseSigillum() must run before handlers that consume the request body. IHttpClientFactory clients receive the supplied handler. Use SigillumHttpHandler for a directly constructed HttpClient. Preserve existing authentication and security middleware.

## 3. Record the assessment

The example accepts an amount and income at **POST /loans/evaluate**. BeginStep creates the actual assessment step. It explicitly records the applied policy, explanation, business result and source attachment. Model and other AI categories are covered separately in the additional-observation examples. The calculation is a deterministic teaching rule, not a production credit-scoring model.

## 4. Add observations

Model, Classification, Retrieval, Tool, Embedding, Inference, Evaluation, Policy and Explanation are the AI convenience methods. Custom and Source carry additional data and source content. TryRecord provides the family/kind/raw-JSON interface. SetReferences adds optional person, session and external references.

Use existing raw UTF-8 JSON. Do not traverse business-object getters solely for observation. A successful capture result means bounded-memory acceptance, not central sealed delivery.

## 5. Handle errors and asynchronous work

SdkOperation.Fail(exception) records the safe error type. Preserve application exception handling and cancellation. ObserveAiAsync executes the real call once. Do not add network flushes or delivery waits to the business request path.

## 6. Run the project

Extract the ZIP and restore the supplied SDK from the local package source. Set SIGILLUM_CONFIG to the absolute service-configuration path and follow the README restore and run commands. Configure **POST /loans/evaluate** as the portal entry point. The sample binds to localhost.