Examples
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 Basics — it's the shortest
path to a working agent, a tool, and a structured final answer.
#Index
| Page | What you'll learn |
|---|---|
| Basics | A first agent. Function and Pydantic tools. Tool chaining. Private data injection. Structured final output. |
| Agents & Tools | The three ways to register tools (@agent.toolify, agent.add_tool(...), Agent(..., tools=[...])). Tool execution hooks. Cross-agent dependencies. |
| Swarms | Multi-agent collaboration with Swarm. Designated final-output agents. Member-style registration. Per-agent final_tool ownership. |
| MCP Integration | Registering MCP servers over stdio and HTTP. Auto-setup for third-party servers. |
| Memory | Memory configuration, retrieval policies, skill/insight extraction, attaching resources. |
| Private Data | @depends_on_private_data, referencing private values by key, RedactedMessage. |
| Batch & Scheduling | agent.batch(...) / agent.cron(...) / swarm.every(...). Retry, jitter, overlap policies. |
| Interrupts | Human-in-the-loop input collection with @depends_on_interrupt. |
| Real-World Projects | Larger end-to-end examples — automobile spec, data harmonization, HTML email builder, financial planner with MCP. |
#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 osfrom maivn import Agentfrom 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 platform (auth, billing,
projects, webhooks, IAM, analytics) — see the
Developer Portal guides. For
Studio-specific authoring and debugging, see
mAIvn Studio guide.