# IArchiveSink

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.iarchivesink/
> Summary: IArchiveSink: The cold-storage extension point rows are written to before deletion.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

The cold-storage extension point rows are written to before deletion.

```csharp
public interface IArchiveSink
```

## Remarks

There is no default implementation (no cloud SDK
dependency is taken). The consumer writes their own sink, based on the
file-system example under `samples/`, and registers it as `IArchiveSink`.

If none is registered, a policy with `archive = true` deletes no
row — data that cannot be archived is never dropped. This prevents silent data loss.

**DI lifetime — singleton, optional.** No default implementation is
registered. A consumer that registers one must register it as a singleton — it is
resolved once, as a constructor parameter of Tracon's singleton retention
executor, via `IServiceProvider.GetService<IArchiveSink>`.
A scoped registration would be a captive dependency.

## Methods

### <a id="Tracon_IArchiveSink_WriteAsync_System_String_System_DateTimeOffset_System_Collections_Generic_IReadOnlyList_Tracon_ArchiveRow__System_Threading_CancellationToken_"></a> WriteAsync\(string, DateTimeOffset, IReadOnlyList<ArchiveRow\>, CancellationToken\)

Writes a batch of rows to the archive.

```csharp
ValueTask WriteAsync(string target, DateTimeOffset partitionDate, IReadOnlyList<ArchiveRow> rows, CancellationToken cancellationToken = default)
```

#### Parameters

`target` [string](https://learn.microsoft.com/dotnet/api/system.string)

The target name.

`partitionDate` [DateTimeOffset](https://learn.microsoft.com/dotnet/api/system.datetimeoffset)

The date the batch belongs to (UTC, day precision). The sink may use
this to partition the file/object path (for example,
`run_events/2026-08-05.jsonl.gz`).

`rows` [IReadOnlyList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist\-1)<[ArchiveRow](/api/tracon.archiverow/)\>

The rows to write.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The cancellation token.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask)

The completion task.

#### Remarks

Only the rows written here are deleted, and only after this call returns;
when it throws, nothing is deleted. A row can arrive more than once: a row
that is kept after its write (it stopped matching, or its delete failed)
is written again by a later run.
