From b16b0da22ff1a9a2eeb2a474b248888fd5ed863a Mon Sep 17 00:00:00 2001 From: Arushi Gupta Date: Mon, 23 Feb 2026 13:09:17 -0500 Subject: [PATCH 1/4] issue 701 --- research/state.py | 125 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 research/state.py diff --git a/research/state.py b/research/state.py new file mode 100644 index 000000000..8b16cb159 --- /dev/null +++ b/research/state.py @@ -0,0 +1,125 @@ +from __future__ import annotations + +import json +from datetime import datetime +from typing import List, Dict, Optional, Tuple +from pydantic import BaseModel, Field + +#Supporting Schemas + +class DataFrameInfo(BaseModel): + shape: Tuple[int, int] + columns: List[str] + dtypes: Dict[str, str] + null_counts: Dict[str, int] + sample_rows: List[Dict] + detected_time_column: Optional[str] = None + + +class ColumnInfo(BaseModel): + name: str + dtype: str + statistics: Dict[str, float] = Field(default_factory=dict) + detected_issues: List[str] = Field(default_factory=list) + + +class NotebookCell(BaseModel): + id: str + cell_type: str + content: str + + result_text: Optional[str] = None + result_tables: Optional[List[Dict]] = None + result_images: Optional[List[str]] = None + + error: Optional[str] = None + executed_at: Optional[datetime] = None + + +#Core Agent State Tracking + +class AgentState(BaseModel): + #Metadata + version: str = "1.0.0" + created_at: datetime = Field(default_factory=datetime.utcnow) + last_updated: datetime = Field(default_factory=datetime.utcnow) + + #Conversation + conversation_history: List[Dict[str, str]] = Field(default_factory=list) + + #Dataset Understanding + dataset_info: Optional[DataFrameInfo] = None + columns: List[ColumnInfo] = Field(default_factory=list) + + #Notebook Tracking + notebook_path: Optional[str] = None + executed_cells: List[NotebookCell] = Field(default_factory=list) + + #Analysis Progress + current_phase: str = "INITIALIZATION" + phase_progress: Dict[str, str] = Field(default_factory=dict) + + #Process Control + retry_count: int = 0 + max_retries: int = 3 + should_continue: bool = True + + #Error tracking + errors: List[str] = Field(default_factory=list) + warnings: List[str] = Field(default_factory=list) + +#Utility Methods + + def update_timestamp(self): + self.last_updated = datetime.utcnow() + + def add_error(self, message: str): + self.errors.append(message) + self.retry_count += 1 + self.update_timestamp() + + if self.retry_count >= self.max_retries: + self.should_continue = False + + def add_warning(self, message: str): + self.warnings.append(message) + self.update_timestamp() + + def advance_phase(self, next_phase: str): + self.phase_progress[self.current_phase] = "done" + self.current_phase = next_phase + self.phase_progress[next_phase] = "running" + self.retry_count = 0 + self.update_timestamp() + + def fail_phase(self): + self.phase_progress[self.current_phase] = "failed" + self.should_continue = False + self.update_timestamp() + +#Serialization Utilities + +def save_state(state: AgentState, path: str): + with open(path, "w") as f: + f.write(state.model_dump_json(indent=2)) + + +def load_state(path: str) -> AgentState: + with open(path, "r") as f: + raw = json.load(f) + + raw = migrate_state(raw) + return AgentState.model_validate(raw) + + +#Migration Strategy + +def migrate_state(data: dict) -> dict: + version = data.get("version", "0.0.0") + + if version == "0.0.0": + data["version"] = "1.0.0" + data.setdefault("retry_count", 0) + data.setdefault("max_retries", 3) + + return data From 47afafdcedbfe7a70aa32a8c9a917e24edf8c630 Mon Sep 17 00:00:00 2001 From: Arushi Gupta Date: Thu, 26 Feb 2026 15:37:25 -0500 Subject: [PATCH 2/4] crewai blog --- tutorials/CrewAI/README.md | 162 +++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 tutorials/CrewAI/README.md diff --git a/tutorials/CrewAI/README.md b/tutorials/CrewAI/README.md new file mode 100644 index 000000000..185ba5353 --- /dev/null +++ b/tutorials/CrewAI/README.md @@ -0,0 +1,162 @@ +# Learn CrewAI in 60 Minutes +## Structured Multi-Agent AI Systems with Planning, Execution, and Critique + +--- + +# 1. Goal + +This tutorial provides everything needed to become familiar with **CrewAI** in 60 minutes. + +CrewAI is a framework for building **collaborative multi-agent AI systems** where agents with specialized roles plan, execute, critique, and refine tasks iteratively. + +By the end, you will move from: + +Single LLM prompts → Structured autonomous AI systems + +--- + +# 2. What This Tutorial Provides + +## Hands-on Experience + +- Working Docker container +- Reproducible notebook (`tutorial_crewai.ipynb`) +- End-to-end runnable example +- Multi-agent planning loop + +## Conceptual Understanding + +You will understand: + +- What CrewAI is +- What problem it solves +- Native API structure +- When to use multi-agent systems +- Alternatives and trade-offs + +## Practical Application + +You can: + +- Build a Planner–Worker–Critic loop +- Execute notebook code through agents +- Implement retry logic +- Track explicit state + +## Self Sufficiency + +Everything runs inside Docker. +All dependencies are pinned. +No local environment conflicts. + +## Reproducibility + +- Notebook runs end-to-end after restart +- Execution enforced via pytest +- Version pinning prevents breakage +- Takes < 3 minutes to execute + +--- + +# 3. Structure + +## Setup + +- Clone repository +- Build Docker container +- Start Jupyter +- Verify environment + +## API Exploration + +Work through: + +`tutorial_crewai.ipynb` + +Learn: + +- Creating agents +- Defining roles +- Creating tasks +- Running a crew +- Observing iteration + +--- + +# 4. Docker Container + +The Docker container: + +- Installs CrewAI and dependencies +- Installs nbclient +- Installs Jupyter +- Pins all versions +- Runs notebook tests + +Build container: + +```bash +docker compose build +docker compose up +``` + +# 5. What is CrewAI? + +CrewAI is a Python framework for building structured multi agent AI systems. + +Instead of: + +```bash +prompt -> response +``` + +CrewAI enables: + +```bash +Planner -> Worker -> Critic -> Update -> Repeat +``` +It supports role specialization, task delegation, tool usage, explicit coordination, iterative refinement + +# 6. What Problem Does It Solve? + +Single LLM calls lack iterative correction, error recovery, explicit state, structured decomposition, and deterministic ochestration. + +CrewAI introduces modular agents, explicit tasks, structured workflows, and observable state transitions. + +# 7. Native API Overview +Core abstractions: +Agent: + +```bash +Agent( + role="Planner", + goal="Plan next notebook step", + backstory="Expert AI planner" +) +``` + +Task: + +```bash +Task( + description="Execute notebook cell", + agent=worker +) +``` + +Crew: + +```bash +Crew( + agents=[planner, worker, critic], + tasks=[task] +) +``` + +# 8. State Management + +State includes: Objective, Execution history, Notebook outputs, Error traces, Completion flag + +Explicit state ensures: Reproducibility, Debuggability, Deterministic behavior, Observability + +Avoid hidden memory. \ No newline at end of file From c27953384aaca94cbc7304d537aff34b88d656d7 Mon Sep 17 00:00:00 2001 From: Arushi Gupta Date: Thu, 5 Mar 2026 20:56:58 -0500 Subject: [PATCH 3/4] minor changes --- tutorials/CrewAI/README.md | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tutorials/CrewAI/README.md b/tutorials/CrewAI/README.md index 185ba5353..ffbe42fcd 100644 --- a/tutorials/CrewAI/README.md +++ b/tutorials/CrewAI/README.md @@ -1,5 +1,5 @@ # Learn CrewAI in 60 Minutes -## Structured Multi-Agent AI Systems with Planning, Execution, and Critique +## Structured Multi Agent AI Systems with Planning, Execution, and Critique --- @@ -7,7 +7,7 @@ This tutorial provides everything needed to become familiar with **CrewAI** in 60 minutes. -CrewAI is a framework for building **collaborative multi-agent AI systems** where agents with specialized roles plan, execute, critique, and refine tasks iteratively. +CrewAI is a framework for building **collaborative multiagent AI systems** where agents with specialized roles plan, execute, critique, and refine tasks iteratively. By the end, you will move from: @@ -17,12 +17,12 @@ Single LLM prompts → Structured autonomous AI systems # 2. What This Tutorial Provides -## Hands-on Experience +## Hands on Experience - Working Docker container - Reproducible notebook (`tutorial_crewai.ipynb`) -- End-to-end runnable example -- Multi-agent planning loop +- End to end runnable example +- Multiagent planning loop ## Conceptual Understanding @@ -31,14 +31,14 @@ You will understand: - What CrewAI is - What problem it solves - Native API structure -- When to use multi-agent systems +- When to use multiagent systems - Alternatives and trade-offs ## Practical Application You can: -- Build a Planner–Worker–Critic loop +- Build a Planner -> Worker -> Critic loop - Execute notebook code through agents - Implement retry logic - Track explicit state @@ -51,10 +51,9 @@ No local environment conflicts. ## Reproducibility -- Notebook runs end-to-end after restart -- Execution enforced via pytest -- Version pinning prevents breakage -- Takes < 3 minutes to execute +- Notebook runs end to end +- Dependencies are managed via the container environment +- Takes ~ 3 minutes to execute --- @@ -76,10 +75,10 @@ Work through: Learn: - Creating agents -- Defining roles -- Creating tasks +- Defining tasks - Running a crew -- Observing iteration +- How to give an agent tools +- How an agent calls Python functions --- From 59453ccfffc741744fecf0303891daa08eb85d6d Mon Sep 17 00:00:00 2001 From: Arushi Gupta Date: Wed, 1 Apr 2026 10:25:27 -0400 Subject: [PATCH 4/4] Cleaned up CrewAI --- tutorials/CrewAI/README.md | 74 +++++++++++++++----------------------- 1 file changed, 28 insertions(+), 46 deletions(-) diff --git a/tutorials/CrewAI/README.md b/tutorials/CrewAI/README.md index ffbe42fcd..7c4a0a0a9 100644 --- a/tutorials/CrewAI/README.md +++ b/tutorials/CrewAI/README.md @@ -5,7 +5,7 @@ # 1. Goal -This tutorial provides everything needed to become familiar with **CrewAI** in 60 minutes. +This tutorial provides everything needed to become familiar with CrewAI in 60 minutes. This folder also contains the setup for running AutoGen tutorials within a containerized environment. CrewAI is a framework for building **collaborative multiagent AI systems** where agents with specialized roles plan, execute, critique, and refine tasks iteratively. @@ -43,61 +43,43 @@ You can: - Implement retry logic - Track explicit state -## Self Sufficiency - -Everything runs inside Docker. -All dependencies are pinned. -No local environment conflicts. - ## Reproducibility - Notebook runs end to end - Dependencies are managed via the container environment -- Takes ~ 3 minutes to execute --- # 3. Structure -## Setup - -- Clone repository -- Build Docker container -- Start Jupyter -- Verify environment - -## API Exploration - -Work through: - -`tutorial_crewai.ipynb` - -Learn: - -- Creating agents -- Defining tasks -- Running a crew -- How to give an agent tools -- How an agent calls Python functions +## Quick Start +- From the root of the repository, change your directory to the CrewAI tutorial + folder: + ```bash + > cd tutorials/CrewAI + ``` + +- Once the location has been changed to the repo run the command to build the + image to run dockers: + ```bash + > ./docker_build.sh + ``` + +- Once the docker has been built you can then go ahead and run the container and + launch jupyter notebook using the created image using the command: + ```bash + > ./docker_jupyter.sh + ``` + +- Once the `./docker_jupyter.sh` script is running, follow this sequence to + explore the tutorials: + 1. **`tutorial_crewai.ipynb`**: Start here to master the fundamental commands and more about creating agents, defining tasks, running a crew, how to give an agent tools and how an agent calls Python functions. + 2. **`Autogen.example.ipynb`**: Proceed to this notebook to explore more + complex, multi-agent scenarios and advanced problem-solving techniques. + +- For more informations on the Docker build system refer to [Project template + readme](https://github.com/gpsaggese/umd_classes/blob/master/class_project/project_template/README.md) ---- - -# 4. Docker Container - -The Docker container: - -- Installs CrewAI and dependencies -- Installs nbclient -- Installs Jupyter -- Pins all versions -- Runs notebook tests - -Build container: - -```bash -docker compose build -docker compose up -``` # 5. What is CrewAI?