Skip to main content
LLM powered Assistants take multiple steps to process a user’s request, forming a chain of thought. Unlike a Message, a Step has a type, an input/output and a start/end. Depending on the config.ui.cot setting, the full chain of thought can be displayed in full, hidden or only the tool calls.

A Simple Tool Calling Example

Lets take a simple example of a Chain of Thought that takes a user’s message, process it and sends a response.

Output of the code above

Step API

There are two ways to create steps, either by using the the @cl.step decorator or by using the cl.Step class.

@cl.step

Easier to use but requires to split your step logic in a function.

with cl.Step():

More verbose but usable in any context as a Python Context Manager.