Examples Overview
Index of runnable example pages, organized by what you'd want to build.
#Examples
A working tour of the SDK, organized by what you'd actually want to build. Each page contains runnable snippets, comments on what's load-bearing, and links back to the relevant guide for deeper coverage.
If you're brand new, start with the Quickstart: typed tool → answer model → tools=[...] → invoke(..., structured_output=Model) → response.result. Continue with Basics for more registration and dependency patterns.
#Run the existing catalog
The maivn-examples project contains 50 runnable entries with per-example instructions: 12 scenarios and 38 focused feature tutorials. Open its checkout or downloaded archive and work from the folder containing pyproject.toml, .env.example, and examples/. In the platform checkout, use cd apps/maivn-examples from the platform root. A standalone checkout or archive uses its own maivn-examples folder. Python 3.12 or newer is required.
The catalog targets the SDK 3.x API. Use a package source containing compatible SDK 3.x and Tools releases. Verify package publication separately. Source checkouts should follow the examples project's release-compatibility and local-source instructions before installing.
macOS and Linux
python3 -m venv .venv
source .venv/bin/activate
python -m pip install .
python -m examples.assistants.quickstart.demo --helpWindows (PowerShell)
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install .
python -m examples.assistants.quickstart.demo --helpWith uv on any system, use uv sync and prefix module commands with uv run. Installing the project includes all declared dependencies, including the examples' python-dotenv loader.
Catalog imports and help need no key. For execution, create a runtime API key in your developer portal and set MAIVN_API_KEY in your shell or copy .env.example to .env in the examples project folder. Shell values take precedence. Then run:
python -m examples.assistants.quickstart.demoExpect a status card for PK-1003, a customs hold, a delivery date five days from today, and validation: PASS - 5 checks. A missing key fails before dispatch, and an incorrect result fails the demo's checks. The project README explains optional endpoint configuration and Studio installation. For Studio with uv, launch from that folder with uv run --extra studio python -m maivn_studio.main.
#Repeat the quickstart check offline
From an examples source checkout with its development dependencies installed:
python -m pytest -q tests/test_first_use.py -k first_use_snippetThe parcel example must call its typed lookup tool and validate the returned card. The test also supplies a malformed answer and checks that validation rejects it. In a platform checkout it checks the weather and structured-order documentation snippets too. A standalone examples checkout skips those separate documentation files when they are absent.
The remote invocation boundary is replaced with synthetic responses: no runtime key or model-provider call is needed. The normal demo command above still calls the selected deployment and can incur usage charges. Reuse this check when changing the tool, answer fields or source fixture. Confirm hosted behavior in a separately authorized live run.
#Choose a starter and customize it
Each starter's README includes a “Make it yours” path. Update the tools and answer models together with the prompts and factual checks. Identify live requests, file writes, and other effects as you introduce them. These demos use synthetic inputs unless their instructions identify a live source.
#Index
#How to read the examples
The snippets are condensed — boilerplate (logging setup, .env loading, argparse) is omitted so you can see the SDK surface clearly. To run them locally, all you need is:
import os
from maivn import Agent
from maivn.messages import HumanMessage
agent = Agent(
name='My Agent',
system_prompt='...',
api_key=os.environ['MAIVN_API_KEY'],
)
agent.invoke([HumanMessage(content='hello')])Most examples also work inside mAIvn Studio — if you see APP_PROMPTS = [...] in the source repo, that's the Studio prompt picker metadata.
#What's missing here
These examples cover the SDK surface. For the Portal, see sign-in, teams and projects, API keys and webhooks and billing. For Studio-specific authoring and debugging, see the mAIvn Studio guide.