Skip to content

ashishpatel26/AIAgentWorkshop

Repository files navigation

🧠 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
Sr No Topic Colab Link
1. CrewAI Notebook to Make A Finance Agent Open in Colab
2. SmolAgent Streamlit App Run in Notebook(AI news Agent) Open in Colab
3. CrewAI Gemini Streamlit App Run in Notebook(AI News Agent) Open in Colab
4. Gemini Vision Pro Code Agent(Code Agent) Open in Colab

πŸ”„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

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]
Loading

πŸ“ Step Breakdown:

Step Description
βœ… Step 1: Extract & Validate - Detects if input is a validcalendar 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 auser-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

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
Loading

πŸ“ Step Breakdown:

Component Description
βœ… Router - Classifies requests intonew 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

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]
Loading

πŸ“ 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 thefinal 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

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
Loading

πŸ“ Step Breakdown:

πŸ› οΈOrchestrator πŸ“Planning Phase ✍️Writing Phase πŸ”Review Phase
πŸ”Ž Analyzes theblog topic and requirements πŸ“Œ Breaks content intosections πŸ—οΈ Assigns sections tospecialized writers βœ… Evaluatescontent flow and cohesion
πŸ—οΈ Generates astructured content plan πŸ“ Definesword count and writing style πŸ”— Maintainscontext and consistency ✨ Suggestsimprovements
πŸ”„ Overseescontent cohesion - - πŸ† Produces apolished 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

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

Loading

πŸ”„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

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
Loading

Running live in Colab

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

🀝 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.


πŸ“œ License

This project is licensed under the MIT License – see LICENSE for details.


πŸ“¬ Contact

For questions or collaborations, feel free to reach out:

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


🎯 Happy Coding! πŸš€

Releases

No releases published

Packages

No packages published