Back to blog
  • AGENTIC
  • ENGINEERING

How to Build a Production-Ready AI Chatbot from Day One with Orkes Conductor

Maria Shimkovska Maria Shimkovska Content Engineer
Last updated: · 5 mins read

A single LLM call can’t hold a conversation: it answers once and stops. The usual fix is to build a chatbot around that limit, then figure out how to make it production-ready. Here’s how to start on a production-grade platform instead, with Orkes Conductor.


Chatbots are everywhere online right now: support widgets, onboarding flows, internal tools, order tracking. Most businesses run at least one, and enough of them are bad that building a good one can feel impossible. It isn’t. You can design a chatbot that actually helps people instead of frustrating them, as long as you know what a chatbot actually is, and build it on a platform production-grade enough to back that design up.

And they aren’t going anywhere. Online businesses are only going to lean on them more, which means the bad ones can’t stay bad forever. They’ll have to get better, and the businesses that get there first will be the ones that built on the right foundation from day one.

You’ve probably used an LLM like GPT, Claude, Gemini, or Llama. Most likely, you used it through a chatbot, like ChatGPT or the Claude app. The model and the chatbot are two different things, though. A single LLM call can’t hold a conversation because it answers once and stops.

A chatbot needs four pieces working together:

  • An LLM — the model that actually generates each reply
  • A loop — what keeps it going turn after turn, instead of answering once and stopping
  • Memory — so it doesn’t forget what you’ve already talked about 😉
  • A human task — the actual mechanism the user talks to it through

So if you’ve played around with calling an LLM but never actually built a chatbot, you’re in the right place. Everything below runs on Orkes Conductor’s Developer Edition, a free hosted Conductor server, so there’s nothing to install and nothing to set up yourself — Conductor runs the server-side tools below for you, and gets everything your own tools need up and running without you having to lift a finger.

Get your free server running now

Sign up for Developer Edition in under a minute, so you've got it ready before you even hit the code below.

Create Free Account

How the four pieces fit together

An LLM, called through an agent instead of by hand

Conductor’s Python SDK ships a native Agent class. Give it a name, a provider/model string, and instructions, and it already knows how to call the model, call its tools, and hand back the result. You never touch a raw LLM-call task yourself. Agent compiles that call into a durable Conductor workflow for you, and AgentRuntime runs it.

The model is just a single string, like "anthropic/claude-opus-5". It has to match an LLM integration you’ve already set up on your Conductor server, not anything in your code. Your API key lives there, never in your workflow or your Python process. So if you want to switch models or providers later, that’s a config change on your Conductor server, not a code change.

A loop that keeps the conversation running, instead of starting over each message

There’s no per-turn execution here. You don’t need a session ID to stitch turns together either. The whole conversation is a single Conductor workflow. It starts once and keeps running, turn after turn, for as long as you keep replying. runtime.start() kicks it off and hands back a handle. handle.stream() is how you watch it unfold. Agent compiles this loop for you too, the same way it compiles the LLM call. You never hand-wire a WAIT task or a loop yourself.

Memory split between the server and your script

A chatbot needs memory, or every reply starts from zero and forgets what you just said. Conductor gives you that in two different ways.

The first comes for free: because nothing restarts between turns, the model’s own running context already works as memory. That’s the same thing that makes an ordinary LLM conversation feel coherent, just running durably on Conductor now.

The second is for facts worth keeping even after the conversation ends, like a name or a preference. SemanticMemory handles that, backed by two plain Python tools, remember and recall, which AgentRuntime runs for you automatically.

One thing worth knowing: by default, each tool runs in its own process, which is great for isolating heavier workloads but means remember and recall wouldn’t share state on their own. CONDUCTOR_WORKER_ISOLATION=thread, which the code below already sets, runs them as lightweight threads in this same process instead, so they share the one long_term_memory object directly.

A human task is how you actually talk to the bot

human_tool() compiles to a real Conductor HUMAN task. Most agents are built to work on their own and only reach for one when they get stuck and genuinely need you. A chatbot flips that: talking to you is the whole job. So this chatbot uses a human task for every single turn instead. Call it ask_user, and its question argument is literally what the chatbot says to you. The workflow pauses right there. The message shows up as waiting work, and your reply is what completes the task. There’s no print()/input() loop doing the talking. Conductor’s own pause and resume is the chat loop.

And here’s the fun part: the whole thing, ready to run. A real chatbot that talks to you entirely through a human task, and actually remembers what’s worth keeping once the conversation’s over:

import os
# Keep the SDK's own startup/worker/poll logs out of the chat — must be set
# before the conductor import, which is what reads it. Applies to every SDK
# component (clients, workers, agent runtime).
os.environ.setdefault("CONDUCTOR_LOG_LEVEL", "WARNING")
# By default each @tool runs in its own OS worker process, so remember and
# recall would each get their own, separate long_term_memory object instead
# of sharing one — recall would never see what remember just stored. Thread
# isolation runs tool workers in this process instead, sharing memory. Must
# be set before the conductor import, which reads it at worker-startup time.
os.environ.setdefault("CONDUCTOR_WORKER_ISOLATION", "thread")
from conductor.ai.agents import Agent, AgentRuntime, EventType, human_tool, tool
from conductor.ai.agents.semantic_memory import SemanticMemory
from conductor.client.configuration.configuration import Configuration
from conductor.client.orkes_clients import OrkesClients
# Lives only in this process's memory — gone when the script exits. A real
# cross-session deployment would back this with a persistent MemoryStore
# (e.g. a vector DB) instead of the default InMemoryStore.
long_term_memory = SemanticMemory()
@tool
def remember(fact: str) -> str:
"""Save a fact about the user for later — name, preferences, anything worth recalling in a future turn."""
long_term_memory.add(fact)
return f"Remembered: {fact}"
@tool
def recall(query: str) -> str:
"""Look up anything previously remembered that's relevant to the query."""
return long_term_memory.get_context(query) or "Nothing remembered about that yet."
# This is the whole conversation mechanism: every message the chatbot
# "says" is the question argument of a real Conductor HUMAN task, and
# every reply you type completes that task. There's no print()/input()
# loop driving this — the workflow itself pauses on every turn.
ask_user = human_tool(
name="ask_user",
description="Say your next message to the user and wait for their reply.",
)
chat_agent = Agent(
name="human_chat_bot",
model="anthropic/claude-opus-5",
tools=[ask_user, remember, recall],
max_turns=200,
instructions=(
"You are a friendly conversational chatbot. The entire conversation "
"happens through the ask_user tool: start by calling ask_user with "
"a brief greeting as the 'question' argument. After the user "
"replies, respond to what they said and call ask_user again with "
"your next message — never speak outside of ask_user until the "
"very end. Save anything worth remembering with remember, and "
"check recall before answering something that might depend on an "
"earlier fact. When the user says something like 'bye', 'exit', or "
"declines further help, give a brief goodbye and stop — do not "
"call ask_user again."
),
)
# Whole-message only — "no thanks, but one more thing" shouldn't end the chat.
_CLOSING_EXACT = ("bye", "exit", "quit", "goodbye", "good bye", "no thanks", "no thank you")
# Safe as a lead-in too — "this is all, thank you" still means the same thing.
_CLOSING_PREFIXES = ("that's all", "that is all", "this is all", "nothing else", "all set", "that's it")
def _wants_to_end(text: str) -> bool:
"""Deterministically detect closing intent instead of trusting the LLM to.
The agent's own instructions ask it to recognize "bye"/"declines further
help" and stop on its own, but that's a judgment call it can get wrong
(e.g. missing "this is all. thank you" entirely). Checking common closing
phrases here — the same way "bye"/"exit"/"quit" already short-circuit to
handle.stop() — means ending the chat doesn't depend on the model noticing.
"""
normalized = text.strip().lower().rstrip(" .!?,")
return normalized in _CLOSING_EXACT or normalized.startswith(_CLOSING_PREFIXES)
def _pending_human_question(workflow_client, execution_id: str) -> str:
"""Read the actual ask_user question off the paused HUMAN task's input.
The agent status endpoint doesn't reliably surface it — for a real
human-tool pause it only exposes tool_name/parameters/response_schema,
which come back null/generic. The LLM's actual tool-call arguments
(e.g. "question") land on the paused HUMAN task's own input_data, so
that's read directly from the workflow instead.
"""
workflow = workflow_client.get_workflow(execution_id, include_tasks=True)
for task in workflow.tasks or []:
if str(task.task_type).upper() == "HUMAN" and str(task.status).upper() == "IN_PROGRESS":
return (task.input_data or {}).get("question", "")
return ""
if __name__ == "__main__":
configuration = Configuration()
workflow_client = OrkesClients(configuration).get_workflow_client()
print("Starting bot...")
with AgentRuntime() as runtime:
handle = runtime.start(chat_agent, "Begin the conversation.")
print(f"Execution: {configuration.ui_host}/execution/{handle.execution_id}\n")
greeted = False
try:
for event in handle.stream():
if event.type == EventType.WAITING:
if not greeted:
print("Chat with the bot below. Type 'bye' to leave.\n")
greeted = True
question = _pending_human_question(workflow_client, handle.execution_id)
print(f"Bot: {question}")
text = input("You: ").strip()
ending = _wants_to_end(text)
if ending:
# handle.stop() only flags the agent's loop to exit on
# its NEXT check — it doesn't complete this still-open
# ask_user task itself. Without also responding, that
# task (and the loop's current iteration) just sits
# IN_PROGRESS forever and the workflow never reaches
# COMPLETED. Setting the flag first means the loop
# exits as soon as this response lands, with no
# further LLM call.
handle.stop()
# The server always builds a single {"response": <string>}
# schema for a human-tool pause — not a form shaped like
# ask_user's own schema — so this is what handle.respond() expects.
handle.respond({"response": text})
if ending:
break
elif event.type == EventType.DONE:
output = event.output.get("result") if isinstance(event.output, dict) else event.output
if output:
print(f"Bot: {output}")
elif event.type == EventType.ERROR:
print(f"\n[error] {event.content}")
except KeyboardInterrupt:
# Same gap as above: stop() alone won't complete a still-open
# ask_user task, so best-effort complete it here too — otherwise
# Ctrl+C looks graceful but leaves the workflow stuck waiting.
handle.stop()
try:
handle.respond({"response": "bye"})
except Exception:
pass
print("\nConversation ended.")
How this actually runs, turn by turn

Each turn, step by step

Every turn works the same way. The workflow pauses the moment the bot calls ask_user, and the script catches that pause and prints the bot’s actual question as Bot: .... You type a reply, handle.respond() sends it back, and the model picks up right where it left off with your answer already in view. From there it either asks another question, or wraps up the conversation.

Where remember and recall fit in

remember and recall aren’t something your code calls directly. The agent decides on its own when to use them. Say your name early on, talk about something else for a while, then ask what it remembers. If it decided your name was worth keeping, recall hands it back. One thing worth knowing: if you restart the script, that memory is gone. It only lives for as long as the script keeps running.

How the bot knows you’re done

Instead of trusting the model to always notice you’re finished, the script checks your message itself first, against a short list of common closing phrases. If it matches, the conversation ends right there. No need for the model to agree.

Why ending it cleanly takes two steps

There’s a small catch to ending the chat. Just telling the workflow to stop isn’t enough on its own, because there’s still an open question waiting on your answer. The script has to actually answer that question first, and only then does the stop take effect. That’s why the code does both, one right after the other, instead of just one.

The small touches

A few more lines in the script just make it feel like a real chatbot instead of a raw demo. One quiets down the SDK’s own background logs, so they don’t clutter up the conversation. Another makes sure the “Chat with the bot” message only shows up once the bot is actually ready to talk, since starting the workflow takes a couple of seconds. And right after the bot starts, the script prints a link so you can watch the whole conversation happen live in the Conductor dashboard.

Build your own chatbot

It’s free to sign up for Orkes Conductor’s Developer Edition, and free to build, run, and maintain what you build on it.

  1. Generate an access key under Access Control > Applications.
  2. Add your model provider under Integrations, with an API key from that provider (Anthropic, in the example above). Then add the exact model name you’ll use, like claude-opus-5, to that integration’s list of enabled models — it has to match the model half of the "anthropic/claude-opus-5" string you pass to Agent exactly.
  3. Save the script above as chatbot.py, then run it:
Terminal window
pip install "conductor-python[agents]"
export CONDUCTOR_SERVER_URL=https://developer.orkescloud.com/api
export CONDUCTOR_AUTH_KEY=<your-key-id>
export CONDUCTOR_AUTH_SECRET=<your-key-secret>
python chatbot.py

CONDUCTOR_AUTH_KEY and CONDUCTOR_AUTH_SECRET are the access key from step 1. Nothing else to configure: the model’s API key already lives in the integration you set up in step 2, not in this script.

That’s a chatbot running on a production-grade platform. It talks to you entirely through a native human task, remembers the whole exchange for as long as the conversation runs, and keeps the facts worth keeping long after it ends. All of that’s built in from the first message.

And you can take it a lot further. Add more tools, like an API call, a database lookup, or a search index, and it starts doing things for you, not just chatting, still through the same agent and the same loop. This article stuck to chatting on purpose. That’s the part every chatbot needs, no matter what it eventually does. The tools are the part that’s specific to yours.

Got questions along the way? Find me on LinkedIn. I’m probably there playing the LinkedIn games, and happy to help.

Don't just read about it. Build it.

Everything above is free to run. Sign up, grab your keys, and have your own chatbot talking back to you in minutes.

Start Building for Free