draive

draive

Framework for building AI oriented applications. The project was made by Miquido: https://www.miquido.com/

Stars: 106

Visit
 screenshot

draive is an open-source Python library designed to simplify and accelerate the development of LLM-based applications. It offers abstract building blocks for connecting functionalities with large language models, flexible integration with various AI solutions, and a user-friendly framework for building scalable data processing pipelines. The library follows a function-oriented design, allowing users to represent complex programs as simple functions. It also provides tools for measuring and debugging functionalities, ensuring type safety and efficient asynchronous operations for modern Python apps.

README:

๐ŸŽ๏ธ draive ๐Ÿ

PyPI Python Version License Docs CodeRabbit Pull Request Reviews

๐ŸŽ๏ธ An all-in-one, flexible Python library for building powerful LLM workflows and AI apps. ๐ŸŽ๏ธ

Draive gives you everything you need to turn large language models into production-ready software: agents, structured workflows, tool use, instruction refinement, guardrails, observability, and seamless multi-model integration โ€” all in one clean, composable package.

If you've ever felt like youโ€™re stitching together glue code and hoping for the best โ€” Draive is what you wish you'd started with!

๐Ÿš€ Quick start

Hereโ€™s what a simple Draive setup looks like:

from draive import ctx, TextGeneration, tool
from draive.openai import OpenAI, OpenAIResponsesConfig

@tool # simply annotate a function as a tool
async def current_time(location: str) -> str:
    return f"Time in {location} is 9:53:22"

async with  ctx.scope( # create execution context
    "example", # give it a name
    OpenAIResponsesConfig(model="gpt-4o-mini"), # prepare configuration
    disposables=(OpenAI(),), # define resources and service clients available
):
    result: str = await TextGeneration.generate( # choose a right generation abstraction
        instructions="You are a helpful assistant", # provide clear instructions
        input="What is the time in Krakรณw?", # give it some input (including multimodal)
        tools=[current_time], # and select any tools you like
    )

    print(result) # to finally get the result!
    # output: The current time in Krakรณw is 9:53:22.

Read the Draive Documentation for all required knowledge.

For full examples, head over to the Draive Examples repository.

โ“ What is Draive good for?

Draive is built for developers who want clarity, flexibility, and control when working with LLMs.

Whether youโ€™re building an autonomous agent, automating data flow, extracting information from documents, handling audio or images โ€” Draive has your back.

What you can do with Draive:

  • ๐Ÿ” Start with evaluation - make sure your app behaves as expected, right from the start
  • ๐Ÿ›  Turn any Python function into a tool that LLMs can call
  • ๐Ÿ”„ Switch between providers like OpenAI, Claude, Gemini, or Mistral in seconds
  • ๐Ÿงฑ Design structured workflows with reusable stages
  • ๐Ÿ›ก Enforce output quality using guardrails including moderation and runtime evaluation
  • ๐Ÿ“Š Monitor with ease - plug into any OpenTelemetry-compatible services
  • โš™๏ธ Control your context - use on-the-fly LLM context modifications for best results

Why you'll like it:

  • Instruction Optimization: Draive gives you clean ways to write and refine prompts, including metaprompts, instruction helpers, and optimizers. You can go from raw prompt text to a reusable, structured config in no time.
  • Composable Workflows: Build modular flows using Stages and Tools. Every piece is reusable, testable, and fits together seamlessly.
  • Tooling = Just Python: Define a tool by writing a function. Annotate it. Thatโ€™s it. Draive handles the rest โ€” serialization, context, and integration with LLMs.
  • Structured Outputs - use Python classes for JSON outputs and flexible multimodal XML parser for custom results transformations.
  • Telemetry + Evaluators: Draive logs everything you care about: timing, output shape, tool usage, error cases. Evaluators let you benchmark or regression-test LLM behavior like a normal part of your CI.
  • Model-Agnostic by Design: Built-in support for most major providers.

๐Ÿ–ฅ๏ธ Install

With pip:

pip install draive

Optional dependencies

Draive library comes with optional integrations to 3rd party services:

  • OpenAI:

Use OpenAI services client, including GPT, dall-e and embedding. Allows to use Azure services as well.

pip install 'draive[openai]'
  • Anthropic:

Use Anthropic services client, including Claude.

pip install 'draive[anthropic]'
  • Gemini:

Use Google AIStudio services client, including Gemini.

pip install 'draive[gemini]'
  • Mistral:

Use Mistral services client. Allows to use Azure services as well.

pip install 'draive[mistral]'
  • Cohere:

Use Cohere services client.

pip install 'draive[cohere]'
  • Ollama:

Use Ollama services client.

pip install 'draive[ollama]'
  • VLLM:

Use VLLM services through OpenAI client.

pip install 'draive[vllm]'

๐Ÿ‘ท Contributing

Draive is open-source and always growing โ€” and weโ€™d love your help.

Got an idea for a new feature? Spotted a bug? Want to improve the docs or share an example? Awesome. Open a PR or start a discussion โ€” no contribution is too small!

Whether you're fixing typos, building new integrations, or just testing things out and giving feedback โ€” you're welcome here.

License

MIT License

Copyright (c) 2024-2025 Miquido

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for draive

Similar Open Source Tools

For similar tasks

For similar jobs