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
- Host: GitHub
- URL: https://github.com/ashishpatel26/aiagentworkshop
- Owner: ashishpatel26
- License: mit
- Created: 2025-02-12T13:02:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-24T06:20:10.000Z (over 1 year ago)
- Last Synced: 2025-03-24T06:26:28.861Z (over 1 year ago)
- Topics: agent, aiagent, aiagents, crewai, generative-ai, notebook, python, rag, smolagents
- Language: Jupyter Notebook
- Homepage: https://github.com/ashishpatel26/AIAgentWorkshop.git
- Size: 55.7 MB
- Stars: 68
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
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 | [](https://colab.research.google.com/github/ashishpatel26/AIAgentWorkshop/blob/main/1-CrewAI_Notebook.ipynb) |
| 2. | SmolAgent Streamlit App Run in Notebook(AI news Agent) | [](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) | [](https://colab.research.google.com/github/ashishpatel26/AIAgentWorkshop/blob/main/3_Gemini_crewAI_Agents.ipynb) |
| 4. | Gemini Vision Pro Code Agent(Code Agent) | [](https://colab.research.google.com/github/ashishpatel26/AIAgentWorkshop/blob/main/4_GeminiVisionPro_Agent.ipynb) |
| 5. | Sql Agent to Communicate with Database(Sql Agent) | [](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:

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

> **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**

> **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

---
## π€ 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! π_