Qwen3 + CrewAI: Build Multi Agent Workflows in Python

Qwen3 + CrewAI

Introduction: Why CrewAI + Qwen3?

CrewAI is a Python framework for building structured multi-agent systems that:

  • Assign roles like Planner, Researcher, Coder

  • Enable collaboration between agents

  • Integrate tools like web search, code exec, and APIs

  • Work with OpenAI-compatible LLMs—including Qwen3

Paired with Qwen3-Coder, you get a local, powerful, fully open-source multi-agent system ready for real-world automation.


1. Setup: What You Need

bash
pip install crewai langchain openai

To use Qwen3 with your local vLLM server:

bash
export OPENAI_API_BASE=http://localhost:8000/v1 export OPENAI_API_KEY=qwen3-key

2. Define Agents with CrewAI

Each agent gets a:

  • Role

  • Goal

  • Backstory

  • Toolset (optional)

  • LLM backend (e.g., Qwen3)

python
from crewai import Agent from langchain.chat_models import ChatOpenAI llm = ChatOpenAI(temperature=0.2, model_name="qwen-14b") planner = Agent( role="Planner", goal="Break down complex tasks into executable subtasks", backstory="An expert strategist who organizes multi-step tasks", llm=llm ) researcher = Agent( role="Researcher", goal="Find and summarize data from the web", backstory="A top analyst who retrieves high-quality, factual information", llm=llm )

3. Define Tasks for Each Agent

Tasks are modular and agent-specific:

python
from crewai import Task plan_task = Task( description="Create a plan to build a dashboard using NASA open APIs", agent=planner ) research_task = Task( description="Find the best NASA API for space imagery and document it", agent=researcher )

4. Assemble the Crew and Execute

python
from crewai import Crew crew = Crew( agents=[planner, researcher], tasks=[plan_task, research_task], verbose=True ) result = crew.kickoff() print(result)

✅ CrewAI automatically routes instructions and coordinates dialogue between Qwen3 agents.


5. Add Tools and Memory

CrewAI supports:

  • langchain.tools for search, APIs, file access

  • memory=True to store prior context

  • Custom logic between agents

Example: Tool Integration

python
from langchain.tools import DuckDuckGoSearchRun search = DuckDuckGoSearchRun() researcher.tools = [search]

6. Example Use Case: AI Research Team

Agent Role Tool
Planner Task breakdown No tools
Researcher Info collection Web search
Coder Python & API integration Qwen3-Coder (CLI)
Presenter Format output to report Markdown generator

Workflow:
Agents pass data > execute tools > refine output > return results to user.


7. Real-World Applications

Industry Use Case
Legal Case summarization, precedent research
Finance Market report generation
Education Course content + quiz builder agents
Healthcare Triage planner + medical summarizer
SaaS Automation Internal coders + QA bots + task managers

All powered by self-hosted Qwen3 models using vLLM or Transformers.


Conclusion: Qwen3 + CrewAI = Open Multi-Agent Brilliance

With CrewAI and Qwen3, you can build:

  • ✅ Autonomous task planners

  • ✅ Collaborative researchers and coders

  • ✅ Domain-specific agent workflows

  • ✅ 100% open-source + offline capable setups

Whether you’re automating internal work, building intelligent assistants, or experimenting with LLM collaboration—Qwen3 + CrewAI delivers structured AI teamwork.


Resources



Qwen3 Coder - Agentic Coding Adventure

Step into a new era of AI-powered development with Qwen3 Coder the world’s most agentic open-source coding model.