From 746c7da216b9cf8d8affbfe40445fd6bcd3ae291 Mon Sep 17 00:00:00 2001 From: Shawn Henry Date: Mon, 6 Apr 2026 13:05:22 -0700 Subject: [PATCH 1/2] Revise agent examples in README.md (#5067) * Revise agent examples in README.md Updated examples for creating agents using OpenAI and Azure AI, and updated Important notice * Update README.md Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> * Update README.md Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> * Update README.md Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> * Update README.md Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update README.md Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> * Update README.md Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> * Update README.md Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> --------- Co-authored-by: westey <164392973+westey-m@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- README.md | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 4d5a9a30fc..50c0e271fe 100644 --- a/README.md +++ b/README.md @@ -120,38 +120,38 @@ if __name__ == "__main__": ``` ### Basic Agent - .NET +Create a simple Agent, using Microsoft Foundry with token-based auth, that writes a haiku about the Microsoft Agent Framework + +```c# +// dotnet add package Microsoft.Agents.AI.Foundry +// Use `az login` to authenticate with Azure CLI +using Azure.AI.Projects; +using Azure.Identity; +using System; +using Azure.AI.Projects; +using Azure.Identity; + +var endpoint = Environment.GetEnvironmentVariable("AZURE_AI_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("AZURE_AI_PROJECT_ENDPOINT is not set."); +var deploymentName = Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME") ?? "gpt-5.4-mini"; + +var agent = new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential()) + .AsAIAgent(model: deploymentName, name: "HaikuBot", instructions: "You are an upbeat assistant that writes beautifully."); + +Console.WriteLine(await agent.RunAsync("Write a haiku about Microsoft Agent Framework.")); +``` Create a simple Agent, using OpenAI Responses, that writes a haiku about the Microsoft Agent Framework ```c# -// dotnet add package Microsoft.Agents.AI.OpenAI --prerelease -using Microsoft.Agents.AI; +// dotnet add package Microsoft.Agents.AI.OpenAI +using System; using OpenAI; using OpenAI.Responses; // Replace the with your OpenAI API key. var agent = new OpenAIClient("") - .GetResponsesClient("gpt-4o-mini") - .AsAIAgent(name: "HaikuBot", instructions: "You are an upbeat assistant that writes beautifully."); - -Console.WriteLine(await agent.RunAsync("Write a haiku about Microsoft Agent Framework.")); -``` - -Create a simple Agent, using Microsoft Foundry with token-based auth, that writes a haiku about the Microsoft Agent Framework - -```c# -// dotnet add package Microsoft.Agents.AI.AzureAI --prerelease -// dotnet add package Azure.Identity -// Use `az login` to authenticate with Azure CLI -using Azure.AI.Projects; -using Azure.Identity; -using Microsoft.Agents.AI; - -var endpoint = Environment.GetEnvironmentVariable("AZURE_AI_PROJECT_ENDPOINT") ?? throw new InvalidOperationException("AZURE_AI_PROJECT_ENDPOINT is not set."); -var deploymentName = Environment.GetEnvironmentVariable("AZURE_AI_MODEL_DEPLOYMENT_NAME") ?? "gpt-4o-mini"; - -var agent = new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential()) - .AsAIAgent(model: deploymentName, name: "HaikuBot", instructions: "You are an upbeat assistant that writes beautifully."); + .GetResponsesClient() + .AsAIAgent(model: "gpt-5.4-mini", name: "HaikuBot", instructions: "You are an upbeat assistant that writes beautifully."); Console.WriteLine(await agent.RunAsync("Write a haiku about Microsoft Agent Framework.")); ``` @@ -207,4 +207,9 @@ The samples typically read configuration from environment variables. Common requ ## Important Notes -If you use the Microsoft Agent Framework to build applications that operate with third-party servers or agents, you do so at your own risk. We recommend reviewing all data being shared with third-party servers or agents and being cognizant of third-party practices for retention and location of data. It is your responsibility to manage whether your data will flow outside of your organization's Azure compliance and geographic boundaries and any related implications. +> [!IMPORTANT] +> If you use Microsoft Agent Framework to build applications that operate with any third-party servers, agents, code, or non-Azure Direct models (“Third-Party Systems”), you do so at your own risk. Third-Party Systems are Non-Microsoft Products under the Microsoft Product Terms and are governed by their own third-party license terms. You are responsible for any usage and associated costs. +> +>We recommend reviewing all data being shared with and received from Third-Party Systems and being cognizant of third-party practices for handling, sharing, retention and location of data. It is your responsibility to manage whether your data will flow outside of your organization’s Azure compliance and geographic boundaries and any related implications, and that appropriate permissions, boundaries and approvals are provisioned. +> +>You are responsible for carefully reviewing and testing applications you build using Microsoft Agent Framework in the context of your specific use cases, and making all appropriate decisions and customizations. This includes implementing your own responsible AI mitigations such as metaprompt, content filters, or other safety systems, and ensuring your applications meet appropriate quality, reliability, security, and trustworthiness standards. See also: [Transparency FAQ](./TRANSPARENCY_FAQ.md) From 090b88a9568cd1cfb3d649caa8e07fa378d9f4e9 Mon Sep 17 00:00:00 2001 From: Ryan Knight Date: Tue, 7 Apr 2026 03:57:35 -0600 Subject: [PATCH 2/2] Python: Adds sample documentation for two separate Neo4j context providers for retrieval and memory (#4010) * Python: Adds sample documentation for two separate Neo4j context providers for retrieval and memory * adding pypi links * adding dotnot examples * adding dotnot examples * merge upstream samples * fixing docs * fix relative paths --------- Co-authored-by: Ben Lackey --- .../context_providers/neo4j/README.md | 19 +++++++++++++++++++ .../context_providers/neo4j_memory/README.md | 9 +++++++++ .../05-end-to-end/neo4j_graphrag/README.md | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 python/samples/02-agents/context_providers/neo4j/README.md create mode 100644 python/samples/02-agents/context_providers/neo4j_memory/README.md diff --git a/python/samples/02-agents/context_providers/neo4j/README.md b/python/samples/02-agents/context_providers/neo4j/README.md new file mode 100644 index 0000000000..a1b51a7a97 --- /dev/null +++ b/python/samples/02-agents/context_providers/neo4j/README.md @@ -0,0 +1,19 @@ +# Neo4j Context Providers + +Neo4j offers two context providers for the Agent Framework, each serving a different purpose: + +| | [Neo4j Memory](../neo4j_memory/README.md) | [Neo4j GraphRAG](../../../05-end-to-end/neo4j_graphrag/README.md) | +|---|---|---| +| **What it does** | Read-write memory — stores conversations, builds knowledge graphs, learns from interactions | Read-only retrieval from a pre-existing knowledge base with optional graph traversal | +| **Data source** | Agent interactions (grows over time) | Pre-loaded documents and indexes | +| **Python package** | [`neo4j-agent-memory`](https://pypi.org/project/neo4j-agent-memory/) | [`agent-framework-neo4j`](https://pypi.org/project/agent-framework-neo4j/) | +| **Database setup** | Empty — creates its own schema | Requires pre-indexed documents with vector or fulltext indexes | +| **Example use case** | "Remember my preferences", "What did we discuss last time?" | "Search our documents", "What risks does Acme Corp face?" | + +## Which should I use? + +**Use [Neo4j Memory](../neo4j_memory/README.md)** when your agent needs to remember things across sessions — user preferences, past conversations, extracted entities, and reasoning traces. The memory provider writes to the database on every interaction, building a knowledge graph that grows over time. + +**Use [Neo4j GraphRAG](../../../05-end-to-end/neo4j_graphrag/README.md)** when your agent needs to search an existing knowledge base — documents, articles, product catalogs — and optionally enrich results by traversing graph relationships. The GraphRAG provider is read-only and does not modify your data. + +You can use both together: GraphRAG for domain knowledge retrieval, Memory for personalization and learning. \ No newline at end of file diff --git a/python/samples/02-agents/context_providers/neo4j_memory/README.md b/python/samples/02-agents/context_providers/neo4j_memory/README.md new file mode 100644 index 0000000000..78be8f0dbb --- /dev/null +++ b/python/samples/02-agents/context_providers/neo4j_memory/README.md @@ -0,0 +1,9 @@ +# Neo4j Memory Context Provider + +[Neo4j Agent Memory](https://github.com/neo4j-labs/agent-memory) is a graph-native memory system for AI agents that stores conversations, builds knowledge graphs from interactions, and lets agents learn from their own reasoning — all backed by Neo4j. + +For full documentation, installation instructions, code examples, and configuration details, see the [Neo4j Memory integration guide on Microsoft Learn](https://learn.microsoft.com/agent-framework/integrations/neo4j-memory). + +For a runnable example, see the [retail assistant sample](https://github.com/neo4j-labs/agent-memory/tree/main/examples/microsoft_agent_retail_assistant). + +For help choosing between the Memory and GraphRAG providers, see the [Neo4j Context Providers overview](../neo4j/README.md). diff --git a/python/samples/05-end-to-end/neo4j_graphrag/README.md b/python/samples/05-end-to-end/neo4j_graphrag/README.md index ab7f5e590e..c721e1538f 100644 --- a/python/samples/05-end-to-end/neo4j_graphrag/README.md +++ b/python/samples/05-end-to-end/neo4j_graphrag/README.md @@ -4,6 +4,8 @@ The [Neo4j GraphRAG context provider](https://github.com/neo4j-labs/neo4j-maf-pr This sample keeps setup lightweight by using a pre-built Neo4j fulltext index plus a graph-enrichment query. +For full documentation, see the [Neo4j GraphRAG integration guide on Microsoft Learn](https://learn.microsoft.com/agent-framework/integrations/neo4j-graphrag). + ## Example | File | Description |