Have you ever tried booking a service through a messaging app and got stuck in that endless back-and-forth of questions?
Sofa size, material, address, type of cleaning, available time slots… you spend several minutes exchanging messages with a customer service rep just to finally confirm the booking. In the case that inspired this project, the entire process of requesting a quote for a sofa cleaning and then for an apartment cleaning took about 15 minutes of conversation. It is frustrating for the customer and expensive for the business, which needs to keep people available just to collect basic information and confirm schedules.
An AI Agent built with LangGraph and Python can solve exactly this problem, and it does it in seconds. We are not talking about a simple chatbot that follows a fixed script of questions, the kind that breaks when the user responds with something unexpected.
We are talking about a stateful agent capable of managing a multi-step business process by combining conversational intelligence with deterministic business rules. It understands what the customer needs, dynamically calculates prices, proposes optimized time slots, and confirms the booking, all within a natural conversation. The difference in user experience is massive, and the difference in operational cost is too. Even better: once in production, this agent works 24 hours a day, 7 days a week, with no breaks.
Throughout this article, you will see how this agent was built in practice, covering the tech stack with Python, LangGraph, and LangChain, how the scheduling process was modeled as a state graph, the observability setup with Langfuse to monitor everything in production, and the real potential of this solution as a foundation for a commercial product. Worth noting that the project source code is publicly available on GitHub, in a repository called customer-service-agent, so you can clone it and test it yourself. If you are interested in seeing how AI agents work beyond theory, this is a pretty concrete example of what you can build today. 🚀
What This Agent Actually Does
Before diving into the technical side, it is worth understanding the agent’s scope. It does everything a human customer service rep at a cleaning company would do on a daily basis. It answers customer questions and understands what the person needs, calculates the service price and communicates that value clearly, handles the customer accepting or declining the proposal, suggests optimized time slots for the booking, and finally confirms and registers the appointment.
The big advantage over a traditional form is flexibility. We could build a quoting tool that asks a fixed set of questions and, after the customer approves the price, books automatically. That would work, but it would force everyone to follow the exact same rigid path.
With an AI Agent, the experience feels much more natural. Imagine a customer typing something like: I need a cleaning for my two-bedroom apartment at this address, I also want the inside of the fridge cleaned, and I am available on Tuesday or Wednesday. That single message already contains all the necessary information. A good agent understands there is no need to ask more questions or force the customer to repeat details in a form, and goes straight to calculating and presenting the quote. On top of that, it has the potential to orchestrate extra operations, like notifying cleaning professionals about new bookings or finding someone available nearby for an urgent request.
The Stack Behind the Agent: Python, LangGraph, and LangChain
The tech stack choice was not random. Python remains the most mature language for working with artificial intelligence, especially when the goal is to integrate language models with real business logic. The library ecosystem, the ease of prototyping, and the number of professionals who are fluent in the language make it the most practical choice for projects like this. On top of that, virtually every major AI tool has native Python support, which eliminates unnecessary layers of adaptation.
LangGraph comes in as the central component of the architecture. It is an extension of LangChain designed specifically to build agents with more sophisticated flow control, using the concept of state graphs. In practice, this means each step of the conversation is a node within a graph, and the agent knows exactly where it is in the scheduling process, which information has already been collected, and what the next logical step is. The main reason for using LangGraph is that the scheduling flow needs shared state and needs to be resumed across multiple customer messages. That is why we need a stateful agent, not a simple linear flow.
LangChain, in turn, works as the glue between the pieces. It makes it easier to integrate with language models, manage memory, and create the tools the agent uses to perform concrete actions, like checking time slot availability, calculating the service price based on collected information, or registering the booking. Together, these three elements form a technical foundation solid enough to go straight from prototype to a production environment without major refactoring.
How the Scheduling Process Becomes a State Graph
Modeling the scheduling process as a state graph is what sets this approach apart from any traditional chatbot. Instead of a linear sequence of pre-programmed questions, LangGraph lets you define nodes that represent process steps, like collecting service information, calculating the price, proposing time slots, and confirming the booking, and edges that define transitions between those nodes based on the current state of the conversation.
The starting point is always the interaction between the customer and the agent. Through conversation, the agent tries to gather all the information needed for the service. The result of this initial chat is the booking details, which the agent converts into a structured output so they can be used later by the pricing and reservation mechanisms. These details are represented by a Python class, typed with Pydantic, containing fields like the type of service, the size of the space or the number of seats in the case of a sofa, the depth of cleaning, additional services, and the address. All fields are optional because this same structure also represents a partial extraction of information throughout the conversation.
An important detail is that the agent only asks a new question when some piece of data is still missing. This way, the agent itself decides what happens next, and this is precisely what separates an AI Agent from a regular workflow. In practice, if the customer already mentioned their address at the beginning of the conversation, the agent will not ask again. If the customer changed their mind about the time slot, the agent can step back in the flow without losing the other information already collected.
The agent state is defined as a typed structure that carries the conversation messages, the booking details, the calculated price, the time slot options, the selected time slot, the current status, and the reservation identifier. LangGraph manages this state during graph execution. Each node reads the current state and returns partial updates, while conditional routing functions inspect that state to decide which node runs next.
The pricing logic also lives inside this graph, in a specific node that reads the booking details and returns the price through a deterministic Python function. This is important because it guarantees consistency in quotes and avoids model hallucinations in steps where accuracy is critical. After the information-collection node runs, a conditional routing function checks whether there is enough data to calculate the price. If the details are complete, execution moves to the pricing node. Otherwise, the graph ends the current turn and waits for another message from the customer. Finally, the graph is compiled with a checkpointer, which ensures state persistence between interactions.
Production Observability with Langfuse
Putting an AI Agent into production without observability is like driving blindfolded. You might reach your destination the first few times, but the moment something goes wrong, you will not know where, why, or how to fix it. And it is a given that any system in production will have issues at some point, whether it is a factory production line, a traditional machine learning model detecting anomalies, or an AI agent in operation. Without visibility into what is happening inside the system, you end up relying on pure luck to resolve anything.
That is why the Langfuse setup was treated as an essential part of the architecture from the start, not as an optional feature to add later. Langfuse is an open-source AI engineering platform designed for tracing, monitoring, evaluating, and debugging applications with language models. The free plan is already enough to test a project like this: just generate the secret and public keys in the Langfuse dashboard and paste them into the environment variables file, along with the service base URL.
With Langfuse integrated into LangGraph via LangChain callbacks, you can visualize the complete trajectory of a conversation within the state graph. The dashboard shows prompts, inputs and outputs, plus token usage and the cost of each interaction, making it very easy to spot any unexpected situation in the budget. At first, the dashboard might seem complicated, but once you start using it, everything becomes much more intuitive.
Another direct benefit of observability with Langfuse is cost control. Since every model call is logged with the number of tokens used, it is easy to identify graph nodes that are consuming more than they should, whether due to poorly optimized prompts or unnecessary model calls in situations where a deterministic Python function would handle it much more efficiently. Worth highlighting that the cost of running this agent is practically negligible: a single complete execution of the flow costs pennies, which makes the solution extremely viable even at scale.
The Real Potential of This Solution
What was built here goes well beyond an interesting technical example. The project includes a simple command-line interface to test the scheduling flow end to end, but its modular design opens up enormous room for improvements. Every component has access to the agent’s central state, which makes extending the system much easier.
Among the expansion possibilities envisioned by the project creator are adding frontend interfaces like web applications, mobile apps, or messaging platforms like WhatsApp, integrating with a production database like PostgreSQL, and direct connections with real employee calendars and location-based services. The combination of LangGraph, Python, and an observability system like Langfuse delivers an architectural foundation that can be adapted for any type of service involving scheduling with variable information collection, such as clinics, hair salons, maintenance companies, home services, and consulting firms.
From a product perspective, what stands out most is the experience this approach delivers to the end user. A natural conversation, no forms, no numbered option menus, no frustrating bot that falls apart when you deviate even slightly from the expected script. The customer describes what they need in their own words, and the agent collects everything it needs fluidly, confirms the booking, and wraps up the conversation in seconds. This level of experience, which previously required a human rep available in real time, can now run in a fully automated and scalable way.
And this is just the beginning. The author himself considers this delivery an initial version, a sort of v0, with plans to add more features on top of it. With the continuous evolution of language models and tools like LangGraph, agents are set to become increasingly capable of handling complex situations, exceptions, and individual customer preferences. What is today a solution for the scheduling process could tomorrow be expanded to include automatic rescheduling, personalized reminders, customer preference history, and direct integration with payment systems, all within the same state graph architecture that is already working. The foundation is built, and it is rock solid. 💪
