// Create a Zep client with your API key.usingvarclient=newZepClient(apiKey);// Create a user to associate with threads.varuser=awaitclient.User.AddAsync(userId:"test-user-"+Guid.NewGuid().ToString("N")[..8],firstName:"Test",lastName:"User",email:"test@example.com");// Start a new thread for the user.varthread=awaitclient.Thread.StartANewThreadAsync(threadId:"thread-"+Guid.NewGuid().ToString("N")[..8],userId:user.UserId!);// Add messages to the thread.varresponse=awaitclient.Thread.AddMessagesToAThreadAsync(threadId:thread.ThreadId!,messages:[ new ApidataThreadMessage { Content = "Hi, I'm interested in learning about temporal knowledge graphs.", Role = ApidataRoleType.User, }, new ApidataThreadMessage { Content = "Temporal knowledge graphs track how facts and relationships change over time.", Role = ApidataRoleType.Assistant, }, ],returnContext:true);// Get context for the thread based on recent messages.varcontext=awaitclient.Thread.GetUserContextAsync(threadId:thread.ThreadId!);
Graph Search
Example showing how to search a user's knowledge graph.
1 2 3 4 5 6 7 8 910111213141516171819202122
// Create a Zep client with your API key.usingvarclient=newZepClient(apiKey);// Add data to a user's knowledge graph.varuserId="test-user-"+Guid.NewGuid().ToString("N")[..8];awaitclient.User.AddAsync(userId:userId,firstName:"Graph",lastName:"User");awaitclient.Data.AddDataAsync(data:"Alice works at Acme Corp as a software engineer. She joined in 2023.",type:ModelsGraphDataType.Text,userId:userId,sourceDescription:"user_profile");// Search the user's knowledge graph for relevant facts.varresults=awaitclient.Search.GraphAsync(query:"Where does Alice work?",userId:userId,limit:5);
MEAI Tools
Example showing how to use Zep as AIFunction tools with any IChatClient.
1 2 3 4 5 6 7 8 91011121314151617181920
// Create a Zep client with your API key.usingvarclient=newZepClient(apiKey);// Create AIFunction tools for use with any IChatClient.varaddMemoryTool=client.AsAddMemoryTool();varsearchMemoryTool=client.AsSearchMemoryTool();vargetContextTool=client.AsGetContextTool();varlistThreadsTool=client.AsListThreadsTool();vargetUserNodeTool=client.AsGetUserNodeTool();varaddMessagesTool=client.AsAddMessagesTool();// These tools can be passed to any IChatClient for function calling:// var chatResponse = await chatClient.GetResponseAsync(// "What do you remember about Alice?",// new() { Tools = [searchMemoryTool, getContextTool] });
Ecosystem maintenance
This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.
Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.
Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.