An open API service indexing awesome lists of open source software.

https://github.com/ashishpatel26/aiagentworkshop

AI Agent Work shop include Agent from Corepython, using CrewAI and Using SmolAgent
https://github.com/ashishpatel26/aiagentworkshop

agent aiagent aiagents crewai generative-ai notebook python rag smolagents

Last synced: 3 months ago
JSON representation

AI Agent Work shop include Agent from Corepython, using CrewAI and Using SmolAgent

Awesome Lists containing this project

README

          

# 🧠 AI Agent Workshops

***13 Feb 2025, University of Wollongong, GiftCity, Gandhinagar***

---

## πŸ“Œ Table of Contents

#### **πŸ”ΉPart 1: Building Blocks – The Augmented LLM**

- **Basic LLM Calls** – Sending requests and processing responses
- **Structured Output** – Formatting responses in structured formats
- **Tool Use** – Integrating external tools with the LLM
- **Retrieval** – Using memory and external sources for better responses

#### πŸ”Ή**Part 2: Workflow Patterns for AI Systems**

- **Prompt Chaining** – Structuring multi-step AI tasks
- **Routing** – Directing requests to specialized handlers
- **Parallelization** – Running multiple AI processes simultaneously

#### πŸ”ΉPart 3: Introduction to Agentic Framework (CrewAI)

- **CrewAI Framework Step by Step**
- **Agent :** Finance Agent App

#### πŸ”ΉPart 4: Introduction to Agentic Framework(SmolAgent)

- **SmolAgent Framework Step by Step**
- **Agent** : AI News Agent App

#### πŸ”ΉPart 5: Agentic AI in SQL(SmolAgent)

- **SmolAgent Framework Step by Step for SQL**
- **Agent** : SQL AI Agent Dashboard

| Sr No | Topic | Colab Link |
| ----- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1. | CrewAI Notebook to Make A Finance Agent | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ashishpatel26/AIAgentWorkshop/blob/main/1-CrewAI_Notebook.ipynb) |
| 2. | SmolAgent Streamlit App Run in Notebook(AI news Agent) | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ashishpatel26/AIAgentWorkshop/blob/main/2-SmoleAgent_Streamlit_Notebook.ipynb) |
| 3. | CrewAI Gemini Streamlit App Run in Notebook(AI News Agent) | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ashishpatel26/AIAgentWorkshop/blob/main/3_Gemini_crewAI_Agents.ipynb) |
| 4. | Gemini Vision Pro Code Agent(Code Agent) | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ashishpatel26/AIAgentWorkshop/blob/main/4_GeminiVisionPro_Agent.ipynb) |
| 5. | Sql Agent to Communicate with Database(Sql Agent) | [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ashishpatel26/AIAgentWorkshop/blob/main/5_SmolAgent_sqlAgent.ipynb) |

---

## πŸ”„Part 2: Workflow Patterns for AI Systems

### πŸ—οΈ Prompt Chaining

Prompt chaining **breaks down complex AI tasks** into smaller, more manageable steps. Each step **processes** and **validates** the output from the previous step, improving **control and reliability**.

#### πŸ“… Calendar Assistant Example

```mermaid
graph LR
A[User Input] --> B[LLM 1: Extract]
B --> C{Gate Check}
C -->|Pass| D[LLM 2: Parse Details]
C -->|Fail| E[Exit]
D --> F[LLM 3: Generate Confirmation]
F --> G[Final Output]
```

**πŸ“ Step Breakdown:**

| **Step** | **Description** |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **βœ… Step 1: Extract & Validate** | - Detects if input is a valid**calendar request**
- Assigns a **confidence score**
- Filters out **irrelevant requests** |
| **βœ… Step 2: Parse Details** | - Extracts structured information (**date, time, participants**)
- Converts **natural language** into a structured format |
| **βœ… Step 3: Generate Confirmation** | - Creates a**user-friendly response**
- Generates calendar links if necessary |

---

### πŸ”€ Routing

Routing is a pattern that directs different types of requests to specialized **handlers**, allowing for **clean separation of concerns** and **optimized processing**.

#### πŸ“… Calendar Assistant Example

```mermaid
graph LR
A[User Input] --> B[LLM Router]
B --> C{Route}
C -->|New Event| D[New Event Handler]
C -->|Modify Event| E[Modify Event Handler]
C -->|Other| F[Exit]
D --> G[Response]
E --> G
```

**πŸ“ Step Breakdown:**

| **Component** | **Description** |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| **βœ… Router** | - Classifies requests into**new event** or **modification**
- Provides **confidence scoring** |
| **βœ… Specialized Handlers** | -**New Event Handler:** Creates calendar events
- **Modify Event Handler:** Updates existing events |

---

### ⚑ Parallelization

Parallelization improves **efficiency** by running multiple LLM calls **simultaneously** to analyze different aspects of a request in parallel.

#### πŸ“… Calendar Assistant Example

```mermaid
graph LR
A[User Input] --> B[Calendar Check]
A --> C[Security Check]
B --> D{Aggregate}
C --> D
D -->|Valid| E[Continue]
D -->|Invalid| F[Exit]
```

**πŸ“ Step Breakdown:**

| **Component** | **Description** |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| **βœ… Parallel Checks** | **- Calendar Validation:**Β Ensures a valid request
**- Security Check**Β : Screens for prompt injection |
| **βœ… Aggregation Layer** | - Merges results from parallel checks
- Makes the**final validation decision** |

---

### 🎭 Orchestrator-Workers

The **orchestrator-workers** pattern uses a **central LLM** to dynamically **analyze, coordinate, and synthesize** responses from specialized workers. This is useful for tasks requiring structured content generation.

#### πŸ“ Blog Writing Example

```mermaid
graph LR
A[Topic Input] --> B[Orchestrator]
B --> C[Planning Phase]
C --> D[Writing Phase]
D --> E[Review Phase]
style D fill:#f9f,stroke:#333,stroke-width:2px
```

**πŸ“ Step Breakdown:**

| πŸ› οΈ**Orchestrator** | πŸ“**Planning Phase** | ✍️**Writing Phase** | πŸ”**Review Phase** |
| -------------------------------------------------------------- | ---------------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------- |
| πŸ”Ž Analyzes the**blog topic** and **requirements** | πŸ“Œ Breaks content into**sections** | πŸ—οΈ Assigns sections to**specialized writers** | βœ… Evaluates**content flow and cohesion** |
| πŸ—οΈ Generates a**structured content plan** | πŸ“ Defines**word count** and **writing style** | πŸ”— Maintains**context and consistency** | ✨ Suggests**improvements** |
| πŸ”„ Oversees**content cohesion** | - | - | πŸ† Produces a**polished final version** |

---

## πŸ”„Part 3: Introduction to Agentic Framework πŸ€–

This section introduces additional architectures for building AI agents, providing a structured overview of their workflows and modular designs.

##### CrewAIAgent

**CrewAI** follows a modular, step-by-step approach that includes:

![](images/CrewAI.png)

**Example:** **Finance Agent App**

![](images/aiagentfinanceanalysis.gif)

> **Workflow**

```mermaid
graph TD
A[Start] --> B[Initialize Streamlit App]
B --> C[Set Up API Keys & Load Environment Variables]
C --> D[User Inputs Company Name]
D --> E{Start Analysis Button Clicked?}

E -- Yes --> F[Display Progress & Setup Agents]
F --> G[Create Financial Analyst Agent]
G --> H[Create Investment Strategy Reviewer Agent]
H --> I[Initialize Stock Market Scraper Tool]
I --> J[Define Stock Market Analysis Task]
J --> K[Define Investment Review Task]
K --> L[Create Financial Analysis Crew]

L --> M[Run AI Analysis Crew Process]
M --> N[Generate Financial Report]
N --> O[Display Final Financial Analysis Report]

E -- No --> P[Wait for User Action]

style A fill:#ffcc00,stroke:#333,stroke-width:2px
style O fill:#ffcc00,stroke:#333,stroke-width:2px
style M fill:#00ccff,stroke:#333,stroke-width:2px
style J fill:#00ccff,stroke:#333,stroke-width:2px

```

## πŸ”„Part 4: Introduction to Agentic Framework(SmolAgent)

##### **SmalAgent**

**SmolAgent** provides a live coding guide for building lightweight agents. Key highlights include:

- **Streamlit App:** Running using Colab as the backend server
- **AI News Agent App**

![](images/ainewsagent.gif)

> **Workflow**

```mermaid
graph TD
A[Start] --> B[Initialize Streamlit App]
B --> C[Initialize LLM and Search Tool]
C --> D[User Inputs News Topic]
D --> E[Set Search Depth and Analysis Type]
E --> F{Analyze News Button Clicked?}

F -- Yes --> G[Perform DuckDuckGo Search]
G --> H{Results Found?}

H -- Yes --> I[Create Analysis Prompt]
I --> J[Generate Analysis Using LLM]
J --> K[Display Analysis Results]
K --> L[Log Activity]

H -- No --> M[Show No Results/Error Message]

F -- No --> N[Wait for User Action]

K --> O[Show Tips for Better Results]
M --> O
O --> P[End]

style A fill:#ffcc00,stroke:#333,stroke-width:2px
style P fill:#ffcc00,stroke:#333,stroke-width:2px
style G fill:#00ccff,stroke:#333,stroke-width:2px
style J fill:#00ccff,stroke:#333,stroke-width:2px
```

> **Running live in Colab**

```mermaid
graph TD
SA[SmolAgent]
SA --> SC[Step-by-Step Live Coding]
SC --> S[Streamlit App via Colab]
SC --> N[AI News Agent App]
```

#### πŸ”ΉPart 5: Agentic AI in SQL(SmolAgent)

- **SmolAgent Framework Step by Step for SQL**
- **Agent** : SQL AI Agent Dashboard

![](images/sqlagent.gif)

---

## 🀝 Contributing

Contributions are welcome! To get started:

1. **Fork** the repository
2. **Create a branch** (`feature-new-pattern`)
3. **Commit your changes**
4. **Push to GitHub** and **open a PR**

For detailed guidelines, check [CONTRIBUTING.md](CONTRIBUTING.md).

---

## πŸ“œ License

This project is licensed under the **MIT License** – see [LICENSE](LICENSE) for details.

---

## πŸ“¬ Contact

For questions or collaborations, feel free to reach out:

πŸ“§ **Email:** ashishpatel.ce.2011@gmail.com

---

_🎯 Happy Coding! πŸš€_