Repository navigation
Conversation
… memory.delete .NET code that wants agent memory hand-rolls POST /v1/<op> today. A small hand-written client in sdk/dotnet, shaped like sdk/java, gives it the four memory calls and turns the error envelope into a LoomException it can match on Code, and is a tested starting point for a full SDK. The HttpClient the client creates does not follow redirects: a followed 307 or 308 would send the memory's value to wherever the answer points. Signed-off-by: hskl18 <thb182003@gmail.com>
zlareb1
approved these changes
Nov 20, 2026
zlareb1
left a comment
Member
There was a problem hiding this comment.
No blocking findings. Checked all four request and result contracts, error categories and retry hints, cancellation and deadlines, response ownership and redirect refusal against the wire reference. The 29 .NET tests pass in Linux with warnings as errors, and all 271 documentation checks pass.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #621
Related: #54
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
A minimal .NET client (
sdk/dotnet, .NET 8) saves, reads, searches and deletes memories, and turns Loom's error envelope into aLoomExceptionyou can match onCode.Why
.NET callers hand-roll
POST /v1/<op>today. This is the first step #621 describes, which the full .NET SDK in #54 can grow from. It followssdk/java.Scope and risk
New folder
sdk/dotnet(a library, its xUnit tests and a solution), plus a.NETlink in the README's SDK row and a.NET SDKrow indocs/development/testing.md, as the Go client added.LoomClient: built fromLoomClientOptions(BaseUrl, optionalToken,Org,Namespace,Agent,Timeout), or fromLoomClient.FromEnvironment(org, ns, agent)readingLOOM_BASE_URLandLOOM_API_KEY.SetAsync,GetAsync,SearchAsyncandDeleteAsync, each with an optional dictionary of the op's other inputs and aCancellationToken. Headers assdk/javasends them:Authorization: Beareronly with a token,Content-Type,Accept,User-Agent: loom-dotnet/0.1.0,X-Request-Id.MemoryId,Version,Value,Found, the search hits); each keeps the whole response asRaw.LoomException:Code,Category,Retryable,RetryAfterSeconds(bodyretry_after_s, else theRetry-Afterheader), the HTTPStatus, theRequestIdand theOp. A body that names no category or retryable falls back to the status, asdocs/reference/errors.mddescribes. A call that got no answer has status 0 and is a retryabledependencyerror,UNREACHABLEorTIMEOUT. Cancelling through the caller's own token stays anOperationCanceledException.HttpClientthe client creates does not follow them, so a 3xx throws instead of sending the memory write on to another address, the fix the Go client got in review. AnHttpClientpassed to the constructor keeps its own settings; .NET's default handler follows a 307 and resends the body, which the README says.HttpClienthas a 10 s connect timeout, assdk/javasets, and no request timeout of its own; each call ends atTimeout(30 s by default) through a linked cancellation token, so aTimeoutabove 100 s works.HttpClient,System.Text.Json). Tests: xUnit 2.9.3,xunit.runner.visualstudio3.1.5,Microsoft.NET.Test.Sdk18.12.0. Built with warnings as errors.Compatibility, rollout and rollback
sdk/dotnetand the two doc rows.Tests
Unit tests (29) with a stubbed
HttpMessageHandler, and local sockets where the real handler matters (an unreachable port, a 307 to a second listener,FromEnvironmentover HTTP/1.1): the path and body of each of the four calls, the request headers on set and get, the typed results, one error answer per category,NOT_FOUNDmatched by code, nine status fallbacks for a body without an envelope, the timeout, the caller's cancellation, and the required options.cd sdk/dotnet && dotnet teston .NET SDK 8.0.428, Linux:I made 16 single breaks (such as following redirects, a misspelled
top_k, no status fallback, no per-call deadline), one at a time, and each made the suite fail.By hand against a local Loom: ClickHouse 26.10 with the repo's
deploy/clickhouse-config, migrations,uvicorn server.main:appasmake serverruns it, single-user. The README example ran unchanged, then a check of each answer and a search withtop_k=-1for the error mapping:Repository checks:
make format-check,make lintandmake typecheckpass;test_public_copy.pyandtest_doc_links.pypass. Ofmake test-unit,pytest bench -qpasses (251), andpytest tests/unit -n 16has 45,140 passed and 3 failed, none in code this PR touches.test_code_lang_lua.py's linear-time case passes when run alone. The twotest_cross_replica_auth.pyretire tests fail the same way on the base commit here (retiring 'k1' would leave no key to sign with).CI wiring for .NET is out of scope, as the issue says.
AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code wrote the client, tests and README, and Codex reviewed the diff. I checked the request bodies and error mapping against
sdk/javaanddocs/reference/errors.md, ran the tests, made 16 single breaks one at a time and saw each fail the suite, and ran the README example against a local Loom.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed. (make format-check,make lintandmake typecheckpass;make test-unitdoes not:pytest benchpasses andpytest tests/unithas three failures outside this PR, listed under Tests.)docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.