Skip to main content
Each example in this section is a complete, runnable Python program. The pages walk through the code section by section so you can see how the pieces fit together. Copy any example as a starting point for your own project.

Examples in this section

All example categories

The repository contains many more runnable examples than the four documented above. Every category has its own README.md and one or more .py files ready to run.

Core concepts

Data and documents

Agents and tools

Extensibility

Safety and validation

Integration and deployment

Performance and advanced sampling

Multimodal

Observability

Experimental

Getting started and tutorials


Running the examples

All examples are in the docs/examples/ directory of the repository. Unless otherwise noted, run them with:
Some examples declare inline script dependencies using the PEP 723 /// script block and can be run with uv run instead:
Default backend: start_session() with no arguments connects to a local Ollama instance running IBM Granite 4 Micro (granite4.1:3b). Make sure Ollama is running before you execute any example.