Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

MAF-Persisting-02-Menu

This interactive console sample demonstrates creating, saving, loading, and resuming AgentThread instances via a simple menu-driven UI. It shows how you can persist conversation state to disk (temporary files by default) and resume later.

Features

  • Start a new persisted session and save the thread to a file
  • Start a non-persisted (in-memory) session for quick testing
  • Load an existing saved thread and continue the conversation
  • Uses PersistingUI.cs for console interactions and StreamConsoleHelper for formatted streaming output

Setup and run

  1. Configure provider credentials (example using user-secrets):
cd samples/MAF/MAF-Persisting-02-Menu
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://<your-endpoint>.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:Deployment" "gpt-5-mini"
# az login is required (samples use AzureCliCredential)
  1. Build and run:
dotnet build
dotnet run

Notes

  • By default the sample writes saved thread files to the system temporary folder (Path.GetTempPath()), and prints the saved filename to console after persisting.
  • Shared helper files are linked into the project (ChatClientProvider.cs, StreamConsoleHelper.cs, ResponseClientProvider.cs).
  • Treat persisted thread files as sensitive — they contain conversational history.

Troubleshooting

  • If you see authentication or authorization errors ensure user-secrets or environment variables are set for your chosen provider.
  • If you cannot load a saved thread, confirm the file exists and you are using the same agent configuration as when it was saved.

Related docs

License: MIT