← Generative AI Mastermind for EngineersAll programsHomeSearch
Generative AI Mastermind for Engineers·Session Recordings·3:30:10

Day 2 (morning): Agentic Workflows in Code - CrewAI from One Agent to a DevOps Crew to a Parallel Investment Adviser with Custom Tools

Ishan Datta Trainer - ML engineer at Adobe (his generative-AI voice/lip-sync product was acquired by Adobe in 2023); the entire session · Om Asnani Host - logistics and chat

The short version

  1. An agent is an LLM run more than once with self-judgement in between - draft, critique, improve - and tools are what let it act at all, because a raw model is text in, text out (0:14-0:24). Memory: short-term is this run, long-term is every run (0:24-0:29).
  2. A crew is specialists with one objective. CrewAI chosen over the OpenAI Agents SDK, LangChain, LangGraph and DSPy for simple syntax and good docs; uv install crewai; OpenRouter as the one API key for 300+ models (0:29-0:47).
  3. Beginner: one conflict-detection agent - LLM (model, key, base_url, temperature, max_tokens, timeout) -> Agent (role, goal, backstory) -> Task (description, expected_output) -> Crew -> kickoff (0:39-1:07). Role is who, goal is the outcome, backstory is the resume, the task description is how - 'the number one confusion' (0:50-1:01).
  4. Intermediate: a sequential DevOps crew - Log Analyzer (FileReadTool on a Kubernetes failure log) -> Issue Investigator (ExaSearch) -> Solution Specialist (no tools, synthesis) - with context passing, a shared system template, and the governance trio max_iter, max_execution_time (wins - 5 iterations at 60 s under a 120 s cap = 2), max_rpm (1:15-2:03). Built-in tools: file readers, scrapers, DALL-E, code interpreter, S3 (2:11-2:14).
  5. Advanced: an investment adviser on Reliance / NSE - News Explorer (web search) and Data Explorer (custom yfinance @tool functions) in parallel via ThreadPoolExecutor (async_execution 'breaks'), then Analyst (no tools, 'one of the most important agents') and Financial Expert (current-price tool, buy / hold / sell); ~100 s total, 35-40% faster than sequential; 'tutorial purposes only' (2:30-3:15). Why multi-agent: deterministic tools where hallucination is unacceptable, and parallel independent subtasks (2:38-2:44).

At a glance, three clicks deep

Skim here first: the closed row is the glance, open is the study card with the key points and timestamps, and the ↓ link drops to that concept's full write-up below.

01An agent is the LLM run in a loop with judgement; tools are what make it actAgent = iterated LLM with self-critique + tools + memory;›

Agent = iterated LLM with self-critique + tools + memory; the loop and the tools are the difference.

Draft, critique, improve - the essay example (0:15-0:18)

Text in / text out without tools (0:20-0:24)

Short-term vs long-term memory; memory=True (0:24-0:26, 2:05)

↓ Full write-up of this concept

02The CrewAI pattern: LLM -> Agent -> Task -> Crew -> kickoffPROCEDURE: LLM(model, key, base_url, temperature, max_tokens, timeout) -> Agent(role, goal, backstory) -> T…›

PROCEDURE: LLM(model, key, base_url, temperature, max_tokens, timeout) -> Agent(role, goal, backstory) -> Task(description, expected_output) -> Crew(agents, tasks) -> kickoff().

uv install crewai; OpenRouter one-key access (0:34, 0:45-0:47)

Conflict-detection agent end to end (0:44-1:06)

Role = who; goal = outcome; backstory = resume; description = how (0:50-1:01)

Three more single agents for the pattern (1:08-1:11)

↓ Full write-up of this concept

03A sequential DevOps crew: log analyzer -> investigator -> solution specialist, with context passingSequential crew: tool agents first, a tool-less synthesiser last;›

Sequential crew: tool agents first, a tool-less synthesiser last; Task(context=[...]) passes results; a shared system template keeps the crew consistent.

FileReadTool -> ExaSearch -> synthesis (1:15-1:45)

Task(context=[...]) for hand-off (1:35-1:40)

Shared system_template (1:31-1:34)

Markdown output_file per stage (1:59-2:03)

↓ Full write-up of this concept

04max_iter, max_execution_time, max_rpm: the three numbers that bound cost and runtimeBound every agent: iterations, wall-clock (wins), and requests per minute.›

Bound every agent: iterations, wall-clock (wins), and requests per minute.

max_execution_time overrides max_iter (1:50-1:55)

max_rpm for throttling (1:56-1:59)

↓ Full write-up of this concept

05Custom tools with @tool: any Python function becomes an agent capability@tool on a function + Agent(tools=[fn]);›

@tool on a function + Agent(tools=[fn]); use built-ins from crewai_tools first.

@tool decorator, four toy examples (2:54-2:58)

yfinance tools for the adviser (2:58-3:00)

Built-in catalogue: readers, scrapers, DALL-E, code interpreter, S3 (2:11-2:14)

↓ Full write-up of this concept

06Why four agents instead of one: deterministic data, hallucination risk, parallelismSplit when data needs deterministic tools, when hallucination cost is high, and when subtasks are independent.›

Split when data needs deterministic tools, when hallucination cost is high, and when subtasks are independent.

20+ parameters need tools, not search (2:38-2:40)

No model recall for money (2:41-2:42)

Parallel independent subtasks (2:43-2:44)

Tool-less Analyst as the key agent (2:46-2:50)

↓ Full write-up of this concept

07Parallel crews with ThreadPoolExecutor (because async_execution breaks)ThreadPoolExecutor.submit() per independent crew, then a sequential crew on the results.›

ThreadPoolExecutor.submit() per independent crew, then a sequential crew on the results.

Manager / workers analogy (3:03-3:05)

executor.submit() per crew (3:06-3:10)

~35 s + ~68 s = ~100 s; 35-40% saved (3:11-3:14)

↓ Full write-up of this concept

08The 'AI native engineer' framing by career stageAI-native engineer = orchestrates agents end to end;›

AI-native engineer = orchestrates agents end to end; tiered by years of experience.

Three tiers (3:20-3:22)

Testimonial clips (3:23-3:30)

↓ Full write-up of this concept

The concepts in full

01

An agent is the LLM run in a loop with judgement; tools are what make it act

One API call writes an essay. An agent writes it, reads it, decides it is not good enough, and writes it again.

Ishan's distinction: an agent re-invokes the model, judges the output, iterates, then returns. A raw LLM cannot read a file, browse or query a database - text in, text out - so a tool (web search, code interpreter, file reader, DB connector) is the mechanism that gives an agent a hand in the world. Memory splits into short-term (this execution) and long-term (all past executions), later switched on in CrewAI with memory=True (vector store for embeddings, SQLite for history).

Why it matters

Explains why agent frameworks exist at all rather than 'just call ChatGPT'.

02

The CrewAI pattern: LLM -> Agent -> Task -> Crew -> kickoff

Four objects and one method call. Every example in the session is the same shape.

PROCEDURE. (1) Define an LLM via crewai.llm.LLM with model, api_key (OpenRouter - one key for 300+ models instead of separate OpenAI / Anthropic / xAI / Google credits), base_url, temperature, max_tokens, timeout. (2) Define an Agent with role, goal, backstory, llm and tools. (3) Define a Task with description, expected_output, agent, optional context and output_file - in tasks.py. (4) Define a Crew with agents, tasks, verbose, process - in main.py. (5) crew.kickoff(inputs=...). Demonstrated first as a conflict detector on two sentences, then as content writer, code reviewer and customer-support agents. Install with uv (or pip): uv install crewai. CrewAI was chosen over the OpenAI Agents SDK, LangChain, LangGraph and DSPy for syntax simplicity and docs (which are themselves maintained by a CrewAI crew).

Why it matters

The reusable syntax for every agent built later in the day.

03

A sequential DevOps crew: log analyzer -> investigator -> solution specialist, with context passing

A Kubernetes deployment fails. Three agents read the log, search the fix, and write the runbook.

PROCEDURE. Log Analyzer uses CrewAI's built-in FileReadTool to extract errors from a .log file; Issue Investigator uses ExaSearch to find solutions; Solution Specialist has no tools and synthesises both into a step-by-step remediation plan. Downstream tasks receive upstream outputs through Task(context=[...]); a shared system_template string ('You are an expert DevOps engineer...') is passed to every agent like team-wide coding standards, layered under each role / goal / backstory. Each stage writes a markdown output file.

Why it matters

The pattern whenever one agent's output must feed the next agent's reasoning.

04

max_iter, max_execution_time, max_rpm: the three numbers that bound cost and runtime

Five iterations allowed, sixty seconds each, a two-minute cap. Only two iterations ever run.

max_iter caps how many times an agent may re-invoke the model; max_execution_time (seconds) is a hard wall-clock cutoff that takes precedence - hence the worked example; max_rpm caps requests per minute to avoid provider throttling. Ishan calls these essential even for small systems: they are the difference between a bounded bill and a runaway loop.

Why it matters

Directly sets cost, latency and reliability of any production agent.

05

Custom tools with @tool: any Python function becomes an agent capability

from crewai.tools import tool. Decorate the function. Hand it to the agent. That is the whole integration.

PROCEDURE: import the decorator, apply @tool to a plain function (calculate_square, a currency converter, a CSV reader, a URL shortener), pass the function reference in Agent(tools=[...]). Real use: three yfinance-backed tools - get_current_stock_price, get_company_info, get_income_statements - so the financial agents fetch deterministic numbers instead of asking a model to remember them. Built-in tools (file / PDF / CSV / JSON readers, website scraping, research, database, DALL-E, code interpreter, AWS S3 reader / writer) come from crewai_tools and are listed on the docs' Tools Overview page.

Why it matters

The mechanism for connecting an agent to any business logic the built-ins do not cover.

06

Why four agents instead of one: deterministic data, hallucination risk, parallelism

'Why not one giant agent?' - the question Ishan says he gets every time.

Three reasons from the investment adviser. Twenty-plus fundamental parameters are not reliably obtainable by ad-hoc web search, so a dedicated Data Explorer with custom tools fetches them. Hallucination is unacceptable when money is involved, so numbers come from deterministic tools, not model recall (he cites the paper 'Why Language Models Hallucinate'). News and financials are independent, so they run in parallel and the whole pipeline is 35-40% faster. The Analyst agent, with no tools at all, is 'one of the most important' - pure interpretation of P/E, revenue, margins, risks.

Why it matters

The conceptual heart of multi-agent design: specialisation, debuggability, parallelism.

07

Parallel crews with ThreadPoolExecutor (because async_execution breaks)

One worker is sequential. Two workers are parallel. Python's thread pool is the factory floor.

PROCEDURE: wrap each independent single-agent crew (financial, news) in a function, submit both to concurrent.futures.ThreadPoolExecutor with executor.submit(), collect results, then run the sequential analysis crew (Analyst -> Financial Expert). Ishan avoids CrewAI's own async_execution flag, which 'breaks for weird reasons'. Measured live: parallel phase ~35 s, sequential phase ~68 s, ~100 s total.

Why it matters

A concrete, reusable speed-up for any pipeline with independent branches.

08

The 'AI native engineer' framing by career stage

Outskill's pitch, worth knowing for what it claims: orchestrate agents end to end, don't just write code.

Three tiers: 10-20 years - lead AI-first teams and governance; 3-9 years - ship agentic and RAG systems and automate legacy workflows; 0-3 years - become the organisation's generative-AI go-to person. Followed by recorded learner testimonials. Promotional framing rather than technique, recorded here as context for the program's positioning.

Why it matters

Names the destination the program sells; useful when judging the rest of its claims.

Tools referenced

ToolCoverageMomentContext
CrewAIdemonstratedEvery build in the session
OpenRouterdemonstratedOne key for 300+ models
ExademonstratedExaSearch as the web-search tool
yfinancedemonstratedCustom financial tools
GPT-4.1demonstratedChosen for the harder financial agents
DALL-EdemonstratedBuilt-in image tool
AWS S3demonstratedBuilt-in reader / writer tools
uvexplainedPackage manager for the setup
LangGraphmentionedAlternative framework
LangChainmentionedAlternative framework
DSPymentionedAlternative framework ('a friend at Stanford')
OpenAI Agents SDKmentionedAlternative framework
CursormentionedTrainer's IDE

Action items

    Resources mentioned

    Resources
    • docBonuses promised
    • docCertificate rule

    Extraction notes

    This page was built from an auto-generated transcript, which garbles product and people's names. Those were corrected silently in everything above and logged here for transparency. The warnings flag claims that were true on the recording day but change fast.

    Transcript corrections applied

    The transcript saysThe trainer actually means
    Ishandita / NishanIshan Datta
    Kuwei / Kubei / Coup AICrewAI
    Excel search toolExaSearch (Exa AI), not Microsoft Excel
    Lansky (vector database company)unresolved - possibly LanceDB
    Ruby (at Adobe)unresolved Adobe team / product name

    True on recording day — verify before relying