Icon

CrewAI - AI-Agents solve your Tasks with Ollama

KNIME and CrewAI - use an AI-Agent system to let a local LLM like Llama3 solve your tasks

KNIME and CrewAI - use an AI-Agent system to let a local LLM like Llama3 solve your tasks

The agents will 'discuss' among themselves and come back with a (hopefully) perfect soltion to your task based on the instructions you gave

---
Adapted from:

Integrating Agent Frameworks into Low Code Tools: Making CrewAI work in KNIME
https://medium.com/p/a7fecb042915
https://hub.knime.com/lowcodeaiftw/spaces/Public/LLMs/CrewAI~lgdow45tWuhhb4fT/

by https://medium.com/@martindausa

Annotations and comments
  • Maybe download the whole LLM workflow group in order to get all the folders (https://hub.knime.com/mlauber71/spaces/LLM_Space/~17k4zAECNryrZw1X/)
  • work in progress
  • Prerequisites: Ideally, the KNIME 4.7 (or higher) Version Installed including Python Integration Extension. Custom Python Environment set up including key KNIME Packages and CrewAI package as well as Ollama (also pull the LLM models you want to use). cf. "py_knime_crewai.yml" in the /data/ folder Limitations (and ideas for future development) - by @martindausa: No support for "Tools" that the agents can use. Agents will try and use Tools regardless, and it seems this cannot be switched off in CrewAI. Recommendation: Put "YOU DO NOT NEED TO USE TOOLS." inside any Agent Description and Task Description. Define Agents: Agent Name Agent Goal Agent Backstory Agent Model (currently Llama3 / 3.1 and Mistral, vou can add more) Define Tasks: Task Name Task Description Assign Agent to perform the Task Flexibility to inject certain parameters into the task (ParameterName: ParameterValue)
  • Make sure you have the Ollama models pulled locally and they are running ollama pull mxbai-embed-large ollama pull mistral:instruct ollama pull llama3:instruct ollama pull llama3.1 ollama run mistral:instruct ollama run llama3:instruct ollama run llama3.1
  • Define Agents and their models
  • Concatenate Agent and Task Outputs Note: Add new Agents / Tasks by copying respective components. Make sure to add additional input ports to Concat nodes and connect new Agents/tasks accordingly
  • Kickoff your Agents - you can check the progress and the results in the log folder ../data/chat/ollama_crewai_<...>
  • Define Tasks Note: Any new task component needs Input from Agent Concat Node
  • RowID
  • agentsMaxIter
  • agentsAllowCooperation
  • context.workflow.parent-path
  • path.separator.system length_parent_path= length(column("context.workflow.parent-path")) substr(column("context.workflow.parent-path"), length_parent_path-1, 1)
  • => paths
  • create /data/ folder if it does not exist
  • context.workflow.absolute-path context.workflow.path context.workflow.name
  • context.workflow.data-path
  • data-path
  • path variables
  • collect agents
  • Task Details
  • TaskParameterDetails
  • current time
  • variable("agentName")
  • agentModel
  • AgentName
  • AgentGoal
  • AgentBackStory
  • parameterValue
  • parameterName
  • taskName
  • taskDescription
  • selectedAgent
  • CrewAI using local Ollama / Llama3 / Mistral
  • olama_crewai_
  • TaskDetails
  • if (equals(column("os.name"), "Mac OS X") ) {"0"} else if (contains(lowerCase(column("os.name")),"mac" )) {"0"} else {"1"}
  • conda.environment java.home
  • conda.environment "py_knime_crewai" Windows
  • conda.environment "py_knime_crewai" MacOSX Apple Scilicon
  • osgi.syspath => find where the KNIME installtion is located on Windows or MacOSX also java.home
  • $$ROWID$$ = "java.home" => TRUE
  • java.home
  • var_environment_validation
  • stamp_day_txt
  • stamp_time_txt
  • var_file_name ../data/chat/
  • var_file_name_html
  • var_file_name_pdf
  • var_file_name_part ollama_crewai_ return "ollama_crewai_result"; return "ollama_crewai_" + $${Sstamp_day_txt}$$ + "_" + $${Sstamp_time_txt}$$;
  • var_folder_log
  • stamp_time
  • stamp_day
  • stamp_*

Nodes

Extensions

Links