ASAmol Shukla
Projects
Learning Hub
Prompts
Skills
Contact
Resume
Course Outline
Syllabus Overview

Data Science: NumPy, pandas, Matplotlib, seaborn & Plotly

Courses/Data Science: NumPy, pandas, Matplotlib, seaborn & Plotly/5: Developing Intelligent Agentic Data Pipelines

Data Science

5: Developing Intelligent Agentic Data Pipelines

Tool-calling patterns, ReAct architecture, safety sandboxing, and orchestrating analytical agents.

90 mins12 mins read

The Shift from Static Prompts to Agentic Loops

Classical Generative AI is linear: you write a prompt, and the model outputs a text completion. Agentic AI introduces a loop where the LLM is given tools, acts as a planner, and reasons through execution steps.

ReAct (Reason + Act) Workflow

A classic agent loops through:

  1. Thought: Analyze the task and determine the next action.
  2. Action: Select a tool and call it with arguments (e.g. run a Python database query).
  3. Observation: Read the tool's output and feed it back to the model.
  4. Repeat until a final answer is generated.

Safety Precautions

Because agents can write and run python scripts dynamically, you must implement sandboxed runtime environments (like Docker containers or restricted exec runtimes) to avoid shell injection vulnerabilities on your backend server.

python · worked example
# Implementation of a simple local data analysis tool-calling Agent
import json

# Define the Tool function
def calculate_salary_stats(data_str):
    """Calculates mean stats on a JSON string representing salaries."""
    try:
        data = json.loads(data_str)
        salaries = [employee["salary"] for employee in data]
        avg = sum(salaries) / len(salaries)
        return json.dumps({"status": "success", "average": avg, "count": len(salaries)})
    except Exception as e:
        return json.dumps({"status": "error", "message": str(e)})

# Simulated ReAct Loop
prompt = "Analyze the salaries of the team: [\n  {\"name\": \"Amol\", \"salary\": 120000},\n  {\"name\": \"Nikita\", \"salary\": 95000},\n  {\"name\": \"Sanjay\", \"salary\": 110000}\n]"

print("== AGENT LOGS ==")
print("Thought: The user wants to calculate statistics on the provided salary list. I should call the 'calculate_salary_stats' tool.")
print("Action: calling calculate_salary_stats(args='[...salary data...]')")

# Call the tool
observation = calculate_salary_stats('[{"name": "Amol", "salary": 120000}, {"name": "Nikita", "salary": 95000}, {"name": "Sanjay", "salary": 110000}]')
print(f"Observation: {observation}")

print("Thought: The average salary is 108,333.33 for 3 employees. I am ready to formulate the final answer.")
print("Final Answer: The team average salary is $108,333.33 across 3 employees.")
Read-only sample

Lesson Code (python)

# Implementation of a simple local data analysis tool-calling Agent
import json

# Define the Tool function
def calculate_salary_stats(data_str):
    """Calculates mean stats on a JSON string representing salaries."""
    try:
        data = json.loads(data_str)
        salaries = [employee["salary"] for employee in data]
        avg = sum(salaries) / len(salaries)
        return json.dumps({"status": "success", "average": avg, "count": len(salaries)})
    except Exception as e:
        return json.dumps({"status": "error", "message": str(e)})

# Simulated ReAct Loop
prompt = "Analyze the salaries of the team: [\n  {\"name\": \"Amol\", \"salary\": 120000},\n  {\"name\": \"Nikita\", \"salary\": 95000},\n  {\"name\": \"Sanjay\", \"salary\": 110000}\n]"

print("== AGENT LOGS ==")
print("Thought: The user wants to calculate statistics on the provided salary list. I should call the 'calculate_salary_stats' tool.")
print("Action: calling calculate_salary_stats(args='[...salary data...]')")

# Call the tool
observation = calculate_salary_stats('[{"name": "Amol", "salary": 120000}, {"name": "Nikita", "salary": 95000}, {"name": "Sanjay", "salary": 110000}]')
print(f"Observation: {observation}")

print("Thought: The average salary is 108,333.33 for 3 employees. I am ready to formulate the final answer.")
print("Final Answer: The team average salary is $108,333.33 across 3 employees.")

Console Output

== AGENT LOGS ==
Thought: The user wants to calculate statistics on the provided salary list. I should call the 'calculate_salary_stats' tool.
Action: calling calculate_salary_stats(args='[...salary data...]')
Observation: {"status": "success", "average": 108333.33333333333, "count": 3}
Thought: The average salary is 108,333.33 for 3 employees. I am ready to formulate the final answer.
Final Answer: The team average salary is $108,333.33 across 3 employees.

Course complete

You finished Data Science!

Review the full syllabus, revisit any lesson, or explore another course in the Learning Hub.

View full syllabusBrowse all courses
Previous: Predictive Modeling with Scikit-Learn
Made withbyAmol Shukla·amolshukla.online
ASAmol Shukla

AI Developer, Trainer & Agentic AI Expert building practical learning systems and real-world AI applications.

Explore

  • Projects
  • Learning Hub
  • Prompts
  • Skills
  • Contact
  • Experience
  • Blogs

Connect

  • Resume
  • Contact
© 2026 Amol Shukla·Created withbyamolshukla.online
Back to top