Skip to content

Commit 329fc90

Browse files
Dmitry Tumanovgitbook-bot
authored andcommitted
GITBOOK-505: Marvin
1 parent d8c0eb6 commit 329fc90

3 files changed

Lines changed: 141 additions & 1 deletion

File tree

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@
454454
* [Langflow](integrations/langflow.md)
455455
* [LiteLLM](integrations/litellm.md)
456456
* [Make](integrations/make.md)
457+
* [Marvin](integrations/marvin.md)
457458
* [n8n](integrations/n8n.md)
458459
* [Roo Code](integrations/roo-code.md)
459460
* [793](integrations/793.md)

docs/integrations/marvin.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Marvin
2+
3+
## About
4+
5+
[Marvin](https://github.com/PrefectHQ/marvin) is a Python framework by PrefectHQ for building agentic AI workflows and producing structured outputs. It allows developers to define _Tasks_ (objective-focused units of work) and assign them to specialized _Agents_ (LLM-powered configurations). Marvin supports type-safe results via Pydantic models, integrates with multiple LLM providers through Pydantic AI, and enables orchestration of multi-agent threads for complex workflows.
6+
7+
## Installation
8+
9+
***
10+
11+
### 1) Install Marvin
12+
13+
```bash
14+
uv add marvin
15+
# or
16+
pip install marvin
17+
```
18+
19+
***
20+
21+
### 2) Set your environment variable
22+
23+
macOS / Linux:
24+
25+
```bash
26+
export AIML_API_KEY=your-api-key
27+
```
28+
29+
Windows PowerShell:
30+
31+
```powershell
32+
setx AIML_API_KEY "your-api-key"
33+
```
34+
35+
***
36+
37+
### 3) Example — Run an AI/ML API Agent
38+
39+
**File:** `examples/provider_specific/aimlapi/run_agent.py`
40+
41+
{% tabs %}
42+
{% tab title="Python" %}
43+
{% code overflow="wrap" %}
44+
```python
45+
from __future__ import annotations
46+
47+
import os
48+
from pathlib import Path
49+
50+
from pydantic_ai.models.openai import OpenAIModel
51+
from pydantic_ai.providers.openai import OpenAIProvider
52+
53+
import marvin
54+
55+
AIML_API_URL = "https://api.aimlapi.com/v1"
56+
57+
58+
def get_provider() -> OpenAIProvider:
59+
api_key = os.getenv("AIML_API_KEY")
60+
if not api_key:
61+
raise RuntimeError("Set AIML_API_KEY environment variable to your AI/ML API key.")
62+
return OpenAIProvider(api_key=api_key, base_url=AIML_API_URL)
63+
64+
65+
def write_file(path: str, content: str) -> None:
66+
"""Write content to a file."""
67+
Path(path).write_text(content)
68+
69+
70+
def main() -> None:
71+
writer = marvin.Agent(
72+
model=OpenAIModel("gpt-4o", provider=get_provider()),
73+
name="AI/ML Writer",
74+
instructions="Write concise, engaging content for developers",
75+
tools=[write_file],
76+
)
77+
78+
result = marvin.run(
79+
"how to use pydantic? write haiku to docs.md",
80+
agents=[writer],
81+
)
82+
print(result)
83+
84+
85+
if __name__ == "__main__":
86+
main()
87+
```
88+
{% endcode %}
89+
{% endtab %}
90+
{% endtabs %}
91+
92+
Run it:
93+
94+
```bash
95+
AIML_API_KEY=your-api-key \
96+
uv run examples/provider_specific/aimlapi/run_agent.py
97+
```
98+
99+
***
100+
101+
### 4) Other Examples
102+
103+
More examples are available in the same directory:
104+
105+
> [github.com/PrefectHQ/marvin/tree/main/examples/provider\_specific/aimlapi](https://github.com/PrefectHQ/marvin/tree/main/examples/provider_specific/aimlapi)
106+
107+
* `structured_output.py` — structured JSON output
108+
* `tools_agent.py` — agent with custom tools (dates, weather)
109+
110+
***
111+
112+
## Tips
113+
114+
* **Profiles:** use multiple configurations (default = [`openai/gpt-5-chat-latest`](../api-references/text-models-llm/openai/gpt-5-chat.md), budget = [`openai/o4-mini`](../api-references/text-models-llm/openai/o4-mini.md))
115+
* **Structured results:** pass `result_type=...` for typed outputs
116+
* **Tools:** register Python functions via `Agent(tools=[...])`
117+
* **Token limits:** increase output size if needed
118+
119+
***
120+
121+
## Troubleshooting
122+
123+
| Issue | Solution |
124+
| ----------------------- | ----------------------------------------------- |
125+
| **401** Unauthorized | Check your API key and remove extra spaces |
126+
| **404** Model not found | Verify the model ID exists in your account |
127+
| Network error | Whitelist `api.aimlapi.com` if behind VPN/proxy |
128+
129+
***
130+
131+
## Helpful Links
132+
133+
* Dashboard: [https://aimlapi.com/app](https://aimlapi.com/app)
134+
* API Keys: [https://aimlapi.com/app/keys](https://aimlapi.com/app/keys)
135+
* Models: [https://aimlapi.com/models](https://aimlapi.com/models)
136+
* Docs: [https://docs.aimlapi.com](https://docs.aimlapi.com)
137+
* Marvin repository: [https://github.com/PrefectHQ/marvin](https://github.com/PrefectHQ/marvin)
138+
139+
Enjoy coding with **Marvin + AI/ML API** 🚀

docs/integrations/our-integration-list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ description: About third-party integrations
66

77
Our API endpoint can be integrated with popular AI workflow platforms and tools, allowing their users to access our models through these environments.
88

9-
<table><thead><tr><th width="124">Service</th><th>Description</th></tr></thead><tbody><tr><td><a href="agno.md">Agno</a></td><td>A lightweight library for building agents — AI programs that operate autonomously, use tools, and have memory, knowledge, storage, and reasoning capabilities.</td></tr><tr><td><a href="aider.md">Aider</a></td><td>A command-line pair programming tool that connects to OpenAI-compatible APIs. It lets you chat with models to edit your codebase, auto-commit changes, and build software collaboratively from the terminal.</td></tr><tr><td><a href="autogpt.md">AutoGPT</a></td><td>An open-source platform designed to help you build, test, and run AI agents using a no-code visual interface. It allows users to link LLMs with tools, memory, planning modules, and action chains.</td></tr><tr><td><a href="cline.md">Cline</a></td><td>An open-source AI coding assistant with two working modes (Plan/Act), terminal command execution, and support for the Model Context Protocol (MCP) in VS Code.</td></tr><tr><td><a href="continue.dev.md">continue.dev</a></td><td>An open-source IDE extension and hub for rules, tools, and models that let you create, share, and use custom AI code assistants.</td></tr><tr><td><a href="cursor.md">Cursor</a></td><td>An advanced AI-powered IDE that combines intelligent code completion, inline explanations, and automatic code editing directly inside the editor.</td></tr><tr><td><a href="elizaos.md">ElizaOS</a></td><td>A powerful multi-agent simulation framework designed to create, deploy, and manage autonomous AI agents. Built with TypeScript, it provides a flexible and extensible platform for developing intelligent agents that can interact across multiple platforms while maintaining consistent personalities and knowledge.</td></tr><tr><td><a href="gpt-researcher-gptr.md">GPT Researcher</a></td><td>An autonomous agent that takes care of the tedious task of research for you, by scraping, filtering and aggregating over 20+ web sources per a single research task.</td></tr><tr><td><a href="kilo-code.md">Kilo Code</a></td><td>An open-source AI coding assistant and VS Code extension that enables natural-language code generation, debugging, and refactoring through customizable modes (Architect, Code, Debug, etc.). It supports multiple model providers, integrates with the Model Context Protocol (MCP), and allows developers to extend functionality with custom tools and workflows.</td></tr><tr><td><a href="langflow.md">Langflow</a></td><td>A new visual framework for building multi-agent and RAG applications. It is open-source, Python-powered, fully customizable, and LLM and vector store agnostic. Its intuitive interface allows for easy manipulation of AI building blocks, enabling developers to quickly prototype and turn their ideas into powerful, real-world solutions.</td></tr><tr><td><a href="litellm.md">LiteLLM</a></td><td>An open-source Python library that provides a unified API for interacting with multiple large language model providers. It allows developers to switch between different models with minimal code changes, optimizing cost and performance. LiteLLM simplifies integration by offering a single interface for various LLM endpoints, enabling seamless experimentation and deployment across different AI providers.</td></tr><tr><td><a href="make.md">Make</a></td><td>A powerful, enterprise-scale automation platform. It offers flow control, data manipulation, HTTP/webhooks, AI agents and tools, notes, an MCP server, and many other features at your service.</td></tr><tr><td><a href="n8n.md">n8n</a></td><td>An open-source workflow automation tool that lets you connect various services and automate tasks without writing full integrations manually.</td></tr><tr><td><a href="roo-code.md">Roo Code</a></td><td>An autonomous AI programming agent that works right inside your editor, such as VS Code. It helps you code faster and smarter — whether you're starting a new project, maintaining existing code, or exploring new technologies.</td></tr><tr><td><a href="sillytavern.md">SillyTavern</a></td><td>A locally installed user interface that allows you to interact with text generation LLMs, image generation engines, and TTS voice models. Integration with the AI/ML API currently applies only to LLMs.</td></tr><tr><td><a href="toolhouse.md">Toolhouse</a></td><td>A Backend-as-a-Service (BaaS) to build, run, and manage AI agents. Toolhouse simplifies the process of building agents in a local environment and running them in production.</td></tr></tbody></table>
9+
<table><thead><tr><th width="124">Service</th><th>Description</th></tr></thead><tbody><tr><td><a href="agno.md">Agno</a></td><td>A lightweight library for building agents — AI programs that operate autonomously, use tools, and have memory, knowledge, storage, and reasoning capabilities.</td></tr><tr><td><a href="aider.md">Aider</a></td><td>A command-line pair programming tool that connects to OpenAI-compatible APIs. It lets you chat with models to edit your codebase, auto-commit changes, and build software collaboratively from the terminal.</td></tr><tr><td><a href="autogpt.md">AutoGPT</a></td><td>An open-source platform designed to help you build, test, and run AI agents using a no-code visual interface. It allows users to link LLMs with tools, memory, planning modules, and action chains.</td></tr><tr><td><a href="cline.md">Cline</a></td><td>An open-source AI coding assistant with two working modes (Plan/Act), terminal command execution, and support for the Model Context Protocol (MCP) in VS Code.</td></tr><tr><td><a href="continue.dev.md">continue.dev</a></td><td>An open-source IDE extension and hub for rules, tools, and models that let you create, share, and use custom AI code assistants.</td></tr><tr><td><a href="cursor.md">Cursor</a></td><td>An advanced AI-powered IDE that combines intelligent code completion, inline explanations, and automatic code editing directly inside the editor.</td></tr><tr><td><a href="elizaos.md">ElizaOS</a></td><td>A powerful multi-agent simulation framework designed to create, deploy, and manage autonomous AI agents. Built with TypeScript, it provides a flexible and extensible platform for developing intelligent agents that can interact across multiple platforms while maintaining consistent personalities and knowledge.</td></tr><tr><td><a href="gpt-researcher-gptr.md">GPT Researcher</a></td><td>An autonomous agent that takes care of the tedious task of research for you, by scraping, filtering and aggregating over 20+ web sources per a single research task.</td></tr><tr><td><a href="kilo-code.md">Kilo Code</a></td><td>An open-source AI coding assistant and VS Code extension that enables natural-language code generation, debugging, and refactoring through customizable modes (Architect, Code, Debug, etc.). It supports multiple model providers, integrates with the Model Context Protocol (MCP), and allows developers to extend functionality with custom tools and workflows.</td></tr><tr><td><a href="langflow.md">Langflow</a></td><td>A new visual framework for building multi-agent and RAG applications. It is open-source, Python-powered, fully customizable, and LLM and vector store agnostic. Its intuitive interface allows for easy manipulation of AI building blocks, enabling developers to quickly prototype and turn their ideas into powerful, real-world solutions.</td></tr><tr><td><a href="litellm.md">LiteLLM</a></td><td>An open-source Python library that provides a unified API for interacting with multiple large language model providers. It allows developers to switch between different models with minimal code changes, optimizing cost and performance. LiteLLM simplifies integration by offering a single interface for various LLM endpoints, enabling seamless experimentation and deployment across different AI providers.</td></tr><tr><td><a href="make.md">Make</a></td><td>A powerful, enterprise-scale automation platform. It offers flow control, data manipulation, HTTP/webhooks, AI agents and tools, notes, an MCP server, and many other features at your service.</td></tr><tr><td><a href="marvin.md">Marvin</a></td><td>A Python framework by PrefectHQ for building agentic AI workflows and producing structured outputs. It allows developers to define <em>Tasks</em> (objective-focused units of work) and assign them to specialized <em>Agents</em> (LLM-powered configurations). Marvin supports type-safe results via Pydantic models, integrates with multiple LLM providers through Pydantic AI, and enables orchestration of multi-agent threads for complex workflows.</td></tr><tr><td><a href="n8n.md">n8n</a></td><td>An open-source workflow automation tool that lets you connect various services and automate tasks without writing full integrations manually.</td></tr><tr><td><a href="roo-code.md">Roo Code</a></td><td>An autonomous AI programming agent that works right inside your editor, such as VS Code. It helps you code faster and smarter — whether you're starting a new project, maintaining existing code, or exploring new technologies.</td></tr><tr><td><a href="sillytavern.md">SillyTavern</a></td><td>A locally installed user interface that allows you to interact with text generation LLMs, image generation engines, and TTS voice models. Integration with the AI/ML API currently applies only to LLMs.</td></tr><tr><td><a href="toolhouse.md">Toolhouse</a></td><td>A Backend-as-a-Service (BaaS) to build, run, and manage AI agents. Toolhouse simplifies the process of building agents in a local environment and running them in production.</td></tr></tbody></table>

0 commit comments

Comments
 (0)