Skip to main content
Install Marvin and configure a provider before running these examples.

Extract structured data

extract returns a list of Contact objects. Use cast when you want one value, or run for instructions with an explicit result_type.

Give an agent a tool

The model chooses when to call a tool. Marvin validates its arguments and returns the tool’s result to the model.

Share history across calls

Save the thread ID to resume the same history later. See threads for persistence and tasks for explicit task objects and dependencies. In async code, use functions such as await marvin.extract_async(...) or await agent.run_async(...).