How crewaiinc/template_conversational_example works
Purpose and Entry Points
This repository demonstrates a persistent CrewAI conversational-routing crew intended for CrewAI Enterprise deployment. Primary local entry points are terminal chat in terminal_chat.py, flow execution in src/conversational_routing/main.py, and a Streamlit polling client in demo_streamlit_poll/streamlit_app.py. Separate Slack and webhook integrations are deployable examples rather than dependencies of the core crew.
Crew Flow and Conversation State
The central flow receives current_message and optionally a conversation id, then routes the message to a single assistant crew. CrewAI flow persistence retains history keyed by the returned conversation ID, allowing subsequent kickoff requests to continue the same session. Core flow package paths are src/conversational_routing/main.py and src/conversational_routing/__init__.py.
Assistant Crew Definition
The assistant behavior is defined as a CrewAI crew with agent/task configuration rather than application-layer routing code. The crew implementation is at src/conversational_routing/crews/assistant_crew/assistant_crew.py; its declarative agent and task contracts reside in src/conversational_routing/crews/assistant_crew/config/agents.yaml and src/conversational_routing/crews/assistant_crew/config/tasks.yaml. This is the principal boundary for changing prompts, responsibilities, and response structure.
Model Provider Boundary
LLM provider selection is isolated behind model modules, enabling the crew to use OpenAI, Google Gemini, or Vertex-backed configurations without placing provider logic in the UI/integration clients. Relevant paths are src/conversational_routing/models/openai.py, src/conversational_routing/models/gemini.py, and src/conversational_routing/models/vertex.py. Provider credentials and runtime settings are environment-supplied, with example variables in .env.sample.
Enterprise API Interaction
When deployed to CrewAI Enterprise, clients initiate work through /kickoff, receive a kickoff ID, and poll /status/{kickoff_id} until completion. The completed result contains the assistant response plus the persistent conversation ID to use on later messages. Thus, Enterprise is both the asynchronous execution boundary and the stateful conversation-access boundary; local clients should not assume synchronous crew completion.
User-Facing and Integration Clients
demo_streamlit_poll/streamlit_app.py is the interactive client for the Enterprise kickoff/status polling lifecycle. terminal_chat.py provides a local terminal interaction path, and test_chat.py exercises consecutive-message behavior. Additional adapters expose the same conversational capability to external channels: Slack via demo_slackbot/app.py and HTTP/webhook hosting via demo_webhooks/app.py. The webhook demo includes a simple browser surface at demo_webhooks/templates/index.html.
Runtime and Deployment
The Python project/dependency definition is pyproject.toml, with locked resolution in uv.lock. The Slack and webhook demos include Procfiles (demo_slackbot/Procfile, demo_webhooks/Procfile) and requirements files for independently hosted processes. The knowledge artifact knowledge/freedom_benefits.pdf is repository content available for crew-oriented knowledge use, though its ingestion behavior is defined by the crew/runtime configuration rather than the clients.
Main entry points: assistant_crew.py Assistant crew · main.py Persistent conversation flow · app.py Webhook adapter · streamlit_app.py Polling chat client
Components 16
Conversation Core
- Persistent conversation flow · Accepts a message and optional conversation ID.
src/conversational_routing/main.py - Flow package
src/conversational_routing/__init__.py - Assistant crew · Single routed assistant execution boundary.
src/conversational_routing/crews/assistant_crew/assistant_crew.py - Agent contracts
src/conversational_routing/crews/assistant_crew/config/agents.yaml - Task contracts
src/conversational_routing/crews/assistant_crew/config/tasks.yaml - Benefits knowledge · Crew-oriented source material.
knowledge/freedom_benefits.pdf
Model Providers
- OpenAI model
src/conversational_routing/models/openai.py - Gemini model
src/conversational_routing/models/gemini.py - Vertex model
src/conversational_routing/models/vertex.py
Enterprise Runtime
- CrewAI Enterprise API · Provides kickoff, status polling, and persistent conversation access.
- Conversation history · Keyed by the returned conversation ID.
Clients and Adapters
- Polling chat client
demo_streamlit_poll/streamlit_app.py - Terminal chat
terminal_chat.py - Slack adapter · Independently deployable example.
demo_slackbot/app.py - Webhook adapter · Independently deployable example.
demo_webhooks/app.py - Webhook browser surface
demo_webhooks/templates/index.html
Connections 15
- Polling chat client → CrewAI Enterprise API: POST /kickoff; poll /status
- Slack adapter → CrewAI Enterprise API: initiates conversations
- Webhook adapter → CrewAI Enterprise API: initiates conversations
- Webhook browser surface → Webhook adapter: browser interface
- CrewAI Enterprise API → Persistent conversation flow: runs kickoff
- CrewAI Enterprise API → Conversation history: stores and returns ID
- Persistent conversation flow → Assistant crew: routes each message
- Persistent conversation flow → Flow package: package entry
- Terminal chat → Persistent conversation flow: local interaction
- Assistant crew → Agent contracts: loads agents
- Assistant crew → Task contracts: loads tasks
- Assistant crew → Benefits knowledge: uses knowledge · Runtime ingestion is configuration-driven.
- Assistant crew → OpenAI model: selects provider
- Assistant crew → Gemini model: selects provider
- Assistant crew → Vertex model: selects provider