Skip to content
CrewAI

Customer Support Chatbot with CrewAI

Build an AI customer support chatbot that searches your FAQ knowledge base and answers questions accurately — with working CrewAI code.

chatbotcustomer supportFAQknowledge base

Working Code

CrewAI
from crewai import Agent, Crew, Task
from langchain_openai import ChatOpenAI
from langchain_core.tools import tool
@tool
def search_faq(query: str) -> str:
"""Search the FAQ knowledge base for relevant answers."""
results = faq_store.similarity_search(query, k=3)
return "\n\n".join(
f"Q: {r.metadata['question']}\nA: {r.page_content}"
for r in results
)
agent = Agent(
role="Specialist",
goal="You are a helpful customer support agent. Use search_faq to find answers from the knowledge base before responding. Always cite the source FAQ.",
tools=[search_faq],
llm=ChatOpenAI(model="gpt-4o"),
)
task = Task(
description="How do I reset my password?",
expected_output="Detailed response",
agent=agent,
)
crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()
print(result.raw)

Step by Step

1

Install dependencies

Install CrewAI and the required tools for this use case.

2

Define your tools

Create the domain-specific tool functions your agent will use to interact with external services.

3

Create the agent and run

Initialize the CrewAI agent with your tools, set the system prompt, and execute a query.

Ready to build with CrewAI?

Generate a production-ready project with CrewAI pre-configured — FastAPI + Next.js, auth, streaming, and more.

Get Started

Ready to build your first production AI agent?

Open-source tools, battle-tested patterns, zero boilerplate. Configure your stack and ship in minutes — not months.