Skip to content

Commit

Permalink
Merge pull request #21 from aprilspeight/main
Browse files Browse the repository at this point in the history
Fix typos and add to trustworthy AI lesson
  • Loading branch information
leestott authored Feb 14, 2025
2 parents 86ddea6 + c58b41a commit 45d127c
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 56 deletions.
6 changes: 3 additions & 3 deletions 01-intro-to-ai-agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ AI Agents are **systems** that enable **Large Language Models(LLMs)** to **perfo

Let's break this definition into smaller parts:

- **System** - It's important to think about agents not as just a single component but as a system of many components.At the basic level, the components of an AI Agent are:
- **System** - It's important to think about agents not as just a single component but as a system of many components. At the basic level, the components of an AI Agent are:
- **Environment** - The defined space where the AI Agent is operating. For example, if we had a travel booking AI Agent, the environment could be the travel booking system that the AI Agent uses to complete tasks.
- **Sensors** - Environments have information and provide feedback. AI Agents use sensors to gather and interpret this information about the current state of the environment. In the Travel Booking Agent example, the travel booking system can provide information such as hotel availability or flight prices.
- **Actuators** - Once the AI Agent receives the current state of the environment, For the current task the agent determines what action to perform to change the environment. For the travel booking agent, it might be to book an available room for the user.
- **Actuators** - Once the AI Agent receives the current state of the environment, for the current task the agent determines what action to perform to change the environment. For the travel booking agent, it might be to book an available room for the user.

![What Are AI Agents?](./images/what-are-ai-agents.png?WT.mc_id=academic-105485-koreyst)

Expand Down Expand Up @@ -60,7 +60,7 @@ Now that we have a general definition of AI Agents, let us look at some specific

## When to Use AI Agents

In the earlier section, we used the Travel Agent use-case to explain how the different type of agents can be used in different scenarios of travel booking. We will contiue to use this application througout the course.
In the earlier section, we used the Travel Agent use-case to explain how the different type of agents can be used in different scenarios of travel booking. We will continue to use this application throughout the course.

Let's look at they types of use cases that AI Agents are best used for:

Expand Down
50 changes: 25 additions & 25 deletions 02-explore-agentic-frameworks/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 03-agentic-design-patterns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This is the environment in which the agent operates. These principles inform how
- **Connecting, not collapsing** – help connect people to other people, events, and actionable knowledge to enable collaboration and connection.
- Agents help connect events, knowledge, and people.
- Agents bring people closer together. They are not designed to replace or belittle people.
- **Easily accessible yet occasionally invisible** – agent largely operates in the background and only nudges us when it is relevant and appropriate.
- **Easily accessible yet occasionally invisible** – agent largely operate in the background and only nudges us when it is relevant and appropriate.
- Agent is easily discoverable and accessible for authorized users on any device or platform.
- Agent supports multimodal inputs and outputs (sound, voice, text, etc.).
- Agent can seamlessly transition between foreground and background; between proactive and reactive, depending on its sensing of user needs.
Expand Down
6 changes: 3 additions & 3 deletions 04-tool-use/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The **Tool Use Design Pattern** focuses on giving LLMs the ability to interact w

AI Agents can leverage tools to complete complex tasks, retrieve information, or make decisions. The tool use design pattern is often used in scenarios requiring dynamic interaction with external systems, such as databases, web services, or code interpreters. This ability is useful for a number of different use cases including:

- **Dynamic Information Retrieval:** Agents can query external APIs or databases to fetch up-to-date data (e.g., quering an SQLite database for data analysis, fetching stock prices or weather information).
- **Dynamic Information Retrieval:** Agents can query external APIs or databases to fetch up-to-date data (e.g., querying a SQLite database for data analysis, fetching stock prices or weather information).
- **Code Execution and Interpretation:** Agents can execute code or scripts to solve mathematical problems, generate reports, or perform simulations.
- **Workflow Automation:** Automating repetitive or multi-step workflows by integrating tools like task schedulers, email services, or data pipelines.
- **Customer Support:** Agents can interact with CRM systems, ticketing platforms, or knowledge bases to resolve user queries.
Expand All @@ -41,7 +41,7 @@ Function calling is the primary way we enable Large Language Models (LLMs) to in
For developers to implement function calling for agents, you will need:

1. An LLM model that supports function calling
2. A schema containting function descriptions
2. A schema containing function descriptions
3. The code for each function described

Let's use the example of getting the current time in a city to illustrate:
Expand Down Expand Up @@ -255,7 +255,7 @@ As we learned in [Lesson 2](../02-explore-agentic-frameworks/) agentic framework
import os
from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
from fecth_sales_data_functions import fetch_sales_data_using_sqlite_query # fetch_sales_data_using_sqlite_query function which can be found in a fecth_sales_data_functions.py file.
from fecth_sales_data_functions import fetch_sales_data_using_sqlite_query # fetch_sales_data_using_sqlite_query function which can be found in a fetch_sales_data_functions.py file.
from azure.ai.projects.models import ToolSet, FunctionTool, CodeInterpreterTool

project_client = AIProjectClient.from_connection_string(
Expand Down
6 changes: 3 additions & 3 deletions 05-agentic-rag/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Agentic RAG

This lesson provides a comprehensive overview of Agentic Retrieval-Augmented Generation (Agentic RAG), an emerging AI paradigm where large language models (LMs) autonomously plan their next steps while pulling information from external sources. Unlike static retrieval-then-read patterns, Agentic RAG involves iterative calls to the LLM, interspersed with tool or function calls and structured outputs. The system evaluates results, refines queries, invokes additional tools if needed, and continues this cycle until a satisfactory solution is achieved.
This lesson provides a comprehensive overview of Agentic Retrieval-Augmented Generation (Agentic RAG), an emerging AI paradigm where large language models (LLMs) autonomously plan their next steps while pulling information from external sources. Unlike static retrieval-then-read patterns, Agentic RAG involves iterative calls to the LLM, interspersed with tool or function calls and structured outputs. The system evaluates results, refines queries, invokes additional tools if needed, and continues this cycle until a satisfactory solution is achieved.

## Introduction

This lesson will cover

- **Understand Agentic RAG:** Learn about the emerging paradigm in AI where large language models (LLMs) autonomously plan their next steps while pulling information from external data sources
- **Understand Agentic RAG:** Learn about the emerging paradigm in AI where large language models (LLMs) autonomously plan their next steps while pulling information from external data sources.
- **Grasp Iterative Maker-Checker Style:** Comprehend the loop of iterative calls to the LLM, interspersed with tool or function calls and structured outputs, designed to improve correctness and handle malformed queries.
- **Explore Practical Applications:** Identify scenarios where Agentic RAG shines, such as correctness-first environments, complex database interactions, and extended workflows.

Expand Down Expand Up @@ -53,7 +53,7 @@ All of these steps—refining queries, choosing sources, iterating until “happ

## Iterative Loops, Tool Integration, and Memory

![Tool Intergration Architecture](./images/tool-integration.png)
![Tool Integration Architecture](./images/tool-integration.png)

An agentic system relies on a looped interaction pattern:

Expand Down
17 changes: 13 additions & 4 deletions 06-building-trustworthy-agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ To create scalable system prompts, we can use a meta prompting system for buildi
Here is an example of a meta prompt we would give to the LLM:

```plaintext
You are an expert at creating AI agent assitants.
You will be provided a company name, role, responsibilites and other
You are an expert at creating AI agent assistants.
You will be provided a company name, role, responsibilities and other
information that you will use to provide a system prompt for.
To create the system prompt, be descriptive as possible and provide a structure that a system using an LLM can better understand the role and responsibilites of the AI assistant.
To create the system prompt, be descriptive as possible and provide a structure that a system using an LLM can better understand the role and responsibilities of the AI assistant.
```

#### Step 2: Create a basic prompt
Expand Down Expand Up @@ -151,7 +151,7 @@ To build trustworthy AI agents, it is important to understand and mitigate the r

## Human-in-the-Loop

Another effective way to build trustworthy AI Agent systems is using a Human-in-the-loop. This creates a flow where users are able to provide feedback to the Agents during run. Users essentially act as agent in a multi-agent system and by providing apporval or termination of the running process.
Another effective way to build trustworthy AI Agent systems is using a Human-in-the-loop. This creates a flow where users are able to provide feedback to the Agents during run. Users essentially act as agent in a multi-agent system and by providing approval or termination of the running process.

![Human in The Loop](./images/human-in-the-loop.png)

Expand All @@ -177,4 +177,13 @@ await Console(stream)

```

## Conclusion

Building trustworthy AI agents requires careful design, robust security measures, and continuous iteration. By implementing structured meta prompting systems, understanding potential threats, and applying mitigation strategies, developers can create AI agents that are both safe and effective. Additionally, incorporating a human-in-the-loop approach ensures that AI agents remain aligned with user needs while minimizing risks. As AI continues to evolve, maintaining a proactive stance on security, privacy, and ethical considerations will be key to fostering trust and reliability in AI-driven systems.

## Additional Resources

- [Responsible AI overview](https://learn.microsoft.com/azure/ai-studio/responsible-use-of-ai-overview)
-[Evaluation of generative AI models and AI applications](https://learn.microsoft.com/azure/ai-studio/concepts/evaluation-approach-gen-ai)
- [Safety system messages](https://learn.microsoft.com/azure/ai-services/openai/concepts/system-message?context=%2Fazure%2Fai-studio%2Fcontext%2Fcontext&tabs=top-techniques)
- [Risk Assessment Template](https://blogs.microsoft.com/wp-content/uploads/prod/sites/5/2022/06/Microsoft-RAI-Impact-Assessment-Template.pdf?culture=en-us&country=us)
14 changes: 6 additions & 8 deletions 07-planning-design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ from pprint import pprint
messages = [
SystemMessage(content="""You are an planner agent.
Your job is to decide which agents to run based on the user's request.
Below are the available agents specialised in different tasks:
Below are the available agents specialized in different tasks:
- FlightBooking: For booking flights and providing flight information
- HotelBooking: For booking hotels and providing hotel information
- CarRental: For booking cars and providing car rental information
Expand All @@ -132,7 +132,7 @@ if response_content is None:
pprint(json.loads(response_content))
```

Below is the output from the above code and you can then use this structured output to route to `assigned_agent` and summarise the travel plan to end user
Below is the output from the above code and you can then use this structured output to route to `assigned_agent` and summarize the travel plan to the end user.

```json
{
Expand Down Expand Up @@ -179,14 +179,14 @@ e.g sample code
messages = [
SystemMessage(content="""You are a planner agent to optimize the
Your job is to decide which agents to run based on the user's request.
Below are the available agents specialised in different tasks:
Below are the available agents specialized in different tasks:
- FlightBooking: For booking flights and providing flight information
- HotelBooking: For booking hotels and providing hotel information
- CarRental: For booking cars and providing car rental information
- ActivitiesBooking: For booking activities and providing activity information
- DestinationInfo: For providing information about destinations
- DefaultAgent: For handling general requests""", source="system"),
UserMessage(content="Create a travel plan for a family of 2 kids from Singapore to Melboune", source="user"),
UserMessage(content="Create a travel plan for a family of 2 kids from Singapore to Melbourne", source="user"),
AssistantMessage(content=f"Previous travel plan - {TravelPlan}", source="assistant")
]
# .. re-plan and send the tasks to respective agents
Expand All @@ -196,10 +196,8 @@ For a more comprehensive planning do checkout Magnetic One [Blogpost](https://ww

## Summary

In this article we have looked at an example of how we can create a planner that can dynamically select the available agents defined. The output of the Planner decomposes the tasks and assigns the agents so them to be executed. It is assumed the agents has access to function/tools that are required to perform the task. In addition to the agents you can include other patterns like reflection, summarizer , round robin chat to further customise
In this article we have looked at an example of how we can create a planner that can dynamically select the available agents defined. The output of the Planner decomposes the tasks and assigns the agents so them to be executed. It is assumed the agents has access to function/tools that are required to perform the task. In addition to the agents you can include other patterns like reflection, summarizer, and round robin chat to further customize.

## Additional Resources

* Using o1 reasoning models have proved quite adavnaced in planning complex tasks - TODO: Share example?

* Autogen Magentic One - A Generalist multi agent system for solving complex task and has achieved impressive results on multiple challenging agentic benchmarks. Reference: [autogen-magentic-one](https://github.com/microsoft/autogen/tree/main/python/packages/autogen-magentic-one). In this implementation the orchestrator create task specific plan and delegates these tasks to the available agents. In addition to planning the orchestrator also employs a tracking mechanism to monitor the progress of the task and re-plans as required.
* AutoGen Magentic One - A Generalist multi agent system for solving complex task and has achieved impressive results on multiple challenging agentic benchmarks. Reference: [autogen-magentic-one](https://github.com/microsoft/autogen/tree/main/python/packages/autogen-magentic-one). In this implementation the orchestrator create task specific plan and delegates these tasks to the available agents. In addition to planning the orchestrator also employs a tracking mechanism to monitor the progress of the task and re-plans as required.
13 changes: 5 additions & 8 deletions 08-multi-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ As soon as you start working on a project that involves multiple agents, you wil

In this lesson, we're looking to answer the following questions:

- What are the scenarios where multi-agents are applicable to?
- What are the advantages of using multi-agents over just one singular agent doing multiple tasks?
- What are the building blocks of implementing the multi-agent design pattern?
- What are the scenarios where multi-agents are applicable to?
- What are the advantages of using multi-agents over just one singular agent doing multiple tasks?
- What are the building blocks of implementing the multi-agent design pattern?
- How do we have visibility to how the multiple agents are interacting with each other

## Learning Goals
Expand Down Expand Up @@ -143,8 +143,6 @@ There's quite a few agents listed above both for the specific refund process but

## Assignment

What's a good assignment for this lesson?

Design a multi-agent system for a customer support process. Identify the agents involved in the process, their roles and responsibilities, and how they interact with each other. Consider both agents specific to the customer support process and general agents that can be used in other parts of your business.

> Have a think before you read the solution below, you may need more agents than you think.
Expand All @@ -171,6 +169,5 @@ In this lesson, we've looked at the multi-agent design pattern, including the sc

## Additional resources

- [Autogen design patterns](https://microsoft.github.io/autogen/0.4.0.dev4/user-guide/core-user-guide/design-patterns/index.html)
- [Agentic design patterns](https://www.analyticsvidhya.com/blog/2024/10/agentic-design-patterns/)

- [AutoGen design patterns](https://microsoft.github.io/autogen/0.4.0.dev4/user-guide/core-user-guide/design-patterns/index.html)
- [Agentic design patterns](https://www.analyticsvidhya.com/blog/2024/10/agentic-design-patterns/)
2 changes: 1 addition & 1 deletion 10-ai-agents-production/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AI Agents in Production
# AI Agents in Production

## Introduction

Expand Down

0 comments on commit 45d127c

Please sign in to comment.