Nat TaylorBlog, AI, Product Management & Tinkering

Test Drive: crewAI

Published on .

Today I’m test driving crewAI, “framework for orchestrating role-playing, autonomous AI agents.” I’ll try again to make a toy clone of the the NotebookLM deep dive funcationality. The process will be:

  1. Install CrewAI
  2. Implement :)

Here’s the code I ended up with. It produced decent results. It didn’t do anything fancy, just a single completions call. Some of the built in prompts are “fun”

To give my best complete final answer to the task use the exact following format:

Thought: I now can give a great answer

Final Answer: Your final answer must be the great and the most complete as possible, it must be outcome described. I MUST use these formats, my job depends on it!

you MUST return the actual complete content as the final answer, not a summary. Begin! This is VERY important to you, use the tools available and give your best Final Answer, your job depends on it! Thought:

podcast_host:
  role: Lead podcast host
  goal: Script an engaging podcast
  backstory: Quirky and talented, his audience loves how he finds interestings topocs

podcast_script_task:
  description: >
    Generate a podcast script of back and forth exchange between co-hosts that deep dives into this text:
    {text}
  expected_output: >
    A script of turn by turn lines from the co-hosts
  agent: podcast_host
 

from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task


@CrewBase
class CrewdemoCrew():
	"""Crewdemo crew"""

	@agent
	def podcast_host(self) -> Agent:
		return Agent(
			# config=self.agents_config['podcast_host'],
			config = {
				"role": "Lead podcast host",
  				"goal": "Script an engaging podcast",
  				"backstory": "Quirky and talented, his audience loves how he finds interestings topocs",
			},
			verbose=True
		)

	@task
	def podcast_script_task(self) -> Task:
		print(type(self.tasks_config['podcast_script_task']))
		return Task(
			
			config=self.tasks_config['podcast_script_task'],
		)

	@crew
	def crew(self) -> Crew:
		"""Creates the Crewdemo crew"""
		return Crew(
			agents=self.agents, # Automatically created by the @agent decorator
			tasks=self.tasks, # Automatically created by the @task decorator
			process=Process.sequential,
			verbose=True,
			# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
		)Code language: Python (python)

Popular Posts

Post Navigation

«
»