Griptape: A Python Framework for Building Generative AI Applications
Griptape is a Python framework designed to simplify the development of generative AI applications. It offers a set of straightforward, flexible abstractions for working with areas such as Large Language Models (LLMs), Retrieval-Augmented Generation (RAG), and much more.
- Technology-agnostic: Griptape is designed to work with any capable LLM, data store, and backend through the abstraction of Drivers.
- Minimal prompt engineering: It’s much easier to reason about code written in Python, not natural languages. Griptape aims to default to Python in most cases unless absolutely necessary.
Why Consider a Framework?
If you're just beginning to experiment with generative AI, it's often best to start by building simple applications from scratch. However, as your project grows in complexity, a framework like Griptape can provide structure and best practices that help you maintain clarity and scalability.
Griptape strives to be transparent about the underlying AI techniques it uses. Nevertheless, having some foundational knowledge of LLMs and related technology will be helpful when building more sophisticated applications.
Prerequisites
1. OpenAI API Key
By default, Griptape uses OpenAI for LLM interactions. We’ll learn how to change this via Prompt Drivers later. For now:
- Obtain an OpenAI API key.
- Set it as an environment variable:
Info
Drivers are a primary building block of Griptape and Prompt Drivers handle all the details when prompting the model with input.
Prompt Drivers are model agnostic, letting you switch out LLM providers without changing application code.
Tip
To securely and easily manage environment variables, check out tools like python-dotenv or mise.
2. Install Griptape
Griptape can be installed via multiple methods. Below are two popular approaches:
Using Uv
uv is a fast, user-friendly dependency manager. If you've used poetry, uv
is a similar project but with a focus on simplicity and speed.
-
Initialize a new project:
-
Change into the new directory:
-
Add Griptape as a dependency:
-
A virtual environment will be automatically created. Activate it:
Note
If you use another shell (like
fish
), this command may differ.Tip
If you’re using mise, you can configure it to automatically activate your virtual environment.
Using Pip
If uv
isn’t your style, you can always install Griptape using pip
:
Installing Optional Dependencies
Griptape provides optional dependencies that enable specific features and third-party integrations. If you're new to Griptape, consider installing [all]
to unlock its full functionality. This ensures you have everything you need right from the start.
However, for a more streamlined setup or if you only need certain features, you have two primary options:
-
Core Dependencies: These provide the minimal, foundational set of libraries for Griptape to run most default features.
-
Optional Dependencies: These are additional, vendor-specific drivers (e.g., for Anthropic or Pinecone). Any driver requiring an extra will indicate this in the documentation.
For a core-only installation:
To install specific optional dependencies such as Anthropic and Pinecone drivers—use:
To see all available optional dependencies, see Griptape's pyproject.toml.
Prompt Task
With everything set up, let’s start building! One of Griptape’s core abstractions is a Task. We'll start with a Prompt Task to prompt the LLM with some text.
Create a file named app.py
and add:
Then run:
Tip
Whenever you see a “Logs” tab in the Griptape documentation, you can click it to view logs and outputs.
If you got a response from the model, congrats! You’ve created your first generative AI application with Griptape. This introductory guide sticks to the Prompt Task, but Griptape supports a wide range of Tasks. Explore them to see what else you can do.
Changing Models
Info
This example briefly demonstrates swapping out the underlying model. If you’d prefer to continue using the default OpenAI integration, feel free to skip ahead.
Griptape’s “Prompt Drivers” make switching model providers simple. For instance, to use Anthropic, follow the same steps you used for the OpenAI key, but this time set an Anthropic API key:
Then import Anthropic Prompt Driver and pass it to your Task:
[03/13/25 21:09:25] INFO PromptTask e9f1dd403e8b48998d7c42ec9afb5280
Input: Hello there!
[03/13/25 21:09:26] INFO PromptTask e9f1dd403e8b48998d7c42ec9afb5280
Output: Hello! How can I assist you today? I'm here
to help with any questions or tasks you might have.
Feel free to let me know what you're looking for!
Run the script again to see a similar output. Notice you didn’t have to change any of the application-level logic; you only changed the driver.
For the remainder of this guide, we’ll revert to the OpenAI Chat Prompt Driver:
If you’d like to keep using Anthropic, be sure to adjust code accordingly.
Templating
Griptape uses the popular Jinja templating engine to help create dynamic prompts. Let’s adapt our Prompt Task to utilize a Jinja template:
Here, {{ args }}
is rendered at runtime, allowing you to dynamically insert data into the prompt.
Info
args
is a special attribute added to the Task’s context. Depending on the type of Task, it may also have access to additional context variables.
For static, key-value data, we can add context
to our Task:
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.tasks import PromptTask
task = PromptTask(
input="You are speaking to: {{ user_name }}. User said: {{ args[0] }}",
prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"),
context={"user_name": "Collin"},
)
task.run("Hi there!")
These two methods allow you to build more versatile, data-driven prompts. Next, we’ll discuss steering the LLM’s output using Griptape’s Rule system.
Rules
LLMs can be unpredictable. Getting them to follow specific instructions can be challenging. Griptape addresses this by providing Rules and Rulesets, which offer a structured approach to steering the model’s output.
For example, we can create a simple Rule that gives the LLM a name:
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.rules import Rule
from griptape.tasks import PromptTask
task = PromptTask(
input="You are speaking to: {{ user_name }}. User said: {{ args[0] }}",
prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"),
context={"user_name": "Collin"},
rules=[Rule("Your name is Oswald.")],
)
task.run("Hi there, what's your name?")
Info
Rules are placed in the LLM’s system prompt, which typically yields the highest likelihood that the model will adhere to them. even so, LLMs still sometimes have minds of their own and will not follow Rules 100% of time
Tip
While we typically recommend you stick to Rule-based steering, you can always override the system prompt with a custom one. Though pay close attention to the discussed tradeoffs that come with this approach.
Multiple rules can be grouped into Ruleset
s. Let’s refactor our code to use more than one Ruleset:
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.rules import Rule, Ruleset
from griptape.tasks import PromptTask
task = PromptTask(
input="You are speaking to: {{ user_name }}. User said: {{ args[0] }}",
prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"),
context={"user_name": "Collin"},
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
],
),
Ruleset(
name="Behavior",
rules=[
Rule("Introduce yourself at the start of the conversation."),
],
),
],
)
task.run("Hi there!")
Info
Providing a rules
list automatically creates a default Ruleset
. This is great for getting started, but we recommend explicitly defining Ruleset
s for more complex applications.
Griptape also includes a specialized Rule, JsonSchemaRule, which inserts a JSON Schema into the system prompt, ensuring the LLM attempts to return structured, machine-readable data:
import json
from typing import TYPE_CHECKING, cast
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.rules import JsonSchemaRule, Rule, Ruleset
from griptape.tasks import PromptTask
if TYPE_CHECKING:
from griptape.artifacts.text_artifact import TextArtifact
task = PromptTask(
input="You are speaking to: {{ user_name }}. User said: {{ args[0] }}",
prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"),
context={"user_name": "Collin"},
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
],
),
Ruleset(
name="Behavior",
rules=[
Rule("Introduce yourself at the start of the conversation."),
],
),
Ruleset(
name="Output Format",
rules=[
JsonSchemaRule(
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"answer": {"type": "string"},
},
"required": ["answer"],
}
)
],
),
],
)
task_output_value = cast("TextArtifact", task.run("Hi there!")).value
print(json.dumps(json.loads(task_output_value), indent=2))
[03/13/25 21:09:51] INFO PromptTask 1b399af1c0264f8eb33916a762d6852e
Input: You are speaking to: Collin. User said: Hi
there!
[03/13/25 21:09:52] INFO PromptTask 1b399af1c0264f8eb33916a762d6852e
Output: {"answer":"Hello Collin! My name is Oswald.
How can I assist you today?"}
{
"answer": "Hello Collin! My name is Oswald. How can I assist you today?"
}
Note
The typing.cast
usage is optional, but helps satisfy our type-checker, pyright. We’re actively working to improve Griptape’s type hints to avoid clunky casts like this.
Now let’s explore an even more robust way to enforce structured outputs.
Structured Output
While a JsonSchemaRule
can encourage the LLM to return structured data, it doesn’t provide guarantees, especially for complex schemas. For stronger enforcement, Griptape’s Prompt Drivers support Structured Output.
Structured Output uses the LLM provider’s built-in API features to produce outputs in a well-defined schema. It also simplifies parsing, so you can work directly with Python objects rather than manual JSON parsing.
Let’s update our Task to use Structured Output:
from typing import cast
from pydantic import BaseModel
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.rules import Rule, Ruleset
from griptape.tasks import PromptTask
class Output(BaseModel):
answer: str
task = PromptTask(
input="You are speaking to: {{ user_name }}. User said: {{ args[0] }}",
prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"),
context={"user_name": "Collin"},
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
],
),
Ruleset(
name="Behavior",
rules=[
Rule("Introduce yourself at the start of the conversation."),
],
),
],
output_schema=Output,
)
task_output_value = cast("Output", task.run("Hi there!").value)
print(task_output_value.answer)
[03/13/25 21:09:23] INFO PromptTask 7e3d9f1330a044b88b785a35dbde8521
Input: You are speaking to: Collin. User said: Hi
there!
INFO PromptTask 7e3d9f1330a044b88b785a35dbde8521
Output: {"answer":"Hello Collin! My name is Oswald.
How can I assist you today?"}
Hello Collin! My name is Oswald. How can I assist you today?
The LLM response is not only formatted correctly, but automatically parsed into a Python object.
Tip
You can use either pydantic or schema to define your schemas. We recommend pydantic for its ease of use.
Info
If your chosen model provider doesn’t natively support structured output, Griptape employs multiple fallback strategies. The final fallback is the JsonSchemaRule
, which you saw earlier.
Now that we can generate structured responses, let’s make our Task more conversational using Griptape’s memory features.
Conversation Memory
By default, each LLM call is stateless. If you want the model to recall previous interactions, use Conversation Memory. It tracks Task run history, providing context for the current run.
from pydantic import BaseModel
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.memory.structure import ConversationMemory
from griptape.rules import Rule, Ruleset
from griptape.tasks import PromptTask
class Output(BaseModel):
answer: str
task = PromptTask(
input="You are speaking to: {{ user_name }}. User said: {{ args[0] }}",
prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"),
context={"user_name": "Collin"},
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
],
),
Ruleset(
name="Behavior",
rules=[
Rule("Introduce yourself at the start of the conversation."),
],
),
],
output_schema=Output,
conversation_memory=ConversationMemory(),
)
task.run("Hi there, my name is Collin!")
task.run("Do you remember my name?")
[03/13/25 21:09:05] INFO PromptTask 58d0e340cc884f57949a93ec3167c6a6
Input: You are speaking to: Collin. User said: Hi
there, my name is Collin!
[03/13/25 21:09:06] INFO PromptTask 58d0e340cc884f57949a93ec3167c6a6
Output: {"answer":"{\"answer\":\"Hello Collin! My
name is Oswald. It's a pleasure to meet you. How
can I assist you today?\"}"}
INFO PromptTask 58d0e340cc884f57949a93ec3167c6a6
Input: You are speaking to: Collin. User said: Do
you remember my name?
[03/13/25 21:09:07] INFO PromptTask 58d0e340cc884f57949a93ec3167c6a6
Output: {"answer":"{\"answer\":\"Of course, Collin!
My name is Oswald. How can I help you today?\"}"}
Tip
You can customize where the conversation is stored by providing a Conversation Memory Driver.
With that set up, the LLM will now remember our previous exchanges. Let’s move on to enabling the model to perform external actions through Tools.
Tools
LLMs themselves cannot browse the internet or perform external actions. You can enable these abilities via Tools. A “Tool” is simply a Python class, and any method marked with the @activity
decorator becomes available to the LLM.
Griptape comes with a collection of built-in Tools. Below is an example that uses a web search and scrape Tool:
from pydantic import BaseModel
from rich.pretty import pprint
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.drivers.web_search.duck_duck_go import DuckDuckGoWebSearchDriver
from griptape.memory.structure import ConversationMemory
from griptape.rules import Rule, Ruleset
from griptape.tasks import PromptTask
from griptape.tools import WebScraperTool, WebSearchTool
class Feature(BaseModel):
name: str
description: str
emoji: str
class Output(BaseModel):
answer: str
key_features: list[Feature]
task = PromptTask(
id="project-research",
input="You are speaking to: {{ user_name }}. User said: {{ args[0] }}",
prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"),
context={"user_name": "Collin"},
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
Rule("You run 'Oswald's Open Source', a company for helping people learn about open source."),
],
),
Ruleset(
name="Behavior",
rules=[
Rule("Introduce yourself at the start of the conversation."),
],
),
],
output_schema=Output,
tools=[
WebSearchTool(
web_search_driver=DuckDuckGoWebSearchDriver(),
),
WebScraperTool(),
],
conversation_memory=ConversationMemory(),
)
output = task.run("Tell me about the python framework Griptape.")
pprint(output.value)
[03/13/25 21:07:33] INFO PromptTask project-research
Input: You are speaking to: Collin. User said: Tell
me about the python framework Griptape.
[03/13/25 21:07:35] INFO Subtask b3776286c4b14b30a8955e0e8d56b426
Actions: [
{
"tag": "call_g0DHP8HffzIVh5hpxrNZFJln",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "Griptape Python framework"
}
}
}
]
INFO Subtask b3776286c4b14b30a8955e0e8d56b426
Response: {"title": "GitHub - griptape-ai/griptape:
Modular Python framework for AI agents ...", "url":
"https://github.com/griptape-ai/griptape",
"description": "Griptape is a modular Python
framework for building AI-powered applications that
securely connect to your enterprise data and APIs.
It offers developers the ability to maintain
control and flexibility at every step.
\ud83d\udee0\ufe0f Core Components.
\ud83c\udfd7\ufe0f Structures. \ud83e\udd16 Agents
consist of a single Task."}
{"title": "Griptape | AI Agent Framework | AI
Development Platform", "url":
"https://www.griptape.ai/", "description":
"Griptape gives developers everything they need,
from the open source AI framework (Griptape AI
Framework) to the execution runtime (Griptape AI
Cloud). Build & Secure Build your business logic
using predictable, programmable python - don't
gamble on prompting."}
{"title": "Overview - Griptape Docs", "url":
"https://docs.griptape.ai/stable/griptape-framework
/", "description": "The Griptape Framework allows
developers to build business logic using Python,
ensuring better security, performance, and
cost-efficiency. It simplifies the creation of Gen
AI Agents, Systems of Agents, Pipelines, Workflows,
and RAG implementations without needing extensive
knowledge of Gen AI or Prompt Engineering."}
{"title": "Getting started with the Griptape
Framework", "url":
"https://www.griptape.ai/blog/getting-started-with-
the-griptape-framework", "description": "Griptape
is a Python framework and we'll assume that you
already have python set up on your machine. If not,
we recommend you take a look at the longer version
of this getting started guide in the Griptape Trade
School , which includes instructions for getting
Python set up."}
{"title": "Framework - Griptape", "url":
"https://www.griptape.ai/category/framework",
"description": "Blog posts about the Griptape
Framework, a powerful Python library allowing
developers to build AI systems that operate across
two dimensions: predictability and creativity.
Products. ... The release of Griptape Framework
v0.24 comes with a number of new, long-requested
features. Customers can now use Claude-3 and Google
Gemini models in their ..."}
[03/13/25 21:07:39] INFO Subtask 97e6fad69e954372af63169375fe3684
Actions: [
{
"tag": "call_PXnS8KWhsbtQeCLR02oSZYj8",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url":
"https://github.com/griptape-ai/griptape"
}
}
}
]
[03/13/25 21:07:40] INFO Subtask 97e6fad69e954372af63169375fe3684
Response: Griptape is a Python framework designed
to simplify the development of generative AI
(genAI) applications. It offers a set of
straightforward, flexible abstractions for working
with areas such as Large Language Models (LLMs),
Retrieval-Augmented Generation (RAG), and much
more.
- 🤖 Agents consist of a single Task, configured
for Agent-specific behavior.
- 🔄 Pipelines organize a sequence of Tasks so that
the output from one Task may flow into the next.
- 🌐 Workflows configure Tasks to operate in
parallel.
Tasks are the core building blocks within
Structures, enabling interaction with Engines,
Tools, and other Griptape components.
- 💬 Conversation Memory enables LLMs to retain and
retrieve information across interactions.
- 🗃️ Task Memory keeps large or sensitive Task
outputs off the prompt that is sent to the LLM.
- 📊 Meta Memory enables passing in additional
metadata to the LLM, enhancing the context and
relevance of the interaction.
Drivers facilitate interactions with external
resources and services in Griptape. They allow you
to swap out functionality and providers with
minimal changes to your business logic.
- 🗣️ Prompt Drivers: Manage textual and image
interactions with LLMs.
- 🤖 Assistant Drivers: Enable interactions with
various “assistant” services.
- 📜 Ruleset Drivers: Load and apply rulesets from
external sources.
- 🧠 Conversation Memory Drivers: Store and
retrieve conversational data.
- 📡 Event Listener Drivers: Forward framework
events to external services.
- 🏗️ Structure Run Drivers: Execute structures
locally or in the cloud.
- 🔢 Embedding Drivers: Generate vector embeddings
from textual inputs.
- 🔀 Rerank Drivers: Rerank search results for
improved relevance.
- 💾 Vector Store Drivers: Manage the storage and
retrieval of embeddings.
- 🗂️ File Manager Drivers: Handle file operations on
local and remote storage.
- 💼 SQL Drivers: Interact with SQL databases.
- 🎨 Image Generation Drivers: Create images from
text descriptions.
- 🗣️ Text to Speech Drivers: Convert text to speech.
- 🎙️ Audio Transcription Drivers: Convert audio to
text.
- 🔍 Web Search Drivers: Search the web for
information.
- 🌐 Web Scraper Drivers: Extract data from web
pages.
- 📈 Observability Drivers: Send trace and event
data to observability platforms.
Tools provide capabilities for LLMs to interact
with data and services.
Griptape includes a variety of [built-in
Tools](https://docs.griptape.ai/stable/griptape-fra
mework/tools/official-tools/), and makes it easy to
create [custom
Tools](https://docs.griptape.ai/stable/griptape-fra
mework/tools/custom-tools/).
Engines wrap Drivers and provide use-case-specific
functionality:
- 📊 RAG Engine is an abstraction for implementing
modular Retrieval Augmented Generation (RAG)
pipelines.
- 🛠️ Extraction Engine extracts JSON or CSV data
from unstructured text.
- 📝 Summary Engine generates summaries from
textual content.
- ✅ Eval Engine evaluates and scores the quality
of generated text.
- 📐 Rulesets steer LLM behavior with minimal
prompt engineering.
- 🔄 Loaders load data from various sources.
- 🏺 Artifacts allow for passing data of different
types between Griptape components.
- ✂️ Chunkers segment texts into manageable pieces
for diverse text types.
- 🔢 Tokenizers count the number of tokens in a
text to not exceed LLM token limits.
Please visit the [docs](https://docs.griptape.ai/)
for information on installation and usage.
Check out [Griptape Trade
School](https://learn.griptape.ai/) for free online
courses.
Here's a minimal example of griptape:
from griptape.drivers.prompt.openai import
OpenAiChatPromptDriver
from griptape.rules import Rule
from griptape.tasks import PromptTask
task = PromptTask(
prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"
),
rules=[Rule("Keep your answer to a few
sentences.")],
)
result = task.run("How do I do a kickflip?")
print(result.value)
To do a kickflip, start by positioning your front
foot slightly angled near the middle of the board
and your back foot on the tail.
Pop the tail down with your back foot while
flicking the edge of the board with your front foot
to make it spin.
Jump and keep your body centered over the board,
then catch it with your feet and land smoothly.
Practice and patience are key!
Here is a concise example using griptape to
research open source projects:
from
griptape.drivers.prompt.openai_chat_prompt_driver
import OpenAiChatPromptDriver
from griptape.drivers.web_search.duck_duck_go
import DuckDuckGoWebSearchDriver
from griptape.rules import Rule, Ruleset
from griptape.structures import Workflow
from griptape.tasks import PromptTask,
TextSummaryTask
from griptape.tools import WebScraperTool,
WebSearchTool
from griptape.utils import StructureVisualizer
from pydantic import BaseModel
class Feature(BaseModel):
name: str
description: str
emoji: str
class Output(BaseModel):
answer: str
key_features: list[Feature]
projects = ["griptape", "langchain", "crew-ai",
"pydantic-ai"]
prompt_driver =
OpenAiChatPromptDriver(model="gpt-4o")
workflow = Workflow(
tasks=[
[
PromptTask(
id=f"project-{project}",
input="Tell me about the open source project: {{
project }}.",
prompt_driver=prompt_driver,
context={"project": projects},
output_schema=Output,
tools=[
WebSearchTool(
web_search_driver=DuckDuckGoWebSearchDriver(),
),
WebScraperTool(),
],
child_ids=["summary"],
)
for project in projects
],
TextSummaryTask(
input="{{ parents_output_text }}",
id="summary",
rulesets=[
Ruleset(
name="Format", rules=[Rule("Be detailed."),
Rule("Include emojis.")]
)
],
),
]
)
workflow.run()
print(StructureVisualizer(workflow).to_url())
Output: Here's a detailed summary of the
open-source projects mentioned:
1. **Griptape** 🛠️:
- Griptape is a modular Python framework designed
for creating AI-powered applications. It focuses on
securely connecting to
enterprise data and APIs. The framework provides
structured components like Agents, Pipelines, and
Workflows, allowing for both
parallel and sequential operations. It includes
built-in tools and supports custom tool creation
for data and service
interaction.
2. **LangChain** 🔗:
- LangChain is a framework for building
applications powered by Large Language Models
(LLMs). It offers a standard interface
for models, embeddings, and vector stores,
facilitating real-time data augmentation and model
interoperability. LangChain
integrates with various data sources and external
systems, making it adaptable to evolving
technologies.
3. **CrewAI** 🤖:
- CrewAI is a standalone Python framework for
orchestrating multi-agent AI systems. It allows
developers to create and
manage AI agents that collaborate on complex tasks.
CrewAI emphasizes ease of use and scalability,
providing tools and
documentation to help developers build AI-powered
solutions.
4. **Pydantic-AI** 🧩:
- Pydantic-AI is a Python agent framework that
simplifies the development of production-grade
applications with Generative
AI. Built on Pydantic, it supports various AI
models and provides features like type-safe design,
structured response
validation, and dependency injection. Pydantic-AI
aims to bring the ease of FastAPI development to AI
applications.
These projects offer diverse tools and frameworks
for developing AI applications, each with unique
features and capabilities
tailored to different aspects of AI development.
graph TD;
griptape-->summary;
langchain-->summary;
pydantic-ai-->summary;
crew-ai-->summary;
Griptape uses [Semantic
Versioning](https://semver.org/).
Thank you for considering contributing to Griptape!
Before you start, please review our [Contributing
Guidelines](https://github.com/griptape-ai/griptape
/blob/main/CONTRIBUTING.md).
Griptape is available under the Apache 2.0 License.
[03/13/25 21:07:44] INFO PromptTask project-research
Output: {"answer":"Hello Collin! I'm Oswald from
Oswald's Open Source. Let me tell you about the
Griptape Python framework.\n\nGriptape is a modular
Python framework designed to simplify the
development of generative AI (genAI) applications.
It provides a set of flexible abstractions for
working with Large Language Models (LLMs),
Retrieval-Augmented Generation (RAG), and more. The
framework is structured around core components like
Agents, Pipelines, and Workflows, which allow for
both sequential and parallel task
operations.\n\nGriptape includes various drivers
and tools that facilitate interactions with
external resources and services, making it easy to
swap out functionality with minimal changes to your
business logic. It also supports the creation of
custom tools and provides engines for specific use
cases like RAG pipelines, data extraction, and text
summarization.\n\nOverall, Griptape is designed to
offer developers control and flexibility while
building AI-powered applications that securely
connect to enterprise data and
APIs.","key_features":[{"name":"Agents","descriptio
n":"Consist of a single Task, configured for
specific
behavior.","emoji":"🤖"},{"name":"Pipelines","descr
iption":"Organize a sequence of Tasks so that the
output from one Task may flow into the
next.","emoji":"🔄"},{"name":"Workflows","descripti
on":"Configure Tasks to operate in
parallel.","emoji":"🌐"},{"name":"Conversation
Memory","description":"Enables LLMs to retain and
retrieve information across
interactions.","emoji":"💬"},{"name":"Prompt
Drivers","description":"Manage textual and image
interactions with LLMs.","emoji":"🗣️"},{"name":"RAG
Engine","description":"An abstraction for
implementing modular Retrieval Augmented Generation
(RAG) pipelines.","emoji":"📊"}]}
Output(
│ answer="Hello Collin! I'm Oswald from Oswald's Open Source. Let me tell you about the Griptape Python framework.\n\nGriptape is a modular Python framework designed to simplify the development of generative AI (genAI) applications. It provides a set of flexible abstractions for working with Large Language Models (LLMs), Retrieval-Augmented Generation (RAG), and more. The framework is structured around core components like Agents, Pipelines, and Workflows, which allow for both sequential and parallel task operations.\n\nGriptape includes various drivers and tools that facilitate interactions with external resources and services, making it easy to swap out functionality with minimal changes to your business logic. It also supports the creation of custom tools and provides engines for specific use cases like RAG pipelines, data extraction, and text summarization.\n\nOverall, Griptape is designed to offer developers control and flexibility while building AI-powered applications that securely connect to enterprise data and APIs.",
│ key_features=[
│ │ Feature(
│ │ │ name='Agents',
│ │ │ description='Consist of a single Task, configured for specific behavior.',
│ │ │ emoji='🤖'
│ │ ),
│ │ Feature(
│ │ │ name='Pipelines',
│ │ │ description='Organize a sequence of Tasks so that the output from one Task may flow into the next.',
│ │ │ emoji='🔄'
│ │ ),
│ │ Feature(
│ │ │ name='Workflows',
│ │ │ description='Configure Tasks to operate in parallel.',
│ │ │ emoji='🌐'
│ │ ),
│ │ Feature(
│ │ │ name='Conversation Memory',
│ │ │ description='Enables LLMs to retain and retrieve information across interactions.',
│ │ │ emoji='💬'
│ │ ),
│ │ Feature(
│ │ │ name='Prompt Drivers',
│ │ │ description='Manage textual and image interactions with LLMs.',
│ │ │ emoji='🗣️'
│ │ ),
│ │ Feature(
│ │ │ name='RAG Engine',
│ │ │ description='An abstraction for implementing modular Retrieval Augmented Generation (RAG) pipelines.',
│ │ │ emoji='📊'
│ │ )
│ ]
)
Info
Many built-in Tools either provide general-purpose functions (e.g., CalculatorTool) or are Driver-based to support exchanging external providers (e.g., WebSearchTool).
Tools are a powerful method for extending the LLM’s capabilities. Consider writing your own Tools to enable more specialized functionality.
At this point, we have a Task that can handle real-world operations. Now let’s look at orchestrating multiple Tasks.
Structures
So far, we’ve only worked with individual Tasks. As your app becomes more complex, you may want to organize multiple Tasks that execute in sequence or in parallel.
Griptape provides three Structures:
- Agent: A lightweight wrapper around a single
PromptTask
. Great for quick usage but still under the hood is just aPromptTask
. - Pipeline: Executes Tasks in a specific, linear order.
- Workflow: Creates highly parallel DAGs, allowing you to fan out and converge Tasks.
Of the three, Workflow
is generally the most versatile. Agent
and Pipeline
can be handy in certain scenarios but are less frequently needed if you’re comfortable just orchestrating Tasks directly.
Let’s place our project-research
Task into a Workflow
so multiple Tasks can run in parallel:
from pydantic import BaseModel
from rich.pretty import pprint
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.drivers.web_search.duck_duck_go import DuckDuckGoWebSearchDriver
from griptape.rules import Rule, Ruleset
from griptape.structures import Workflow
from griptape.tasks import PromptTask
from griptape.tools import WebScraperTool, WebSearchTool
class Feature(BaseModel):
name: str
description: str
emoji: str
class Output(BaseModel):
answer: str
key_features: list[Feature]
projects = ["django", "flask", "fastapi", "litestar"]
workflow = Workflow(
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
Rule("You run 'Oswald's Open Source', a company for helping people learn about open source."),
],
),
],
)
prompt_driver = OpenAiChatPromptDriver(model="gpt-4o")
for project in projects:
task = PromptTask(
id=f"project-research-{project}",
input="Tell me about the open source project: {{ project }}.",
prompt_driver=prompt_driver,
context={"project": project},
output_schema=Output,
tools=[
WebSearchTool(
web_search_driver=DuckDuckGoWebSearchDriver(),
),
WebScraperTool(),
],
)
workflow.add_task(task)
workflow.run()
for output in workflow.outputs:
pprint(output.value)
[03/13/25 21:09:10] INFO PromptTask project-research-django
Input: Tell me about the open source project:
django.
INFO PromptTask project-research-flask
Input: Tell me about the open source project:
flask.
INFO PromptTask project-research-fastapi
Input: Tell me about the open source project:
fastapi.
INFO PromptTask project-research-litestar
Input: Tell me about the open source project:
litestar.
[03/13/25 21:09:12] INFO Subtask 1f1faeda72c645c182fa2d37068c3abf
Actions: [
{
"tag": "call_oA2nc5Ng6EeQmcGjrNcM0XMP",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "FastAPI open source project"
}
}
}
]
INFO Subtask 282edc774a3f4f95aeee3a4dd8fd927c
Actions: [
{
"tag": "call_rXkv77aGymObYqVkZcig9l9S",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "litestar open source project"
}
}
}
]
INFO Subtask eaf0b9010a1e4163994af140610c989b
Actions: [
{
"tag": "call_WDyTUwiIoCgPWvbHeUmQfOvH",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "Django open source project"
}
}
}
]
INFO Subtask 40f34c4826b646c59f34273782ca95b8
Actions: [
{
"tag": "call_ZleDyib2a9aZ2n8leK1heXhY",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "Flask open source project"
}
}
}
]
[03/13/25 21:09:13] INFO Subtask 1f1faeda72c645c182fa2d37068c3abf
Response: {"title":
"Kludex/awesome-fastapi-projects - GitHub", "url":
"https://github.com/Kludex/awesome-fastapi-projects
", "description": "Contribute to
Kludex/awesome-fastapi-projects development by
creating an account on GitHub. List of FastAPI
projects! :sunglasses: :rocket: . Contribute to
Kludex/awesome-fastapi-projects development by
creating an account on GitHub. ... Fund open source
developers The ReadME Project. GitHub community
articles Repositories. Topics Trending ..."}
{"title": "GitHub - mjhea0/awesome-fastapi: A
curated list of awesome things ...", "url":
"https://github.com/mjhea0/awesome-fastapi",
"description": "Awesome FastAPI Projects -
Organized list of projects that use FastAPI.
Bitcart - Platform for merchants, users and
developers which offers easy setup and use. Bali -
Simplify Cloud Native Microservices development
base on FastAPI and gRPC. Bunnybook - A tiny social
network built with FastAPI, React+RxJs, Neo4j,
PostgreSQL, and Redis."}
{"title": "Top 23 Fastapi Open-Source Projects -
LibHunt", "url":
"https://www.libhunt.com/topic/fastapi",
"description": "Which are the best open-source
Fastapi projects? This list will help you: fastapi,
full-stack-fastapi-template, Hello-Python, serve,
sqlmodel, HivisionIDPhotos, and
Douyin_TikTok_Download_API. LibHunt. Popularity
Index Add a project About. Fastapi. Open-source
projects categorized as Fastapi"}
{"title": "Any open-source project that uses
FastAPI? : r/FastAPI - Reddit", "url":
"https://www.reddit.com/r/FastAPI/comments/n6afvm/a
ny_opensource_project_that_uses_fastapi/",
"description": "Angular is Google's open source
framework for crafting high-quality front-end web
applications. r/Angular2 exists to help spread
news, discuss current developments and help solve
problems. Welcome! Members Online"}
{"title": "GitHub - fastapi/fastapi: FastAPI
framework, high performance, easy to ...", "url":
"https://github.com/FastAPI/FastAPI",
"description": "When you install FastAPI with pip
install \"fastapi[standard]\" it comes with the
standard group of optional dependencies:. Used by
Pydantic: email-validator - for email validation.;
Used by Starlette: httpx - Required if you want to
use the TestClient.; jinja2 - Required if you want
to use the default template configuration.;
python-multipart - Required if you want to support
form \"parsing ..."}
INFO Subtask 40f34c4826b646c59f34273782ca95b8
Response: {"title": "Python Flask Projects with
Source Code (Beginners to Advanced)", "url":
"https://www.geeksforgeeks.org/flask-projects/",
"description": "Deploying Flask Projects. Once you
have completed your Flask project, you'll want to
deploy it for the world to see. Consider the
following deployment options: Deployment Options.
Heroku: A cloud platform that simplifies the
deployment process. PythonAnywhere: A hosting
service specifically designed for Python web
applications."}
{"title": "10+ Top Python Flask Projects in 2025 -
with Source Code", "url":
"https://machinelearningprojects.net/flask-projects
/", "description": "Many Flask projects with source
code are part of active open-source communities.
Engaging with these communities allows you to learn
from others, seek advice, and collaborate on
improving existing projects. Steps to Start a Flask
Project Installing Flask. To start a Flask project,
developers need to install Flask using pip, the
Python package ..."}
{"title": "Top 23 Flask Open-Source Projects -
LibHunt", "url":
"https://www.libhunt.com/topic/flask",
"description": "For Flask, the Flask Mega-Tutorial
has a free online version. There are also two
courses over at TestDriven.io worth recommending:
TDD with Python, Flask and Docker and
Authentication with Flask, React, and Docker. If
you prefer video, there are many Flask courses on
Udemy but the best video course I've seen is Build
a SaaS App with Flask and ..."}
{"title": "Awesome Flask - GitHub", "url":
"https://github.com/mjhea0/awesome-flask",
"description": "Connexion - Open source,
OpenAPI-based, REST framework built on top of
Flask. Flasgger - OpenAPI and Swagger UI. Builds
the API from Flasgger models, marshmallow models,
dicts, or YAML files. ... Please support this open
source project by purchasing one of our Flask
courses. Learn how to build, test, and deploy
microservices powered by Docker ..."}
{"title": "python-flask-application \u00b7 GitHub
Topics \u00b7 GitHub", "url":
"https://github.com/topics/python-flask-application
", "description": "This project walks through how
you can create recommendations using Apache Spark
machine learning. There are a number of jupyter
notebooks that you can run on IBM Data Science
Experience, and there a live demo of a movie
recommendation web application you can interact
with. ... python open-source flask csv forms https
flask-application flask ..."}
INFO Subtask eaf0b9010a1e4163994af140610c989b
Response: {"title": "GitHub -
wsvincent/awesome-django: A curated list of awesome
things ...", "url":
"https://github.com/wsvincent/awesome-django",
"description": "Zulip - Open-source team chat.
Django-CRM - Open Source Python CRM based on
Django. django-job-portal - Job portal application
using Django. Built with Django - Curated list of
awesome Django projects. PostHog - Open-source
product analytics. HyperKitty - A web interface to
access GNU Mailman v3 archives."}
{"title": "10 Must-See Django Open-Source Projects
to Inspire Your Next Web App", "url":
"https://medium.com/@luisprooc/10-must-see-django-o
pen-source-projects-to-inspire-your-next-web-app-70
7c963b4a66", "description": "Django Job Portal. One
of the benefits of using this Open Source Project
is the flexibility it offers. With access to the
source code, developers can customize and extend
the platform to meet the ..."}
{"title": "Top 45+ Django Projects with Source Code
for 2025 [Beginners to ...", "url":
"https://www.geeksforgeeks.org/django-projects/",
"description": "Open In App. Next Article: Top 10
Django Projects For Beginners With Source Code.
Python Django Projects with Source Code (Beginners
to Advanced) ... Python Django Projects with Source
Code - Adding a project portfolio to your resume
helps to show your skills and potential to your
recruiter. Because in the tech space, real-time
project ..."}
{"title": "django-project \u00b7 GitHub Topics
\u00b7 GitHub", "url":
"https://github.com/topics/django-project",
"description": "Django Dashboard Black -
Open-source Seed Project | AppSeed. ... A free,
open-source Blog CMS based on the \"Django\" and
\"Editorial\" HTML5 theme. blog cms django html5
podcast skill django-application django-cms
django-project videocast. Updated Mar 6, 2025;
Python;"}
{"title": "The web framework for perfectionists
with deadlines | Django", "url":
"https://www.djangoproject.com/", "description":
"Django is a high-level Python web framework that
encourages rapid development and clean, pragmatic
design. ... It's free and open source. Ridiculously
fast. Django was designed to help developers take
applications from concept to completion as quickly
as possible. ... Our non-profit supports the
project Support Django Your contribution makes
..."}
INFO Subtask 282edc774a3f4f95aeee3a4dd8fd927c
Response: {"title": "GitHub -
litestar-org/litestar: Production-ready, Light,
Flexible and ...", "url":
"https://github.com/litestar-org/litestar",
"description": "Litestar is an open-source project,
and we enjoy the support of our sponsors to help
fund the exciting work we do. A huge thanks to our
sponsors: Check out our sponsors in the docs. If
you would like to support the work that we do
please consider becoming a sponsor via Polar.sh
(preferred), GitHub or Open Collective."}
{"title": "Litestar - GitHub", "url":
"https://github.com/litestar-org/", "description":
"Litestar is an open-source project, and we enjoy
the support of our sponsors to help fund the
exciting work we do. A huge thanks to our sponsors:
Gold Sponsors. Silver Sponsors. Check out our
sponsors in the docs. If you would like to support
the work that we do please consider becoming a
sponsor on GitHub or Open Collective."}
{"title": "GitHub - litestar-org/awesome-litestar:
A curated list of resources ...", "url":
"https://github.com/litestar-org/awesome-litestar",
"description": "litestar-aiosql - A plugin for the
aiosql database query builder. * litestar-granian -
A plugin for the Granian HTTP server, written in
Rust. * litestar-svcs - A plugin for the SVCS
service locater/dependency injection library. *
litestar-saq-htmx - Proof of concept using SAQ,
Litestar, HTMX, and Server-Sent events for a simple
SAQ job monitor."}
{"title": "litestar - PyPI", "url":
"https://pypi.org/project/litestar/",
"description": "Like all Litestar projects, this
application is open to contributions, big and
small. Sponsors. Litestar is an open-source
project, and we enjoy the support of our sponsors
to help fund the exciting work we do. A huge thanks
to our sponsors: Check out our sponsors in the
docs"}
{"title": "Exploring LiteStar: A Python Framework
for Lightweight Web ... - Medium", "url":
"https://medium.com/@rajputgajanan50/exploring-lite
star-a-python-framework-for-lightweight-web-develop
ment-e3a9749f23de", "description":
"\ud83d\udc49What is LiteStar?. LiteStar is a
Python web framework designed for simplicity and
flexibility. It is open-source and built with the
goal of being easy to learn and use, making it an
excellent ..."}
[03/13/25 21:09:14] INFO Subtask 78dce378f49c42749391333e19d4ad04
Actions: [
{
"tag": "call_qzGb2CSI1ydJ98UEoHWOsZHe",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url": "https://www.djangoproject.com/"
}
}
}
]
INFO Subtask ef8741119dfb4e4884484e765eb17a51
Actions: [
{
"tag": "call_uwpHmroWio9hSuvEi168rMoU",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url":
"https://github.com/mjhea0/awesome-flask"
}
}
}
]
INFO Subtask a2a0bf64783f49959ddc519ecfa84ffd
Actions: [
{
"tag": "call_jDXDvjujNItAmMqbQ3J027mf",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url":
"https://github.com/litestar-org/litestar"
}
}
}
]
INFO Subtask a01d474682634561b5921a01a419f179
Actions: [
{
"tag": "call_u949VPUdc3h18lsCGUsntyUE",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url": "https://github.com/FastAPI/FastAPI"
}
}
}
]
[03/13/25 21:09:15] INFO Subtask 78dce378f49c42749391333e19d4ad04
Response: Meet Django
Django is a high-level Python web framework that
encourages rapid development and clean, pragmatic
design. Built by experienced developers, it takes
care of much of the hassle of web development, so
you can focus on writing your app without needing
to reinvent the wheel. It’s free and open source.
- Ridiculously fast.
-
Django was designed to help developers take
applications from concept to completion as quickly
as possible.
- Reassuringly secure.
-
Django takes security seriously and helps
developers avoid many common security mistakes.
- Exceedingly scalable.
-
Some of the busiest sites on the web leverage
Django’s ability to quickly and flexibly scale.
[Learn more about
Django](https://www.djangoproject.com/start/overvie
w/)
Join the Community
[Back to Top](#top)
INFO Subtask a2a0bf64783f49959ddc519ecfa84ffd
Response: Litestar is a powerful, flexible yet
opinionated ASGI framework, focused on building
APIs, and offers high-performance data validation
and parsing, dependency injection, first-class ORM
integration, authorization primitives, and much
more that's needed to get applications up and
running.
Check out the [documentation
📚](https://docs.litestar.dev/) for a detailed
overview of
its features!
Additionally, the [Litestar fullstack
repository](https://github.com/litestar-org/litesta
r-fullstack)
can give you a good impression how a fully fledged
Litestar application may look.
Table of Contents
pip install litestar
from litestar import Litestar, get
@get("/")
def hello_world() -> dict[str, str]:
"""Keeping the tradition alive with hello world."""
return {"hello": "world"}
app = Litestar(route_handlers=[hello_world])
[Class based
controllers](#class-based-controllers)[Dependency
Injection](#dependency-injection)[Layered
Middleware](#middleware)[Plugin
System](#plugin-system-orm-support-and-dtos)[OpenAP
I 3.1 schema generation](#openapi)[Life Cycle
Hooks](#request-life-cycle-hooks)[Route Guards
based Authorization](#route-guards)- Support for
dataclasses
,TypedDict
,[pydantic version 1 and version
2](https://docs.pydantic.dev/latest/),[msgspec](htt
ps://github.com/jcrist/msgspec)and[attrs](https://w
ww.attrs.org/en/stable/) - Layered parameter
declaration
- Support for
[RFC
9457](https://datatracker.ietf.org/doc/html/rfc9457
)standardized "Problem Detail" error responses
[Automatic API documentation
with](#redoc-swagger-ui-and-stoplight-elements-api-
documentation):[Trio](https://trio.readthedocs.io/e
n/stable/)support (built-in,
via[AnyIO](https://anyio.readthedocs.io/))-
Ultra-fast validation, serialization and
deserialization using
[msgspec](https://github.com/jcrist/msgspec) -
SQLAlchemy integration
- Piccolo ORM Support
Pre-built Example Apps
[litestar-hello-world](https://github.com/litestar-
org/litestar-hello-world): A bare-minimum
application setup. Great for testing and POC
work.[litestar-fullstack](https://github.com/litest
ar-org/litestar-fullstack): A reference application
that contains most of the boilerplate required for
a web application. It features a Litestar app
configured with best practices, SQLAlchemy 2.0 and
SAQ, a frontend integrated with Vitejs and Jinja2
templates, Docker, and more. Like all Litestar
projects, this application is open to
contributions, big and small.
Litestar is an open-source project, and we enjoy
the support of our sponsors to help fund the
exciting work we do.
A huge thanks to our sponsors:
[Check out our sponsors in the
docs](https://docs.litestar.dev/dev/#sponsors)
If you would like to support the work that we do
please consider [becoming a
sponsor](https://polar.sh/litestar-org)
via [Polar.sh](https://polar.sh/litestar-org)
(preferred),
[GitHub](https://github.com/sponsors/litestar-org)
or [Open
Collective](https://opencollective.com/litestar).
Also, exclusively with
[Polar](https://polar.sh/litestar-org), you can
engage in pledge-based sponsorships.
While supporting function-based route handlers,
Litestar also supports and promotes python OOP
using class based controllers:
Example for class-based controllers
from typing import List, Optional
from datetime import datetime
from litestar import Controller, get, post, put,
patch, delete
from litestar.dto import DTOData
from pydantic import UUID4
from my_app.models import User, PartialUserDTO
class UserController(Controller):
path = "/users"
@post()
async def create_user(self, data: User) -> User:
...
@get()
async def list_users(self) -> List[User]: ...
@get(path="/{date:int}")
async def list_new_users(self, date: datetime) ->
List[User]: ...
@patch(path="/{user_id:uuid}", dto=PartialUserDTO)
async def partial_update_user(
self, user_id: UUID4, data: DTOData[PartialUserDTO]
) -> User: ...
@put(path="/{user_id:uuid}")
async def update_user(self, user_id: UUID4, data:
User) -> User: ...
@get(path="/{user_name:str}")
async def get_user_by_name(self, user_name: str) ->
Optional[User]: ...
@get(path="/{user_id:uuid}")
async def get_user(self, user_id: UUID4) -> User:
...
@delete(path="/{user_id:uuid}")
async def delete_user(self, user_id: UUID4) ->
None: ...
Litestar is rigorously typed, and it enforces
typing. For example, if you forget to type a return
value for a route handler, an exception will be
raised. The reason for this is that Litestar uses
typing data to generate OpenAPI specs, as well as
to validate and parse data. Thus, typing is
essential to the framework.
Furthermore, Litestar allows extending its support
using plugins.
Litestar has a plugin system that allows the user
to extend serialization/deserialization, OpenAPI
generation, and other features.
It ships with a builtin plugin for SQL Alchemy,
which allows the user to use SQLAlchemy declarative
classes "natively" i.e., as type parameters that
will be serialized/deserialized and to return them
as values from route handlers.
Litestar also supports the programmatic creation of
DTOs with a DTOFactory
class, which also supports the use of
plugins.
Litestar has custom logic to generate OpenAPI 3.1.0
schema, include optional generation of examples
using the
[
polyfactory](https://pypi.org/project/polyfactory/)
library.
Litestar serves the documentation from the
generated OpenAPI schema with:
All these are available and enabled by default.
Litestar has a simple but powerful DI system
inspired by pytest. You can define named
dependencies - sync or async - at different levels
of the application, and then selective use or
overwrite them.
Example for DI
from litestar import Litestar, get
from litestar.di import Provide
async def my_dependency() -> str: ...
@get("/")
async def index(injected: str) -> str:
return injected
app = Litestar([index], dependencies={"injected":
Provide(my_dependency)})
Litestar supports typical ASGI middleware and ships
with middlewares to handle things such as
- CORS
- CSRF
- Rate limiting
- GZip and Brotli compression
- Client- and server-side sessions
Litestar has an authorization mechanism called
guards
, which allows the user to define guard functions
at different
level of the application (app, router, controller
etc.) and validate the request before hitting the
route handler
function.
Example for route guards
from litestar import Litestar, get
from litestar.connection import ASGIConnection
from litestar.handlers.base import BaseRouteHandler
from litestar.exceptions import
NotAuthorizedException
async def is_authorized(connection: ASGIConnection,
handler: BaseRouteHandler) -> None:
# validate authorization
# if not authorized, raise NotAuthorizedException
raise NotAuthorizedException()
@get("/", guards=[is_authorized])
async def index() -> None: ...
app = Litestar([index])
Litestar supports request life cycle hooks,
similarly to Flask - i.e. before_request
and after_request
Litestar is fast. It is on par with, or
significantly faster than comparable ASGI
frameworks.
You can see and run the benchmarks
[here](https://github.com/litestar-org/api-performa
nce-tests),
or read more about it
[here](https://docs.litestar.dev/latest/benchmarks)
in our documentation.
Litestar is open to contributions big and small.
You can always [join our
discord](https://discord.gg/X3FJqy8d2j) server
or [join our
Matrix](https://matrix.to/#/#litestar:matrix.org)
space
to discuss contributions and project maintenance.
For guidelines on how to contribute, please
see [the contribution
guide](/litestar-org/litestar/blob/main/CONTRIBUTIN
G.rst).
Thanks goes to these wonderful people:
[Emoji
Key](https://allcontributors.org/docs/en/emoji-key)
This project follows the
[all-contributors](https://github.com/all-contribut
ors/all-contributors) specification.
Contributions of any kind welcome!
INFO Subtask ef8741119dfb4e4884484e765eb17a51
Response: A curated list of awesome things related
to Flask.
[Flask](https://flask.palletsprojects.com/) is a
lightweight WSGI web application framework written
in Python.
[Flask-Admin](https://github.com/pallets-eco/flask-
admin)- Functional admin panel that provides a user
interface for managing data based on your models.
[Eve](https://docs.python-eve.org)- RESTful API
framework designed for human
beings.[Flask-Classful](https://flask-classful.read
thedocs.io/)- Adds support for class-based views
for setting up RESTful API route
endpoints.[Flask-MongoRest](https://github.com/clos
eio/flask-mongorest)- RESTful API framework wrapped
around[MongoEngine](http://mongoengine.org/).[Flask
-RESTful](https://flask-restful.readthedocs.io)-
Quickly build RESTful APIs.
[APIFlask](https://github.com/apiflask/apiflask)-
Integrates marshmallow for validation and
serialization, and for OpenAPI generation with
Swagger
UI.[Connexion](https://connexion.readthedocs.io)-
Open source, OpenAPI-based, REST framework built on
top of
Flask.[Flasgger](https://github.com/flasgger/flasgg
er)- OpenAPI and Swagger UI. Builds the API from
Flasgger models, marshmallow models, dicts, or YAML
files.[Flask-Rebar](https://github.com/plangrid/fla
sk-rebar)- Combines
Flask,[marshmallow](https://marshmallow.readthedocs
.io/), and[OpenAPI](https://www.openapis.org/)for
robust REST
services.[Flask-RESTX](https://flask-restx.readthed
ocs.io)- Community-driven fork
of[Flask-RESTPlus](https://flask-restplus.readthedo
cs.io/)that makes it easy to build and document
RESTful APIs with
Flask.[flask-smorest](https://github.com/marshmallo
w-code/flask-smorest/)- Marshmallow's official
Flask REST integration. Uses marshmallow models for
request/response validation and serialization, and
generates OpenAPI with Swagger UI.
[SAFRS: Python OpenAPI & JSON:API
Framework](https://github.com/thomaxxl/safrs)-
SAFRS, which is an acronym for SqlAlchemy
Flask-Restful Swagger, is meant to help developers
create self-documenting JSON APIs for SQLAlchemy
database objects and relationships.
[Flask-HTTPAuth](https://flask-httpauth.readthedocs
.io)-
Authentication.[Flask-Login](https://flask-login.re
adthedocs.io/)- Account management and
authentication.[Flask
Principal](https://pythonhosted.org/Flask-Principal
/)-
Authorization.[Flask-Security-Too](https://flask-se
curity-too.readthedocs.io/en/stable/)- Account
management, authentication,
authorization.[Flask-Session](https://flasksession.
readthedocs.io/en/latest/)- Session
managment.[Flask-SimpleLogin](https://github.com/fl
ask-extensions/Flask-SimpleLogin)-
Authentication.[Flask-User](https://flask-user.read
thedocs.io)- Account management, authentication,
authorization.
Curious about the differences differences between
Flask-User and Flask-Security? Review the
Flask-User
[FAQ].
[Flask-JWT](https://pythonhosted.org/Flask-JWT/)-
Basic support for working with
JWTs.[Flask-JWT-Extended](https://flask-jwt-extende
d.readthedocs.io)- Advanced support for working
with
JWTs.[Flask-JWT-Router](https://github.com/joegasew
icz/flask-jwt-router)- Adds authorized routes to a
Flask
app.[Flask-Praetorian](https://flask-praetorian.rea
dthedocs.io)- Authentication and authorization for
Flask APIs.
[Authlib](https://authlib.org/)- Library for
building OAuth and OpenID clients and
servers.[Authomatic](https://github.com/authomatic/
authomatic)- Framework agnostic library for Python
web applications that simplifies authentication and
authorization of users via OAuth and
OpenID.[Flask-Dance](https://github.com/singingwolf
boy/flask-dance)- OAuth support
via[OAuthLib](https://oauthlib.readthedocs.io/).
[Flask-Caching](https://flask-caching.readthedocs.i
o/)- Caching support.
[Flask-Marshmallow](https://flask-marshmallow.readt
hedocs.io)- Thin integration layer for Flask and
marshmallow (an object serialization
/deserialization library) that adds additional
features to
marshmallow.[Flask-Pydantic](https://github.com/bau
erji/flask-pydantic)-[Pydantic](https://github.com/
pydantic/pydantic)support.
[Flask-Peewee](https://flask-peewee.readthedocs.io)
- Support for Peewee, an ORM and database migration
tool.[Flask-Pony](https://pypi.org/project/Flask-Po
ny/)- Support for Pony
ORM.[Flask-SQLAlchemy](https://flask-sqlalchemy.pal
letsprojects.com)- Support for SQLAlchemy, a SQL
toolkit and ORM.
[Flask-MongoEngine](https://flask-mongoengine-3.rea
dthedocs.io)- Bridges Flask and MongoEngine for
working with
MongoDB.[Flask-PyMongo](https://flask-pymongo.readt
hedocs.io)- Bridges Flask and PyMongo for working
with MongoDB.
[Flask-Alembic](https://flask-alembic.readthedocs.i
o)-
Configurable[Alembic](https://alembic.sqlalchemy.or
g/)migration environment around a Flask-SQLAlchemy
database for handling database migrations.
[Flask-DB](https://github.com/nickjj/flask-db)-
Flask CLI extension that helps you migrate, drop,
create and seed your SQL
database.[Flask-Migrate](https://flask-migrate.read
thedocs.io)- Handles SQLAlchemy database migrations
via Alembic.
Curious about the differences between Alembic,
Flask-Alembic, Flask-Migrate, and Flask-DB? Review
[this item]from Flask-DB's FAQ.
[Flask-Excel](https://github.com/pyexcel-webwares/F
lask-Excel)-
Uses[pyexcel](https://github.com/pyexcel/pyexcel)to
read, manipulate, and write data in different Excel
formats: csv, ods, xls, xlsx and xlsm.
[Flask-DebugToolbar](https://flask-debugtoolbar.rea
dthedocs.io)- Port of Django's debug toolbar for
Flask.[Flask-Profiler](https://github.com/muatik/fl
ask-profiler)- Endpoint analyzer/profiler.
[Flask-Fixtures](https://github.com/croach/Flask-Fi
xtures)- Create database fixtures from JSON or
YAML.[Mixer](https://mixer.readthedocs.io)- Object
generation tool.
[Rollbar](https://rollbar.com/platforms/flask-error
-tracking/)- Flask error logging with Rollbar.
[Airbrake](https://docs.airbrake.io/docs/platforms/
framework/python/flask/)- Airbrake Flask
integration.[Elastic APM
Agent](https://www.elastic.co/guide/en/apm/agent/py
thon/current/flask-support.html)- Elastic APM Flask
integration.[Flask Monitoring
Dashboard](https://flask-monitoringdashboard.readth
edocs.io)- Dashboard for automatic monitoring of
Flask web-services.[Sentry Python
SDK](https://sentry.io/for/flask/)- Sentry SDK
Flask integration.
[OpenTelemetry](https://opentelemetry-python-contri
b.readthedocs.io/en/latest/instrumentation/flask/fl
ask.html)- OpenTelemetry Flask Instrumentation.
[Flask-Testing](https://pythonhosted.org/Flask-Test
ing/)- Unittest
extensions.[Pytest-Flask](https://github.com/pytest
-dev/pytest-flask)- Pytest support for testing
Flask applications.
[Flask-Mail](https://flask-mail.readthedocs.io/)-
Provides simple email sending
capabilities.[Flask-Mailman](https://pypi.org/proje
ct/flask-mailman/)- A port ofdjango.mail
for
Flask.[Flask-Mail-SendGrid](https://github.com/hama
no/flask-mail-sendgrid)- Provides simple email base
on Flask-Mail for sending email by SendGrid.
[Flask-WTF](https://flask-wtf.readthedocs.io)-
Integrates Flask with WTForms (provides CSRF
protection as well).
[flask-msearch](https://github.com/honmaple/flask-m
search)- Full-text
search.[Flask-WhooshAlchemy3](https://github.com/bl
akev/Flask-WhooshAlchemy3)- Full-text search +
Whoosh indexing capabilities for
Flask-SQLAlchemy.[SQLAlchemy-Searchable](https://sq
lalchemy-searchable.readthedocs.io)- Provides
full-text search capabilities for SQLAlchemy
models.
[Flask-Argon2](https://github.com/red-coracle/flask
-argon2)- Provides argon2 hashing
utilities.[Flask-Bcrypt](https://flask-bcrypt.readt
hedocs.io)- Provides bcrypt hashing
utilities.[Flask-CORS](https://flask-cors.readthedo
cs.io)- Cross Origin Resource Sharing (CORS)
handling.[Flask-SeaSurf](https://github.com/maxcoun
tryman/flask-seasurf/)- Cross-site request forgery
(CSRF)
prevention.[Flask-Talisman](https://github.com/wntr
blm/flask-talisman)- HTTPS and security headers.
[Celery](https://docs.celeryproject.org/)- The most
commonly used Python library for handling
asynchronous tasks and
scheduling.[Dramatiq](https://flask-dramatiq.rtfd.i
o/)- Fast and reliable alternative to
Celery.[Flask-RQ](https://github.com/pallets-eco/fl
ask-rq)-[RQ](https://python-rq.org/)(Redis Queue)
integration.[Huey](https://huey.readthedocs.io)-[Re
dis](https://redis.io/)-based task queue that aims
to provide a simple, yet flexible framework for
executing tasks.
[Flask-Babel](https://github.com/python-babel/flask
-babel)- Support for internationalization (i18n)
and localization
(l10n).[Flask-File-Upload](https://github.com/joega
sewicz/flask-file-upload)- Easy file
uploads.[Flask-FlatPages](https://pythonhosted.org/
Flask-FlatPages/)- Provides flat static pages based
on text
files.[Frozen-Flask](https://github.com/Frozen-Flas
k/Frozen-Flask)- Freezes a Flask application into a
set of static
files.[Flask-GraphQL](https://github.com/graphql-py
thon/flask-graphql)- GraphQL
support.[Flask-Injector](https://github.com/python-
injector/flask_injector)- Adds support for
dependency
injection.[Flask-Limiter](https://flask-limiter.rea
dthedocs.io)- Rate limiting features to Flask
routes.[Flask-Moment](https://github.com/miguelgrin
berg/Flask-Moment)- Moment.js date and time
formatting helpers for Jinja2
templates.[Flask-Paginate](https://pythonhosted.org
/Flask-paginate/)- Pagination
support.[Flask-Reactize](https://github.com/Azure-S
amples/flask-reactize)- Hides the Node.js
development backend for React behind a Flask
application.[Flask-Shell2HTTP](https://github.com/E
shaan7/Flask-Shell2HTTP)- RESTful/HTTP wrapper for
Python's subprocess API, so you can convert any
command-line tool into a RESTful API
service.[Flask-Sitemap](https://flask-sitemap.readt
hedocs.io)- Sitemap
generation.[Flask-SocketIO](https://flask-socketio.
readthedocs.io)- Socket.IO
integration.[Flask-SSE](https://flask-sse.readthedo
cs.io)- Streaming with flask.
[Project
Website](https://palletsprojects.com/p/flask/)-
Official Flask website.
[Documentation](https://flask.palletsprojects.com)-
Comprehensive documentation for all Flask
versions.[Flaskr
Tutorial](https://flask.palletsprojects.com/tutoria
l/)- Build a basic blog application called
Flaskr.[Source
Code](https://github.com/pallets/flask)- Hosted on
GitHub.
-
[Full Stack Python's Flask
Page](https://www.fullstackpython.com/flask.html)-
Explanation of Flask philosophy and links to other
resources and tutorials. -
[Miguel Grinberg's
Blog](https://blog.miguelgrinberg.com/category/Flas
k)- Multiple Flask-specific tutorials. -
[Nick Janetakis's
Blog](https://nickjanetakis.com/blog/tag/flask-tips
-tricks-and-tutorials)- Flask Tips, Tricks and
Tutorials. -
[Patrick Kennedy's
Blog](https://www.patricksoftwareblog.com/)-
Numerous tutorials on learning Python web
application development with Flask. -
[RealPython](https://realpython.com/tutorials/flask
/)- Many high-quality tutorials on Flask. -
[TestDriven.io](https://testdriven.io/blog/topics/f
lask/)- Up-to-date tutorials on Flask.
[Discord](https://discord.com/invite/t6rrQZH)-
Pallets Projects community on Discord (use
the#get-help
channel for Flask support).- IRC Channel - Chat
with other Flask users on IRC channel
#pocoo
on FreeNode. [Mailing
List](https://mail.python.org/mailman/listinfo/flas
k)- General discussion of Flask and the Pallets
projects (flask@python.org
).[Reddit](https://www.reddit.com/r/flask/)- Flask
subreddit.[Stack
Overflow](https://stackoverflow.com/questions/tagge
d/flask)- Questions taggedflask
.[Twitter](https://twitter.com/PalletsTeam)- For
official announcements on updates, security fixes,
etc.
[FlaskCon](https://twitter.com/flaskcon)- Community
driven Flask event intended for speakers and
attendees all over the world to participate in
technical and evangelical sessions related to
Flask.[PyConWeb](https://twitter.com/pyconweb)-
Covers Django, Tornado, Flask, API frameworks.
AsyncIO, networking, Frontend, JavaScript, and web
security.[Flask Conf
Brazil](https://2019.flask.python.org.br/)-
Conference for the developers and users of
Flask.[PyCon US](https://us.pycon.org/)- The
largest annual gathering for the community using
and developing the open-source Python programming
language.[PyCon Australia](https://pycon-au.org/)-
National conference organized for the Python
Programming Community.[Euro
Python](https://europython.eu/)- The largest Python
conference in Europe.[PyCon](https://pycon.org/)-
Complete listing of all PyCons globally.
[Flask](https://www.meetup.com/topics/flask/all/)-
40+ groups in 20 countries.[Python Web
Development](https://www.meetup.com/topics/python-w
eb-development/all/)- 600+ groups in 81
countries.[Python](https://www.meetup.com/topics/py
thon/all/)- 2,400+ groups in 100 countries.
[TalkPython](https://talkpython.fm/)- The leading
Python podcast with several episodes on
Flask.[Podcast
Init](https://www.pythonpodcast.com/)- A popular
Python podcast that features Flask guests on
occasion.[Python Bytes](https://pythonbytes.fm/)-
Another Python podcast that discusses Flask from
time to time.[Full Stack Python's Best Python
Podcasts
Page](https://www.fullstackpython.com/best-python-p
odcasts.html)- A list of active Python-specific
podcasts.
[Flask
Mega-Tutorial](https://blog.miguelgrinberg.com/post
/the-flask-mega-tutorial-part-i-hello-world)-
Overarching tutorial for Python beginner and
intermediate developers that teaches web
development with the Flask framework.[Flaskr
TDD](https://github.com/mjhea0/flaskr-tdd)- Intro
to Flask, Test-Driven Development (TDD), and
JavaScript.[Make a Web App Using Python &
Flask!](https://aryaboudaie.com/python/technical/ed
ucational/web/flask/2018/10/17/flask.html)-
Creating a Python Website from the Bottom Up.
[Developing Web Applications with Python and
Flask](https://testdriven.io/courses/learn-flask/)-
This course focuses on teaching the fundamentals of
Flask by building and testing a web application
using Test-Driven Development (TDD).[Test-Driven
Development with Python, Flask, and
Docker](https://testdriven.io/courses/tdd-flask/)-
Learn how to build, test, and deploy a
production-grade microservice powered by Python,
Flask, and Docker.[Authentication with Flask,
React, and
Docker](https://testdriven.io/courses/auth-flask-re
act/)- Learn how to add authentication to a Flask
and React microservice!.[Deploying a Flask and
React Microservice to AWS
ECS](https://testdriven.io/courses/aws-flask-react/
)- Learn how to deploy microservices to Amazon ECS
powered by Flask, React, and Docker.[Build a SAAS
App with
Flask](https://buildasaasappwithflask.com)- Learn
to build web applications with Flask and
Docker.[Full Stack
Foundations](https://www.udacity.com/course/full-st
ack-foundations--ud088)- Build a data-driven web
app with Python.[Designing RESTful
APIs](https://www.udacity.com/course/designing-rest
ful-apis--ud388)- Build and Secure a backend API
server.
[Flask Web
Development](https://www.oreilly.com/library/view/f
lask-web-development/9781491991725/)- Learn the
framework from the ground up by developing,
step-by-step, a real-world project.[Real
Python](https://realpython.com)- Learn Python
programming, by example.[Explore
Flask](https://explore-flask.readthedocs.io/)- Best
practices and patterns for developing web
applications with Flask.
[PyVideo](https://pyvideo.org/search.html?q=flask)[
Practical Flask Web Development
Tutorials](https://www.youtube.com/playlist?list=PL
QVvvaa0QuDc_owjTbIY4rbgXOFkUYOUB)[Python Flask
Tutorial: Full-Featured Web
App](https://www.youtube.com/playlist?list=PL-osiE8
0TeTs4UjLw5MM6OjgkjFeUxCYH)[Discover Flask - Full
Stack Web Development with
Flask](https://github.com/realpython/discover-flask
)
(Platforms-as-a-Service)
[Heroku](https://www.heroku.com/)[PythonAnywhere](h
ttps://www.pythonanywhere.com/details/flask_hosting
)[AWS Elastic
Beanstalk](https://aws.amazon.com/elasticbeanstalk/
)[Google App
Engine](https://cloud.google.com/appengine/)[Micros
oft Azure App
Service](https://azure.microsoft.com/en-us/products
/app-service/)[Divio](https://www.divio.com)[Render
](https://render.com/)
(Infrastructure-as-a-Service)
Frameworks:
Compute:
[cookiecutter-flask](https://github.com/cookiecutte
r-flask/cookiecutter-flask)- With Bootstrap 4,
asset bundling annd minification with webpack,
starter templates, and
registration/authentication.[Cookiecutter Flask
Skeleton](https://github.com/testdrivenio/cookiecut
ter-flask-skeleton)- Flask starter project
for[Cookiecutter](https://github.com/cookiecutter/c
ookiecutter).[Flask-AppBuilder](https://github.com/
dpgaspar/Flask-AppBuilder)- Simple and rapid
application development framework that includes
detailed security, auto CRUD generation for your
models, Google charts, and much
more.[flask-base](http://hack4impact.github.io/flas
k-base/)- Includes SQLAlchemy, Redis, User
Authentication, and
more.[Flask-Bootstrap](https://github.com/esbulling
ton/flask-bootstrap)- Integrated SQLAlchemy,
authentication, and Bootstrap
frontend.[flask-htmx-boilerplate](https://github.co
m/marcusschiesser/flask-htmx-boilerplate)-
Boilerplate template for a Python Flask application
with HTMX and Tailwind
CSS.[uwsgi-nginx-flask-docker](https://github.com/t
iangolo/uwsgi-nginx-flask-docker)- Docker image
with uWSGI and Nginx for Flask applications in
Python running in a single
container.[React-Redux-Flask](https://github.com/dt
ernyak/React-Redux-Flask)- Boilerplate application
for a Flask JWT Backend and a React/Redux Front-End
with Material UI.[MVC
Flask](https://github.com/marcuxyz/mvc-flask)- You
can use the mvc pattern in your flask application
using this extension.
[ActorCloud](https://github.com/actorcloud/ActorClo
ud)- Open-source IoT
Platform.[Airflow](https://github.com/apache/airflo
w/tree/master/airflow/www)[Busy
Beaver](https://github.com/busy-beaver-dev/busy-bea
ver)- Chicago Python's Community Engagement Slack
bot.[FlaskBB](https://github.com/flaskbb/flaskbb)-
Classic forum
software.[Indico](https://github.com/indico/indico)
- Feature-rich event management system, made
at[CERN](https://home.cern/).[Quokka
CMS](https://github.com/quokkaproject)- The
happiest CMS in the
world.[PythonBuddy](https://github.com/ethanchewy/P
ythonBuddy)- Online Python Editor with live syntax
checking and
execution.[Redash](https://github.com/getredash/red
ash)- Designed to enable anyone, regardless of the
level of technical sophistication, to harness the
power of data big and
small.[SkyLines](https://github.com/skylines-projec
t/skylines)- Live tracking, flight database, and
competition framework.[Security
Monkey](https://github.com/Netflix/security_monkey)
- Monitors AWS, GCP, OpenStack, and GitHub orgs for
assets and their changes over
time.[SecureDrop](https://github.com/freedomofpress
/securedrop)- Open-source whistleblower submission
system that media organizations can use to securely
accept documents from, and communicate with
anonymous
sources.[SimpleLogin](https://github.com/simple-log
in/app)- Protect your online identity with email
alias.[sr.ht](https://git.sr.ht/~sircmpwn/core.sr.h
t/tree)- Git hosting service (check out[Why I chose
Flask to build sr.ht's
mini-services](https://drewdevault.com/2019/01/30/W
hy-I-built-sr.ht-with-Flask.html)as
well).[Timesketch](https://github.com/google/timesk
etch)- Collaborative forensic timeline analysis.
NOTE: This project is powered by
[TestDriven.io]. Please support this open source
project by purchasing one of our Flask courses.
Learn how to build, test, and deploy microservices
powered by Docker, Flask, and React!
[03/13/25 21:09:16] INFO Subtask a01d474682634561b5921a01a419f179
Response: FastAPI framework, high performance, easy
to learn, fast to code, ready for production
Documentation:
[https://fastapi.tiangolo.com](https://fastapi.tian
golo.com)
Source Code:
[https://github.com/fastapi/fastapi](https://github
.com/fastapi/fastapi)
FastAPI is a modern, fast (high-performance), web
framework for building APIs with Python based on
standard Python type hints.
The key features are:
- Fast: Very high performance, on par with NodeJS
and Go (thanks to Starlette and Pydantic).
[One of the fastest Python frameworks
available](#performance). - Fast to code: Increase
the speed to develop features by about 200% to
300%. *
- Fewer bugs: Reduce about 40% of human (developer)
induced errors. *
- Intuitive: Great editor support. Completion
everywhere. Less time debugging.
- Easy: Designed to be easy to use and learn. Less
time reading docs.
- Short: Minimize code duplication. Multiple
features from each parameter declaration. Fewer
bugs.
- Robust: Get production-ready code. With automatic
interactive documentation.
- Standards-based: Based on (and fully compatible
with) the open standards for APIs:
[OpenAPI](https://github.com/OAI/OpenAPI-Specificat
ion)(previously known as Swagger) and[JSON
Schema](https://json-schema.org/).
* estimation based on tests on an internal
development team, building production applications.
"[...] I'm using FastAPI a ton these days. [...]
I'm actually planning to use it for all of my
team's ML services at Microsoft. Some of them are
getting integrated into the core Windows product
and some Office products."
[(ref)](https://github.com/fastapi/fastapi/pull/26)
"We adopted the FastAPI library to spawn a REST
server that can be queried to obtain predictions.
[for Ludwig]"
[(ref)](https://eng.uber.com/ludwig-v0-2/)
"Netflix is pleased to announce the open-source
release of our crisis management orchestration
framework: Dispatch! [built with FastAPI]"
[(ref)](https://netflixtechblog.com/introducing-dis
patch-da4b8a2a8072)
"I’m over the moon excited about FastAPI. It’s so
fun!"
[Python
Bytes](https://pythonbytes.fm/episodes/show/123/tim
e-to-right-the-py-wrongs?time_in_sec=855)podcast
host
[(ref)](https://twitter.com/brianokken/status/11122
20079972728832)
"Honestly, what you've built looks super solid and
polished. In many ways, it's what I wanted Hug to
be - it's really inspiring to see someone build
that."
"If you're looking to learn one modern framework
for building REST APIs, check out FastAPI [...]
It's fast, easy to use and easy to learn [...]"
"We've switched over to FastAPI for our APIs [...]
I think you'll like it [...]"
"If anyone is looking to build a production Python
API, I would highly recommend FastAPI. It is
beautifully designed, simple to use and highly
scalable, it has become a key component in our API
first development strategy and is driving many
automations and services such as our Virtual TAC
Engineer."
[(ref)](https://www.linkedin.com/posts/deonpillsbur
y_cisco-cx-python-activity-6963242628536487936-trAp
/)
If you are building a CLI app to be used in the
terminal instead of a web API, check out
[Typer](https://typer.tiangolo.com/).
Typer is FastAPI's little sibling. And it's
intended to be the FastAPI of CLIs. ⌨️ 🚀
FastAPI stands on the shoulders of giants:
Create and activate a [virtual
environment](https://fastapi.tiangolo.com/virtual-e
nvironments/) and then install FastAPI:
$ pip install "fastapi[standard]"
---> 100%
Note: Make sure you put "fastapi[standard]"
in quotes to ensure it works in all terminals.
- Create a file
main.py
with:
from typing import Union
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Union[str, None] =
None):
return {"item_id": item_id, "q": q}
Or use async def
...
If your code uses async
/ await
, use async def
:
from typing import Union
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Union[str,
None] = None):
return {"item_id": item_id, "q": q}
Note:
If you don't know, check the "In a hurry?" section
about [ async and await in the
docs](https://fastapi.tiangolo.com/async/#in-a-hurr
y).
Run the server with:
$ fastapi dev main.py
╭────────── FastAPI CLI - Development mode
───────────╮
│ │
│ Serving at: http://127.0.0.1:8000 │
│ │
│ API docs: http://127.0.0.1:8000/docs │
│ │
│ Running in development mode, for production use:
│
│ │
│ fastapi run │
│ │
╰──────────────────────────────────────────────────
───╯
INFO: Will watch for changes in these directories:
['/home/user/code/awesomeapp']
INFO: Uvicorn running on http://127.0.0.1:8000
(Press CTRL+C to quit)
INFO: Started reloader process [2248755] using
WatchFiles
INFO: Started server process [2248757]
INFO: Waiting for application startup.
INFO: Application startup complete.
About the command fastapi dev main.py
...
The command fastapi dev
reads your main.py
file, detects the FastAPI app in it, and starts a
server using [Uvicorn](https://www.uvicorn.org).
By default, fastapi dev
will start with auto-reload enabled for local
development.
You can read more about it in the [FastAPI CLI
docs](https://fastapi.tiangolo.com/fastapi-cli/).
Open your browser at
[http://127.0.0.1:8000/items/5?q=somequery](http://
127.0.0.1:8000/items/5?q=somequery).
You will see the JSON response as:
{"item_id": 5, "q": "somequery"}
You already created an API that:
- Receives HTTP requests in the paths
/
and/items/{item_id}
. - Both paths take
GET
operations (also known as HTTP methods). - The path
/items/{item_id}
has a path parameteritem_id
that should be anint
. - The path
/items/{item_id}
has an optionalstr
query parameterq
.
Now go to
[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/
docs).
You will see the automatic interactive API
documentation (provided by [Swagger
UI](https://github.com/swagger-api/swagger-ui)):
And now, go to
[http://127.0.0.1:8000/redoc](http://127.0.0.1:8000
/redoc).
You will see the alternative automatic
documentation (provided by
[ReDoc](https://github.com/Rebilly/ReDoc)):
Now modify the file main.py
to receive a body from a PUT
request.
Declare the body using standard Python types,
thanks to Pydantic.
from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
is_offer: Union[bool, None] = None
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Union[str, None] =
None):
return {"item_id": item_id, "q": q}
@app.put("/items/{item_id}")
def update_item(item_id: int, item: Item):
return {"item_name": item.name, "item_id": item_id}
The fastapi dev
server should reload automatically.
Now go to
[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/
docs).
- The interactive API documentation will be
automatically updated, including the new body:
- Click on the button "Try it out", it allows you
to fill the parameters and directly interact with
the API:
- Then click on the "Execute" button, the user
interface will communicate with your API, send the
parameters, get the results and show them on the
screen:
And now, go to
[http://127.0.0.1:8000/redoc](http://127.0.0.1:8000
/redoc).
- The alternative documentation will also reflect
the new query parameter and body:
In summary, you declare once the types of
parameters, body, etc. as function parameters.
You do that with standard modern Python types.
You don't have to learn a new syntax, the methods
or classes of a specific library, etc.
Just standard Python.
For example, for an int
:
item_id: int
or for a more complex Item
model:
item: Item
...and with that single declaration you get:
- Editor support, including:
- Completion.
- Type checks.
- Validation of data:
- Automatic and clear errors when the data is
invalid.
- Validation even for deeply nested JSON objects.
- Conversion of input data: coming from the network
to Python data and types. Reading from:
- JSON.
- Path parameters.
- Query parameters.
- Cookies.
- Headers.
- Forms.
- Files.
- Conversion of output data: converting from Python
data and types to network data (as JSON):
- Convert Python types (
str
,int
,float
,bool
,list
, etc). datetime
objects.UUID
objects.- Database models.
- ...and many more.
- Convert Python types (
- Automatic interactive API documentation,
including 2 alternative user interfaces:
- Swagger UI.
- ReDoc.
Coming back to the previous code example, FastAPI
will:
- Validate that there is an
item_id
in the path forGET
andPUT
requests. - Validate that the
item_id
is of typeint
forGET
andPUT
requests.- If it is not, the client will see a
useful, clear error.
- Check if there is an optional query parameter
named
q
(as inhttp://127.0.0.1:8000/items/foo?q=somequery
) forGET
requests.- As the
q
parameter is declared with= None
, it is optional. - Without the
None
it would be required (as is the body in the case
withPUT
).
- As the
- For
PUT
requests to/items/{item_id}
, read the body as JSON:- Check that it has a
required attribute
name
that should be astr
. - Check that it has a required attribute
price
that has to be afloat
. - Check that it has an optional attribute
is_offer
, that should be abool
, if present. - All this would also work for deeply
nested JSON objects.
- Check that it has a required attribute
- Convert from and to JSON automatically.
- Document everything with OpenAPI, that can be
used by:
- Interactive documentation systems.
- Automatic client code generation systems, for
many languages.
- Provide 2 interactive documentation web
interfaces directly.
We just scratched the surface, but you already get
the idea of how it all works.
Try changing the line with:
return {"item_name": item.name, "item_id": item_id}
...from:
... "item_name": item.name ...
...to:
... "item_price": item.price ...
...and see how your editor will auto-complete the
attributes and know their types:
For a more complete example including more
features, see the [Tutorial - User
Guide](https://fastapi.tiangolo.com/tutorial/).
Spoiler alert: the tutorial - user guide includes:
- Declaration of parameters from other different
places as: headers, cookies, form fields and files.
- How to set validation constraints as
maximum_length
orregex
. - A very powerful and easy to use Dependency
Injection system.
- Security and authentication, including support
for OAuth2 with JWT tokens and HTTP Basic auth.
- More advanced (but equally easy) techniques for
declaring deeply nested JSON models (thanks to
Pydantic).
- GraphQL integration with
[Strawberry](https://strawberry.rocks)and other
libraries. - Many extra features (thanks to
Starlette) as:
- WebSockets
- extremely easy tests based on HTTPX and
pytest
- CORS
- Cookie Sessions
- ...and more.
Independent TechEmpower benchmarks show FastAPI
applications running under Uvicorn as [one of the
fastest Python frameworks
available](https://www.techempower.com/benchmarks/#
section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e8
5911&hw=ph&test=query&l=zijzen-7), only below
Starlette and Uvicorn themselves (used internally
by FastAPI). (*)
To understand more about it, see the section
[Benchmarks](https://fastapi.tiangolo.com/benchmark
s/).
FastAPI depends on Pydantic and Starlette.
When you install FastAPI with pip install
"fastapi[standard]"
it comes with the standard
group of optional dependencies:
Used by Pydantic:
- for email validation.email-validator
Used by Starlette:
- Required if you want to use thehttpx
TestClient
.- Required if you want to use the default template
configuration.jinja2
- Required if you want to support form "parsing",
withpython-multipart
request.form()
.
Used by FastAPI / Starlette:
- for the server that loads and serves your
application. This includesuvicorn
uvicorn[standard]
, which includes some dependencies (e.g.uvloop
) needed for high performance serving.fastapi-cli
- to provide thefastapi
command.
If you don't want to include the standard
optional dependencies, you can install with pip
install fastapi
instead of pip install "fastapi[standard]"
.
There are some additional dependencies you might
want to install.
Additional optional Pydantic dependencies:
- for settings management.pydantic-settings
- for extra types to be used with
Pydantic.pydantic-extra-types
Additional optional FastAPI dependencies:
- Required if you want to useorjson
ORJSONResponse
.- Required if you want to useujson
UJSONResponse
.
This project is licensed under the terms of the MIT
license.
[03/13/25 21:09:17] INFO PromptTask project-research-django
Output: {"answer":"Django is a high-level Python
web framework that promotes rapid development and
clean, pragmatic design. It is free and open
source, built by experienced developers to handle
much of the hassle of web development, allowing
developers to focus on writing their applications
without needing to reinvent the wheel. Django is
known for being fast, secure, and scalable, making
it suitable for both small and large-scale
applications.","key_features":[{"name":"Rapid
Development","description":"Django is designed to
help developers take applications from concept to
completion as quickly as
possible.","emoji":"⚡"},{"name":"Security","descri
ption":"Django takes security seriously and helps
developers avoid many common security
mistakes.","emoji":"🔒"},{"name":"Scalability","des
cription":"Django can handle the demands of the
busiest sites on the web, offering flexibility and
scalability.","emoji":"📈"}]}
[03/13/25 21:09:19] INFO PromptTask project-research-litestar
Output: {"answer":"Litestar is an open-source ASGI
framework designed for building APIs with a focus
on high performance, flexibility, and ease of use.
It offers features such as data validation and
parsing, dependency injection, ORM integration, and
authorization primitives. Litestar supports both
function-based and class-based route handlers, and
it is rigorously typed to ensure data validation
and OpenAPI spec generation. The framework includes
a plugin system for extending its capabilities,
built-in middleware for common web application
needs, and a simple yet powerful dependency
injection system. Litestar is known for its speed,
being on par with or faster than comparable ASGI
frameworks. It is actively maintained and open to
contributions from the
community.","key_features":[{"name":"High
Performance","description":"Litestar is designed to
be fast, with performance benchmarks showing it is
on par with or faster than other ASGI
frameworks.","emoji":"⚡"},{"name":"Flexible and
Opinionated","description":"While offering
flexibility, Litestar provides opinionated defaults
to streamline API
development.","emoji":"🔧"},{"name":"Comprehensive
Feature Set","description":"Includes data
validation, dependency injection, ORM integration,
authorization, and
more.","emoji":"🛠️"},{"name":"Plugin
System","description":"Allows users to extend
serialization/deserialization, OpenAPI generation,
and other
features.","emoji":"🔌"},{"name":"Rigorously
Typed","description":"Enforces typing to ensure
data validation and OpenAPI spec
generation.","emoji":"📏"},{"name":"Community and
Contributions","description":"Open to contributions
and supported by a community of developers and
sponsors.","emoji":"🤝"}]}
[03/13/25 21:09:21] INFO PromptTask project-research-fastapi
Output: {"answer":"FastAPI is a modern,
high-performance web framework for building APIs
with Python. It is designed to be easy to use and
learn, leveraging standard Python type hints to
provide a fast and efficient development
experience. FastAPI is known for its speed,
comparable to NodeJS and Go, and is built on top of
Starlette and Pydantic, which contribute to its
performance and data validation
capabilities.\n\nFastAPI is particularly
appreciated for its automatic generation of
interactive API documentation, which is provided
through Swagger UI and ReDoc. This feature, along
with its intuitive design and robust
standards-based approach, makes it a popular choice
for developers looking to build production-ready
APIs quickly and with fewer bugs.\n\nThe framework
supports asynchronous programming, making it
suitable for handling high-concurrency scenarios.
It also integrates well with modern Python features
and libraries, offering a comprehensive solution
for API development.\n\nFastAPI is used by many
organizations, including Microsoft and Netflix, for
building scalable and efficient APIs. It is
open-source and licensed under the MIT license,
allowing for wide adoption and contribution from
the community.","key_features":[{"name":"High
Performance","description":"FastAPI offers very
high performance, comparable to NodeJS and Go,
making it one of the fastest Python frameworks
available.","emoji":"⚡"},{"name":"Ease of
Use","description":"Designed to be easy to use and
learn, FastAPI reduces the time spent reading
documentation and
debugging.","emoji":"🧩"},{"name":"Automatic
Documentation","description":"Provides automatic
interactive API documentation with Swagger UI and
ReDoc, enhancing developer
experience.","emoji":"📄"},{"name":"Standards-Based
","description":"Fully compatible with open
standards for APIs, including OpenAPI and JSON
Schema.","emoji":"📏"},{"name":"Asynchronous
Support","description":"Supports asynchronous
programming, allowing for high-concurrency
handling.","emoji":"🔄"},{"name":"Robust and
Production-Ready","description":"Offers
production-ready code with features like automatic
validation and error handling.","emoji":"🏗️"}]}
INFO PromptTask project-research-flask
Output: {"answer":"Flask is a lightweight WSGI web
application framework written in Python. It is
designed to make getting started quick and easy,
with the ability to scale up to complex
applications. Flask is considered a microframework
because it does not require particular tools or
libraries. It has no database abstraction layer,
form validation, or any other components where
pre-existing third-party libraries provide common
functions. However, Flask supports extensions that
can add application features as if they were
implemented in Flask itself. Extensions exist for
object-relational mappers, form validation, upload
handling, various open authentication technologies,
and several common framework-related
tools.","key_features":[{"name":"Flask-Admin","desc
ription":"Functional admin panel that provides a
user interface for managing data based on your
models.","emoji":"🛠️"},{"name":"Flask-RESTful","desc
ription":"Quickly build RESTful
APIs.","emoji":"🔧"},{"name":"Flask-SQLAlchemy","de
scription":"Support for SQLAlchemy, a SQL toolkit
and
ORM.","emoji":"🗄️"},{"name":"Flask-Login","descripti
on":"Account management and
authentication.","emoji":"🔑"},{"name":"Flask-WTF",
"description":"Integrates Flask with WTForms,
providing CSRF
protection.","emoji":"📝"},{"name":"Flask-Caching",
"description":"Caching support for Flask
applications.","emoji":"⚡"},{"name":"Flask-Mail","
description":"Provides simple email sending
capabilities.","emoji":"📧"},{"name":"Flask-SocketI
O","description":"Socket.IO integration for
real-time
communication.","emoji":"🔌"},{"name":"Flask-Migrat
e","description":"Handles SQLAlchemy database
migrations via
Alembic.","emoji":"🔄"},{"name":"Flask-Babel","desc
ription":"Support for internationalization (i18n)
and localization (l10n).","emoji":"🌍"}]}
Output(
│ answer='Django is a high-level Python web framework that promotes rapid development and clean, pragmatic design. It is free and open source, built by experienced developers to handle much of the hassle of web development, allowing developers to focus on writing their applications without needing to reinvent the wheel. Django is known for being fast, secure, and scalable, making it suitable for both small and large-scale applications.',
│ key_features=[
│ │ Feature(
│ │ │ name='Rapid Development',
│ │ │ description='Django is designed to help developers take applications from concept to completion as quickly as possible.',
│ │ │ emoji='⚡'
│ │ ),
│ │ Feature(
│ │ │ name='Security',
│ │ │ description='Django takes security seriously and helps developers avoid many common security mistakes.',
│ │ │ emoji='🔒'
│ │ ),
│ │ Feature(
│ │ │ name='Scalability',
│ │ │ description='Django can handle the demands of the busiest sites on the web, offering flexibility and scalability.',
│ │ │ emoji='📈'
│ │ )
│ ]
)
Output(
│ answer='Flask is a lightweight WSGI web application framework written in Python. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. Flask is considered a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies, and several common framework-related tools.',
│ key_features=[
│ │ Feature(
│ │ │ name='Flask-Admin',
│ │ │ description='Functional admin panel that provides a user interface for managing data based on your models.',
│ │ │ emoji='🛠️'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-RESTful',
│ │ │ description='Quickly build RESTful APIs.',
│ │ │ emoji='🔧'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-SQLAlchemy',
│ │ │ description='Support for SQLAlchemy, a SQL toolkit and ORM.',
│ │ │ emoji='🗄️'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-Login',
│ │ │ description='Account management and authentication.',
│ │ │ emoji='🔑'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-WTF',
│ │ │ description='Integrates Flask with WTForms, providing CSRF protection.',
│ │ │ emoji='📝'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-Caching',
│ │ │ description='Caching support for Flask applications.',
│ │ │ emoji='⚡'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-Mail',
│ │ │ description='Provides simple email sending capabilities.',
│ │ │ emoji='📧'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-SocketIO',
│ │ │ description='Socket.IO integration for real-time communication.',
│ │ │ emoji='🔌'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-Migrate',
│ │ │ description='Handles SQLAlchemy database migrations via Alembic.',
│ │ │ emoji='🔄'
│ │ ),
│ │ Feature(
│ │ │ name='Flask-Babel',
│ │ │ description='Support for internationalization (i18n) and localization (l10n).',
│ │ │ emoji='🌍'
│ │ )
│ ]
)
Output(
│ answer='FastAPI is a modern, high-performance web framework for building APIs with Python. It is designed to be easy to use and learn, leveraging standard Python type hints to provide a fast and efficient development experience. FastAPI is known for its speed, comparable to NodeJS and Go, and is built on top of Starlette and Pydantic, which contribute to its performance and data validation capabilities.\n\nFastAPI is particularly appreciated for its automatic generation of interactive API documentation, which is provided through Swagger UI and ReDoc. This feature, along with its intuitive design and robust standards-based approach, makes it a popular choice for developers looking to build production-ready APIs quickly and with fewer bugs.\n\nThe framework supports asynchronous programming, making it suitable for handling high-concurrency scenarios. It also integrates well with modern Python features and libraries, offering a comprehensive solution for API development.\n\nFastAPI is used by many organizations, including Microsoft and Netflix, for building scalable and efficient APIs. It is open-source and licensed under the MIT license, allowing for wide adoption and contribution from the community.',
│ key_features=[
│ │ Feature(
│ │ │ name='High Performance',
│ │ │ description='FastAPI offers very high performance, comparable to NodeJS and Go, making it one of the fastest Python frameworks available.',
│ │ │ emoji='⚡'
│ │ ),
│ │ Feature(
│ │ │ name='Ease of Use',
│ │ │ description='Designed to be easy to use and learn, FastAPI reduces the time spent reading documentation and debugging.',
│ │ │ emoji='🧩'
│ │ ),
│ │ Feature(
│ │ │ name='Automatic Documentation',
│ │ │ description='Provides automatic interactive API documentation with Swagger UI and ReDoc, enhancing developer experience.',
│ │ │ emoji='📄'
│ │ ),
│ │ Feature(
│ │ │ name='Standards-Based',
│ │ │ description='Fully compatible with open standards for APIs, including OpenAPI and JSON Schema.',
│ │ │ emoji='📏'
│ │ ),
│ │ Feature(
│ │ │ name='Asynchronous Support',
│ │ │ description='Supports asynchronous programming, allowing for high-concurrency handling.',
│ │ │ emoji='🔄'
│ │ ),
│ │ Feature(
│ │ │ name='Robust and Production-Ready',
│ │ │ description='Offers production-ready code with features like automatic validation and error handling.',
│ │ │ emoji='🏗️'
│ │ )
│ ]
)
Output(
│ answer='Litestar is an open-source ASGI framework designed for building APIs with a focus on high performance, flexibility, and ease of use. It offers features such as data validation and parsing, dependency injection, ORM integration, and authorization primitives. Litestar supports both function-based and class-based route handlers, and it is rigorously typed to ensure data validation and OpenAPI spec generation. The framework includes a plugin system for extending its capabilities, built-in middleware for common web application needs, and a simple yet powerful dependency injection system. Litestar is known for its speed, being on par with or faster than comparable ASGI frameworks. It is actively maintained and open to contributions from the community.',
│ key_features=[
│ │ Feature(
│ │ │ name='High Performance',
│ │ │ description='Litestar is designed to be fast, with performance benchmarks showing it is on par with or faster than other ASGI frameworks.',
│ │ │ emoji='⚡'
│ │ ),
│ │ Feature(
│ │ │ name='Flexible and Opinionated',
│ │ │ description='While offering flexibility, Litestar provides opinionated defaults to streamline API development.',
│ │ │ emoji='🔧'
│ │ ),
│ │ Feature(
│ │ │ name='Comprehensive Feature Set',
│ │ │ description='Includes data validation, dependency injection, ORM integration, authorization, and more.',
│ │ │ emoji='🛠️'
│ │ ),
│ │ Feature(
│ │ │ name='Plugin System',
│ │ │ description='Allows users to extend serialization/deserialization, OpenAPI generation, and other features.',
│ │ │ emoji='🔌'
│ │ ),
│ │ Feature(
│ │ │ name='Rigorously Typed',
│ │ │ description='Enforces typing to ensure data validation and OpenAPI spec generation.',
│ │ │ emoji='📏'
│ │ ),
│ │ Feature(
│ │ │ name='Community and Contributions',
│ │ │ description='Open to contributions and supported by a community of developers and sponsors.',
│ │ │ emoji='🤝'
│ │ )
│ ]
)
Warning
Unlike PromptTask.run()
, calling Workflow.run()
returns the Workflow
instance itself. To see final results, use Workflow.output
.
Info
Rulesets applied to a Structure are inherited by all child Tasks.
Note
Notice that we've removed the explicit Conversation Memory setup. Structures automatically handle memory for their child Tasks.
A Workflow
can handle complex branching and merging of Tasks. Next, we’ll look at automatically summarizing large amounts of text with minimal code changes.
Info
Much of Griptape's current documentation uses Structures. In particular, the Agent
Structure.
We are in the process of updating the documentation to include more Task-centric examples.
Until then, know that an Agent
is nothing more than a Structure with a single Task, usually a PromptTask
.
Engines
Griptape’s Engines provide higher-level patterns for common generative AI tasks. A typical example is summarizing text that may exceed the LLM’s input limits. Griptape’s PromptSummaryEngine automatically chunks text and merges the partial summaries into a final result.
Question
Couldn’t we just feed all the text into the LLM and say “summarize”?
Yes, but LLMs have a token limit. PromptSummaryEngine
helps you handle text that goes beyond that limit by processing it in smaller parts.
The role of an Engine is to provide you with a higher-level abstraction that simplifies common tasks (summary, RAG, evals, extraction).
Directly Using PromptSummaryEngine
Engines can be used standalone or integrated into Tasks. To illustrate, let’s summarize the outputs of our Workflow:
from pydantic import BaseModel
from griptape.artifacts import ListArtifact
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.drivers.web_search.duck_duck_go import DuckDuckGoWebSearchDriver
from griptape.engines import PromptSummaryEngine
from griptape.rules import Rule, Ruleset
from griptape.structures import Workflow
from griptape.tasks import PromptTask
from griptape.tools import WebScraperTool, WebSearchTool
class Feature(BaseModel):
name: str
description: str
emoji: str
class Output(BaseModel):
answer: str
key_features: list[Feature]
projects = ["django", "flask", "fastapi", "litestar"]
workflow = Workflow(
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
Rule("You run 'Oswald's Open Source', a company for helping people learn about open source."),
],
),
],
)
prompt_driver = OpenAiChatPromptDriver(model="gpt-4o")
for project in projects:
task = PromptTask(
id=f"project-research-{project}",
input="Tell me about the open source project: {{ project }}.",
prompt_driver=prompt_driver,
context={"project": project},
output_schema=Output,
tools=[
WebSearchTool(
web_search_driver=DuckDuckGoWebSearchDriver(),
),
WebScraperTool(),
],
)
workflow.add_tasks(task)
workflow.run()
summary_engine = PromptSummaryEngine()
summary = summary_engine.summarize_artifacts(ListArtifact(workflow.outputs))
print(summary.value)
[03/13/25 21:09:27] INFO PromptTask project-research-django
Input: Tell me about the open source project:
django.
INFO PromptTask project-research-flask
Input: Tell me about the open source project:
flask.
INFO PromptTask project-research-fastapi
Input: Tell me about the open source project:
fastapi.
INFO PromptTask project-research-litestar
Input: Tell me about the open source project:
litestar.
[03/13/25 21:09:29] INFO Subtask 15a3ea6372104691931a18ee1155678e
Actions: [
{
"tag": "call_aney01U95SEICXc4zemOJE9o",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "FastAPI open source project"
}
}
}
]
INFO Subtask f6cccfbd06344588bf2ab67d54890cbe
Actions: [
{
"tag": "call_t0VM6VrBEkgcAi5raINYBQ0r",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "litestar open source project"
}
}
}
]
INFO Subtask 429f11b95312448e8df5661f964d0a8a
Actions: [
{
"tag": "call_wAeD3ImXkIbRBA6jUzB1g4RH",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "Django open source project"
}
}
}
]
INFO Subtask 789b29b164e5499da0617045010f2fd6
Actions: [
{
"tag": "call_Kf1C77H0dcQRJh6g7zIW6wfK",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "Flask open source project"
}
}
}
]
[03/13/25 21:09:30] INFO Subtask f6cccfbd06344588bf2ab67d54890cbe
Response: {"title": "GitHub -
litestar-org/litestar: Production-ready, Light,
Flexible and ...", "url":
"https://github.com/litestar-org/litestar",
"description": "Litestar is an open-source project,
and we enjoy the support of our sponsors to help
fund the exciting work we do. A huge thanks to our
sponsors: Check out our sponsors in the docs. If
you would like to support the work that we do
please consider becoming a sponsor via Polar.sh
(preferred), GitHub or Open Collective."}
{"title": "Litestar - GitHub", "url":
"https://github.com/litestar-org/", "description":
"Litestar is an open-source project, and we enjoy
the support of our sponsors to help fund the
exciting work we do. A huge thanks to our sponsors:
Gold Sponsors. Silver Sponsors. Check out our
sponsors in the docs. If you would like to support
the work that we do please consider becoming a
sponsor on GitHub or Open Collective."}
{"title": "GitHub - litestar-org/awesome-litestar:
A curated list of resources ...", "url":
"https://github.com/litestar-org/awesome-litestar",
"description": "litestar-aiosql - A plugin for the
aiosql database query builder. * litestar-granian -
A plugin for the Granian HTTP server, written in
Rust. * litestar-svcs - A plugin for the SVCS
service locater/dependency injection library. *
litestar-saq-htmx - Proof of concept using SAQ,
Litestar, HTMX, and Server-Sent events for a simple
SAQ job monitor."}
{"title": "litestar - PyPI", "url":
"https://pypi.org/project/litestar/",
"description": "Like all Litestar projects, this
application is open to contributions, big and
small. Sponsors. Litestar is an open-source
project, and we enjoy the support of our sponsors
to help fund the exciting work we do. A huge thanks
to our sponsors: Check out our sponsors in the
docs"}
{"title": "Exploring LiteStar: A Python Framework
for Lightweight Web ... - Medium", "url":
"https://medium.com/@rajputgajanan50/exploring-lite
star-a-python-framework-for-lightweight-web-develop
ment-e3a9749f23de", "description":
"\ud83d\udc49What is LiteStar?. LiteStar is a
Python web framework designed for simplicity and
flexibility. It is open-source and built with the
goal of being easy to learn and use, making it an
excellent ..."}
INFO Subtask 429f11b95312448e8df5661f964d0a8a
Response: {"title": "10 Must-See Django Open-Source
Projects to Inspire Your Next Web App", "url":
"https://medium.com/@luisprooc/10-must-see-django-o
pen-source-projects-to-inspire-your-next-web-app-70
7c963b4a66", "description": "Django Job Portal. One
of the benefits of using this Open Source Project
is the flexibility it offers. With access to the
source code, developers can customize and extend
the platform to meet the ..."}
{"title": "GitHub - wsvincent/awesome-django: A
curated list of awesome things ...", "url":
"https://github.com/wsvincent/awesome-django",
"description": "Zulip - Open-source team chat.
Django-CRM - Open Source Python CRM based on
Django. django-job-portal - Job portal application
using Django. Built with Django - Curated list of
awesome Django projects. PostHog - Open-source
product analytics. HyperKitty - A web interface to
access GNU Mailman v3 archives."}
{"title": "Top 45+ Django Projects with Source Code
for 2025 [Beginners to ...", "url":
"https://www.geeksforgeeks.org/django-projects/",
"description": "Open In App. Next Article: Top 10
Django Projects For Beginners With Source Code.
Python Django Projects with Source Code (Beginners
to Advanced) ... Python Django Projects with Source
Code - Adding a project portfolio to your resume
helps to show your skills and potential to your
recruiter. Because in the tech space, real-time
project ..."}
{"title": "django-project \u00b7 GitHub Topics
\u00b7 GitHub", "url":
"https://github.com/topics/django-project",
"description": "Django Dashboard Black -
Open-source Seed Project | AppSeed. ... A free,
open-source Blog CMS based on the \"Django\" and
\"Editorial\" HTML5 theme. blog cms django html5
podcast skill django-application django-cms
django-project videocast. Updated Mar 6, 2025;
Python;"}
{"title": "The web framework for perfectionists
with deadlines | Django", "url":
"https://www.djangoproject.com/", "description":
"Django is a high-level Python web framework that
encourages rapid development and clean, pragmatic
design. ... It's free and open source. Ridiculously
fast. Django was designed to help developers take
applications from concept to completion as quickly
as possible. ... Our non-profit supports the
project Support Django Your contribution makes
..."}
INFO Subtask 15a3ea6372104691931a18ee1155678e
Response: {"title":
"Kludex/awesome-fastapi-projects - GitHub", "url":
"https://github.com/Kludex/awesome-fastapi-projects
", "description": "Contribute to
Kludex/awesome-fastapi-projects development by
creating an account on GitHub. List of FastAPI
projects! :sunglasses: :rocket: . Contribute to
Kludex/awesome-fastapi-projects development by
creating an account on GitHub. ... Fund open source
developers The ReadME Project. GitHub community
articles Repositories. Topics Trending ..."}
{"title": "GitHub - mjhea0/awesome-fastapi: A
curated list of awesome things ...", "url":
"https://github.com/mjhea0/awesome-fastapi",
"description": "Awesome FastAPI Projects -
Organized list of projects that use FastAPI.
Bitcart - Platform for merchants, users and
developers which offers easy setup and use. Bali -
Simplify Cloud Native Microservices development
base on FastAPI and gRPC. Bunnybook - A tiny social
network built with FastAPI, React+RxJs, Neo4j,
PostgreSQL, and Redis."}
{"title": "Top 23 Fastapi Open-Source Projects -
LibHunt", "url":
"https://www.libhunt.com/topic/fastapi",
"description": "Which are the best open-source
Fastapi projects? This list will help you: fastapi,
full-stack-fastapi-template, Hello-Python, serve,
sqlmodel, HivisionIDPhotos, and
Douyin_TikTok_Download_API. LibHunt. Popularity
Index Add a project About. Fastapi. Open-source
projects categorized as Fastapi"}
{"title": "GitHub - fastapi/fastapi: FastAPI
framework, high performance, easy to ...", "url":
"https://github.com/FastAPI/FastAPI",
"description": "When you install FastAPI with pip
install \"fastapi[standard]\" it comes with the
standard group of optional dependencies:. Used by
Pydantic: email-validator - for email validation.;
Used by Starlette: httpx - Required if you want to
use the TestClient.; jinja2 - Required if you want
to use the default template configuration.;
python-multipart - Required if you want to support
form \"parsing ..."}
{"title": "Exploring the Best Open-Source FastAPI
Projects for Developers", "url":
"https://medium.com/@rameshkannanyt0078/exploring-t
he-best-open-source-fastapi-projects-for-developers
-fb8e738de6e2", "description": "Top Open-Source
FastAPI Projects You Should Know 1. FastAPI
(Official Repository) \ud83d\udccc The foundation
of all FastAPI projects The official FastAPI
repository is the ultimate resource for ..."}
INFO Subtask 789b29b164e5499da0617045010f2fd6
Response: {"title": "Python Flask Projects with
Source Code (Beginners to Advanced)", "url":
"https://www.geeksforgeeks.org/flask-projects/",
"description": "Deploying Flask Projects. Once you
have completed your Flask project, you'll want to
deploy it for the world to see. Consider the
following deployment options: Deployment Options.
Heroku: A cloud platform that simplifies the
deployment process. PythonAnywhere: A hosting
service specifically designed for Python web
applications."}
{"title": "Awesome Flask - GitHub", "url":
"https://github.com/mjhea0/awesome-flask",
"description": "Connexion - Open source,
OpenAPI-based, REST framework built on top of
Flask. Flasgger - OpenAPI and Swagger UI. Builds
the API from Flasgger models, marshmallow models,
dicts, or YAML files. ... Please support this open
source project by purchasing one of our Flask
courses. Learn how to build, test, and deploy
microservices powered by Docker ..."}
{"title": "Top 23 Flask Open-Source Projects -
LibHunt", "url":
"https://www.libhunt.com/topic/flask",
"description": "For Flask, the Flask Mega-Tutorial
has a free online version. There are also two
courses over at TestDriven.io worth recommending:
TDD with Python, Flask and Docker and
Authentication with Flask, React, and Docker. If
you prefer video, there are many Flask courses on
Udemy but the best video course I've seen is Build
a SaaS App with Flask and ..."}
{"title": "10+ Top Python Flask Projects in 2025 -
with Source Code", "url":
"https://machinelearningprojects.net/flask-projects
/", "description": "Many Flask projects with source
code are part of active open-source communities.
Engaging with these communities allows you to learn
from others, seek advice, and collaborate on
improving existing projects. Steps to Start a Flask
Project Installing Flask. To start a Flask project,
developers need to install Flask using pip, the
Python package ..."}
{"title": "GitHub - pallets/flask: The Python micro
framework for building web ...", "url":
"https://github.com/pallets/flask", "description":
"Flask is a lightweight WSGI web application
framework. It is designed to make getting started
quick and easy, with the ability to scale up to
complex applications. It began as a simple wrapper
around Werkzeug and Jinja, and has become one of
the most popular Python web application
frameworks.. Flask offers suggestions, but doesn't
enforce any dependencies or project layout."}
INFO Subtask df845c8771fd4e90bd456d00c4f1c1a3
Actions: [
{
"tag": "call_Vs5jjf6bcJodlUynN0P9klK7",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url":
"https://github.com/litestar-org/litestar"
}
}
}
]
[03/13/25 21:09:31] INFO Subtask 0b23f89deca94da4815724cc21258692
Actions: [
{
"tag": "call_KZlxsij7iCPsuLACoENmoS5h",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url": "https://github.com/pallets/flask"
}
}
}
]
INFO Subtask b8f2ff64e854456e9686148c189994e2
Actions: [
{
"tag": "call_6qEGMgllTX2RR5sCMlablt1j",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url": "https://www.djangoproject.com/"
}
}
}
]
INFO Subtask 4e2e180ddda94409a916ef05de4d80e8
Actions: [
{
"tag": "call_9pUqlgfrZpI9wjaalmYpR0Fu",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url": "https://github.com/FastAPI/FastAPI"
}
}
}
]
INFO Subtask b8f2ff64e854456e9686148c189994e2
Response: Meet Django
Django is a high-level Python web framework that
encourages rapid development and clean, pragmatic
design. Built by experienced developers, it takes
care of much of the hassle of web development, so
you can focus on writing your app without needing
to reinvent the wheel. It’s free and open source.
- Ridiculously fast.
-
Django was designed to help developers take
applications from concept to completion as quickly
as possible.
- Reassuringly secure.
-
Django takes security seriously and helps
developers avoid many common security mistakes.
- Exceedingly scalable.
-
Some of the busiest sites on the web leverage
Django’s ability to quickly and flexibly scale.
[Learn more about
Django](https://www.djangoproject.com/start/overvie
w/)
Join the Community
[Back to Top](#top)
INFO Subtask df845c8771fd4e90bd456d00c4f1c1a3
Response: Litestar is a powerful, flexible yet
opinionated ASGI framework, focused on building
APIs, and offers high-performance data validation
and parsing, dependency injection, first-class ORM
integration, authorization primitives, and much
more that's needed to get applications up and
running.
Check out the [documentation
📚](https://docs.litestar.dev/) for a detailed
overview of
its features!
Additionally, the [Litestar fullstack
repository](https://github.com/litestar-org/litesta
r-fullstack)
can give you a good impression how a fully fledged
Litestar application may look.
Table of Contents
pip install litestar
from litestar import Litestar, get
@get("/")
def hello_world() -> dict[str, str]:
"""Keeping the tradition alive with hello world."""
return {"hello": "world"}
app = Litestar(route_handlers=[hello_world])
[Class based
controllers](#class-based-controllers)[Dependency
Injection](#dependency-injection)[Layered
Middleware](#middleware)[Plugin
System](#plugin-system-orm-support-and-dtos)[OpenAP
I 3.1 schema generation](#openapi)[Life Cycle
Hooks](#request-life-cycle-hooks)[Route Guards
based Authorization](#route-guards)- Support for
dataclasses
,TypedDict
,[pydantic version 1 and version
2](https://docs.pydantic.dev/latest/),[msgspec](htt
ps://github.com/jcrist/msgspec)and[attrs](https://w
ww.attrs.org/en/stable/) - Layered parameter
declaration
- Support for
[RFC
9457](https://datatracker.ietf.org/doc/html/rfc9457
)standardized "Problem Detail" error responses
[Automatic API documentation
with](#redoc-swagger-ui-and-stoplight-elements-api-
documentation):[Trio](https://trio.readthedocs.io/e
n/stable/)support (built-in,
via[AnyIO](https://anyio.readthedocs.io/))-
Ultra-fast validation, serialization and
deserialization using
[msgspec](https://github.com/jcrist/msgspec) -
SQLAlchemy integration
- Piccolo ORM Support
Pre-built Example Apps
[litestar-hello-world](https://github.com/litestar-
org/litestar-hello-world): A bare-minimum
application setup. Great for testing and POC
work.[litestar-fullstack](https://github.com/litest
ar-org/litestar-fullstack): A reference application
that contains most of the boilerplate required for
a web application. It features a Litestar app
configured with best practices, SQLAlchemy 2.0 and
SAQ, a frontend integrated with Vitejs and Jinja2
templates, Docker, and more. Like all Litestar
projects, this application is open to
contributions, big and small.
Litestar is an open-source project, and we enjoy
the support of our sponsors to help fund the
exciting work we do.
A huge thanks to our sponsors:
[Check out our sponsors in the
docs](https://docs.litestar.dev/dev/#sponsors)
If you would like to support the work that we do
please consider [becoming a
sponsor](https://polar.sh/litestar-org)
via [Polar.sh](https://polar.sh/litestar-org)
(preferred),
[GitHub](https://github.com/sponsors/litestar-org)
or [Open
Collective](https://opencollective.com/litestar).
Also, exclusively with
[Polar](https://polar.sh/litestar-org), you can
engage in pledge-based sponsorships.
While supporting function-based route handlers,
Litestar also supports and promotes python OOP
using class based controllers:
Example for class-based controllers
from typing import List, Optional
from datetime import datetime
from litestar import Controller, get, post, put,
patch, delete
from litestar.dto import DTOData
from pydantic import UUID4
from my_app.models import User, PartialUserDTO
class UserController(Controller):
path = "/users"
@post()
async def create_user(self, data: User) -> User:
...
@get()
async def list_users(self) -> List[User]: ...
@get(path="/{date:int}")
async def list_new_users(self, date: datetime) ->
List[User]: ...
@patch(path="/{user_id:uuid}", dto=PartialUserDTO)
async def partial_update_user(
self, user_id: UUID4, data: DTOData[PartialUserDTO]
) -> User: ...
@put(path="/{user_id:uuid}")
async def update_user(self, user_id: UUID4, data:
User) -> User: ...
@get(path="/{user_name:str}")
async def get_user_by_name(self, user_name: str) ->
Optional[User]: ...
@get(path="/{user_id:uuid}")
async def get_user(self, user_id: UUID4) -> User:
...
@delete(path="/{user_id:uuid}")
async def delete_user(self, user_id: UUID4) ->
None: ...
Litestar is rigorously typed, and it enforces
typing. For example, if you forget to type a return
value for a route handler, an exception will be
raised. The reason for this is that Litestar uses
typing data to generate OpenAPI specs, as well as
to validate and parse data. Thus, typing is
essential to the framework.
Furthermore, Litestar allows extending its support
using plugins.
Litestar has a plugin system that allows the user
to extend serialization/deserialization, OpenAPI
generation, and other features.
It ships with a builtin plugin for SQL Alchemy,
which allows the user to use SQLAlchemy declarative
classes "natively" i.e., as type parameters that
will be serialized/deserialized and to return them
as values from route handlers.
Litestar also supports the programmatic creation of
DTOs with a DTOFactory
class, which also supports the use of
plugins.
Litestar has custom logic to generate OpenAPI 3.1.0
schema, include optional generation of examples
using the
[
polyfactory](https://pypi.org/project/polyfactory/)
library.
Litestar serves the documentation from the
generated OpenAPI schema with:
All these are available and enabled by default.
Litestar has a simple but powerful DI system
inspired by pytest. You can define named
dependencies - sync or async - at different levels
of the application, and then selective use or
overwrite them.
Example for DI
from litestar import Litestar, get
from litestar.di import Provide
async def my_dependency() -> str: ...
@get("/")
async def index(injected: str) -> str:
return injected
app = Litestar([index], dependencies={"injected":
Provide(my_dependency)})
Litestar supports typical ASGI middleware and ships
with middlewares to handle things such as
- CORS
- CSRF
- Rate limiting
- GZip and Brotli compression
- Client- and server-side sessions
Litestar has an authorization mechanism called
guards
, which allows the user to define guard functions
at different
level of the application (app, router, controller
etc.) and validate the request before hitting the
route handler
function.
Example for route guards
from litestar import Litestar, get
from litestar.connection import ASGIConnection
from litestar.handlers.base import BaseRouteHandler
from litestar.exceptions import
NotAuthorizedException
async def is_authorized(connection: ASGIConnection,
handler: BaseRouteHandler) -> None:
# validate authorization
# if not authorized, raise NotAuthorizedException
raise NotAuthorizedException()
@get("/", guards=[is_authorized])
async def index() -> None: ...
app = Litestar([index])
Litestar supports request life cycle hooks,
similarly to Flask - i.e. before_request
and after_request
Litestar is fast. It is on par with, or
significantly faster than comparable ASGI
frameworks.
You can see and run the benchmarks
[here](https://github.com/litestar-org/api-performa
nce-tests),
or read more about it
[here](https://docs.litestar.dev/latest/benchmarks)
in our documentation.
Litestar is open to contributions big and small.
You can always [join our
discord](https://discord.gg/X3FJqy8d2j) server
or [join our
Matrix](https://matrix.to/#/#litestar:matrix.org)
space
to discuss contributions and project maintenance.
For guidelines on how to contribute, please
see [the contribution
guide](/litestar-org/litestar/blob/main/CONTRIBUTIN
G.rst).
Thanks goes to these wonderful people:
[Emoji
Key](https://allcontributors.org/docs/en/emoji-key)
This project follows the
[all-contributors](https://github.com/all-contribut
ors/all-contributors) specification.
Contributions of any kind welcome!
INFO Subtask 0b23f89deca94da4815724cc21258692
Response: Flask is a lightweight
[WSGI](https://wsgi.readthedocs.io/) web
application framework. It is designed
to make getting started quick and easy, with the
ability to scale up to
complex applications. It began as a simple wrapper
around
[Werkzeug](https://werkzeug.palletsprojects.com/)
and [Jinja](https://jinja.palletsprojects.com/),
and has become one of the most popular Python web
application frameworks.
Flask offers suggestions, but doesn't enforce any
dependencies or project layout. It is up to the
developer to choose the tools and libraries they
want to use. There are many extensions provided by
the community that make adding new functionality
easy.
# save this as app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
$ flask run
* Running on http://127.0.0.1:5000/ (Press CTRL+C
to quit)
The Pallets organization develops and supports
Flask and the libraries
it uses. In order to grow the community of
contributors and users, and
allow the maintainers to devote more time to the
projects, [please
donate today](https://palletsprojects.com/donate).
See our [detailed contributing
documentation](https://palletsprojects.com/contribu
ting/) for many ways to
contribute, including reporting issues, requesting
features, asking or answering
questions, and making PRs.
[03/13/25 21:09:32] INFO Subtask 4e2e180ddda94409a916ef05de4d80e8
Response: FastAPI framework, high performance, easy
to learn, fast to code, ready for production
Documentation:
[https://fastapi.tiangolo.com](https://fastapi.tian
golo.com)
Source Code:
[https://github.com/fastapi/fastapi](https://github
.com/fastapi/fastapi)
FastAPI is a modern, fast (high-performance), web
framework for building APIs with Python based on
standard Python type hints.
The key features are:
- Fast: Very high performance, on par with NodeJS
and Go (thanks to Starlette and Pydantic).
[One of the fastest Python frameworks
available](#performance). - Fast to code: Increase
the speed to develop features by about 200% to
300%. *
- Fewer bugs: Reduce about 40% of human (developer)
induced errors. *
- Intuitive: Great editor support. Completion
everywhere. Less time debugging.
- Easy: Designed to be easy to use and learn. Less
time reading docs.
- Short: Minimize code duplication. Multiple
features from each parameter declaration. Fewer
bugs.
- Robust: Get production-ready code. With automatic
interactive documentation.
- Standards-based: Based on (and fully compatible
with) the open standards for APIs:
[OpenAPI](https://github.com/OAI/OpenAPI-Specificat
ion)(previously known as Swagger) and[JSON
Schema](https://json-schema.org/).
* estimation based on tests on an internal
development team, building production applications.
"[...] I'm using FastAPI a ton these days. [...]
I'm actually planning to use it for all of my
team's ML services at Microsoft. Some of them are
getting integrated into the core Windows product
and some Office products."
[(ref)](https://github.com/fastapi/fastapi/pull/26)
"We adopted the FastAPI library to spawn a REST
server that can be queried to obtain predictions.
[for Ludwig]"
[(ref)](https://eng.uber.com/ludwig-v0-2/)
"Netflix is pleased to announce the open-source
release of our crisis management orchestration
framework: Dispatch! [built with FastAPI]"
[(ref)](https://netflixtechblog.com/introducing-dis
patch-da4b8a2a8072)
"I’m over the moon excited about FastAPI. It’s so
fun!"
[Python
Bytes](https://pythonbytes.fm/episodes/show/123/tim
e-to-right-the-py-wrongs?time_in_sec=855)podcast
host
[(ref)](https://twitter.com/brianokken/status/11122
20079972728832)
"Honestly, what you've built looks super solid and
polished. In many ways, it's what I wanted Hug to
be - it's really inspiring to see someone build
that."
"If you're looking to learn one modern framework
for building REST APIs, check out FastAPI [...]
It's fast, easy to use and easy to learn [...]"
"We've switched over to FastAPI for our APIs [...]
I think you'll like it [...]"
"If anyone is looking to build a production Python
API, I would highly recommend FastAPI. It is
beautifully designed, simple to use and highly
scalable, it has become a key component in our API
first development strategy and is driving many
automations and services such as our Virtual TAC
Engineer."
[(ref)](https://www.linkedin.com/posts/deonpillsbur
y_cisco-cx-python-activity-6963242628536487936-trAp
/)
If you are building a CLI app to be used in the
terminal instead of a web API, check out
[Typer](https://typer.tiangolo.com/).
Typer is FastAPI's little sibling. And it's
intended to be the FastAPI of CLIs. ⌨️ 🚀
FastAPI stands on the shoulders of giants:
Create and activate a [virtual
environment](https://fastapi.tiangolo.com/virtual-e
nvironments/) and then install FastAPI:
$ pip install "fastapi[standard]"
---> 100%
Note: Make sure you put "fastapi[standard]"
in quotes to ensure it works in all terminals.
- Create a file
main.py
with:
from typing import Union
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Union[str, None] =
None):
return {"item_id": item_id, "q": q}
Or use async def
...
If your code uses async
/ await
, use async def
:
from typing import Union
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Union[str,
None] = None):
return {"item_id": item_id, "q": q}
Note:
If you don't know, check the "In a hurry?" section
about [ async and await in the
docs](https://fastapi.tiangolo.com/async/#in-a-hurr
y).
Run the server with:
$ fastapi dev main.py
╭────────── FastAPI CLI - Development mode
───────────╮
│ │
│ Serving at: http://127.0.0.1:8000 │
│ │
│ API docs: http://127.0.0.1:8000/docs │
│ │
│ Running in development mode, for production use:
│
│ │
│ fastapi run │
│ │
╰──────────────────────────────────────────────────
───╯
INFO: Will watch for changes in these directories:
['/home/user/code/awesomeapp']
INFO: Uvicorn running on http://127.0.0.1:8000
(Press CTRL+C to quit)
INFO: Started reloader process [2248755] using
WatchFiles
INFO: Started server process [2248757]
INFO: Waiting for application startup.
INFO: Application startup complete.
About the command fastapi dev main.py
...
The command fastapi dev
reads your main.py
file, detects the FastAPI app in it, and starts a
server using [Uvicorn](https://www.uvicorn.org).
By default, fastapi dev
will start with auto-reload enabled for local
development.
You can read more about it in the [FastAPI CLI
docs](https://fastapi.tiangolo.com/fastapi-cli/).
Open your browser at
[http://127.0.0.1:8000/items/5?q=somequery](http://
127.0.0.1:8000/items/5?q=somequery).
You will see the JSON response as:
{"item_id": 5, "q": "somequery"}
You already created an API that:
- Receives HTTP requests in the paths
/
and/items/{item_id}
. - Both paths take
GET
operations (also known as HTTP methods). - The path
/items/{item_id}
has a path parameteritem_id
that should be anint
. - The path
/items/{item_id}
has an optionalstr
query parameterq
.
Now go to
[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/
docs).
You will see the automatic interactive API
documentation (provided by [Swagger
UI](https://github.com/swagger-api/swagger-ui)):
And now, go to
[http://127.0.0.1:8000/redoc](http://127.0.0.1:8000
/redoc).
You will see the alternative automatic
documentation (provided by
[ReDoc](https://github.com/Rebilly/ReDoc)):
Now modify the file main.py
to receive a body from a PUT
request.
Declare the body using standard Python types,
thanks to Pydantic.
from typing import Union
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
is_offer: Union[bool, None] = None
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: Union[str, None] =
None):
return {"item_id": item_id, "q": q}
@app.put("/items/{item_id}")
def update_item(item_id: int, item: Item):
return {"item_name": item.name, "item_id": item_id}
The fastapi dev
server should reload automatically.
Now go to
[http://127.0.0.1:8000/docs](http://127.0.0.1:8000/
docs).
- The interactive API documentation will be
automatically updated, including the new body:
- Click on the button "Try it out", it allows you
to fill the parameters and directly interact with
the API:
- Then click on the "Execute" button, the user
interface will communicate with your API, send the
parameters, get the results and show them on the
screen:
And now, go to
[http://127.0.0.1:8000/redoc](http://127.0.0.1:8000
/redoc).
- The alternative documentation will also reflect
the new query parameter and body:
In summary, you declare once the types of
parameters, body, etc. as function parameters.
You do that with standard modern Python types.
You don't have to learn a new syntax, the methods
or classes of a specific library, etc.
Just standard Python.
For example, for an int
:
item_id: int
or for a more complex Item
model:
item: Item
...and with that single declaration you get:
- Editor support, including:
- Completion.
- Type checks.
- Validation of data:
- Automatic and clear errors when the data is
invalid.
- Validation even for deeply nested JSON objects.
- Conversion of input data: coming from the network
to Python data and types. Reading from:
- JSON.
- Path parameters.
- Query parameters.
- Cookies.
- Headers.
- Forms.
- Files.
- Conversion of output data: converting from Python
data and types to network data (as JSON):
- Convert Python types (
str
,int
,float
,bool
,list
, etc). datetime
objects.UUID
objects.- Database models.
- ...and many more.
- Convert Python types (
- Automatic interactive API documentation,
including 2 alternative user interfaces:
- Swagger UI.
- ReDoc.
Coming back to the previous code example, FastAPI
will:
- Validate that there is an
item_id
in the path forGET
andPUT
requests. - Validate that the
item_id
is of typeint
forGET
andPUT
requests.- If it is not, the client will see a
useful, clear error.
- Check if there is an optional query parameter
named
q
(as inhttp://127.0.0.1:8000/items/foo?q=somequery
) forGET
requests.- As the
q
parameter is declared with= None
, it is optional. - Without the
None
it would be required (as is the body in the case
withPUT
).
- As the
- For
PUT
requests to/items/{item_id}
, read the body as JSON:- Check that it has a
required attribute
name
that should be astr
. - Check that it has a required attribute
price
that has to be afloat
. - Check that it has an optional attribute
is_offer
, that should be abool
, if present. - All this would also work for deeply
nested JSON objects.
- Check that it has a required attribute
- Convert from and to JSON automatically.
- Document everything with OpenAPI, that can be
used by:
- Interactive documentation systems.
- Automatic client code generation systems, for
many languages.
- Provide 2 interactive documentation web
interfaces directly.
We just scratched the surface, but you already get
the idea of how it all works.
Try changing the line with:
return {"item_name": item.name, "item_id": item_id}
...from:
... "item_name": item.name ...
...to:
... "item_price": item.price ...
...and see how your editor will auto-complete the
attributes and know their types:
For a more complete example including more
features, see the [Tutorial - User
Guide](https://fastapi.tiangolo.com/tutorial/).
Spoiler alert: the tutorial - user guide includes:
- Declaration of parameters from other different
places as: headers, cookies, form fields and files.
- How to set validation constraints as
maximum_length
orregex
. - A very powerful and easy to use Dependency
Injection system.
- Security and authentication, including support
for OAuth2 with JWT tokens and HTTP Basic auth.
- More advanced (but equally easy) techniques for
declaring deeply nested JSON models (thanks to
Pydantic).
- GraphQL integration with
[Strawberry](https://strawberry.rocks)and other
libraries. - Many extra features (thanks to
Starlette) as:
- WebSockets
- extremely easy tests based on HTTPX and
pytest
- CORS
- Cookie Sessions
- ...and more.
Independent TechEmpower benchmarks show FastAPI
applications running under Uvicorn as [one of the
fastest Python frameworks
available](https://www.techempower.com/benchmarks/#
section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e8
5911&hw=ph&test=query&l=zijzen-7), only below
Starlette and Uvicorn themselves (used internally
by FastAPI). (*)
To understand more about it, see the section
[Benchmarks](https://fastapi.tiangolo.com/benchmark
s/).
FastAPI depends on Pydantic and Starlette.
When you install FastAPI with pip install
"fastapi[standard]"
it comes with the standard
group of optional dependencies:
Used by Pydantic:
- for email validation.email-validator
Used by Starlette:
- Required if you want to use thehttpx
TestClient
.- Required if you want to use the default template
configuration.jinja2
- Required if you want to support form "parsing",
withpython-multipart
request.form()
.
Used by FastAPI / Starlette:
- for the server that loads and serves your
application. This includesuvicorn
uvicorn[standard]
, which includes some dependencies (e.g.uvloop
) needed for high performance serving.fastapi-cli
- to provide thefastapi
command.
If you don't want to include the standard
optional dependencies, you can install with pip
install fastapi
instead of pip install "fastapi[standard]"
.
There are some additional dependencies you might
want to install.
Additional optional Pydantic dependencies:
- for settings management.pydantic-settings
- for extra types to be used with
Pydantic.pydantic-extra-types
Additional optional FastAPI dependencies:
- Required if you want to useorjson
ORJSONResponse
.- Required if you want to useujson
UJSONResponse
.
This project is licensed under the terms of the MIT
license.
[03/13/25 21:09:34] INFO PromptTask project-research-django
Output: {"answer":"Django is a high-level Python
web framework that promotes rapid development and
clean, pragmatic design. It is built by experienced
developers and is designed to take care of much of
the hassle of web development, allowing developers
to focus on writing their applications without
needing to reinvent the wheel. Django is free and
open source, making it accessible to a wide range
of developers.\n\nKey features of Django include
its speed, security, and scalability. It is
designed to help developers take applications from
concept to completion as quickly as possible, while
also providing robust security features to help
avoid common security mistakes. Additionally,
Django is highly scalable, making it suitable for
some of the busiest sites on the
web.","key_features":[{"name":"Rapid
Development","description":"Django is designed to
help developers take applications from concept to
completion as quickly as
possible.","emoji":"⚡"},{"name":"Security","descri
ption":"Django takes security seriously and helps
developers avoid many common security
mistakes.","emoji":"🔒"},{"name":"Scalability","des
cription":"Django is exceedingly scalable, suitable
for some of the busiest sites on the
web.","emoji":"📈"}]}
[03/13/25 21:09:36] INFO PromptTask project-research-litestar
Output: {"answer":"Litestar is a powerful and
flexible ASGI framework designed for building APIs.
It focuses on high-performance data validation and
parsing, dependency injection, ORM integration, and
authorization primitives. The framework supports
both function-based and class-based route handlers,
and it is rigorously typed to ensure data
validation and OpenAPI spec generation.\n\nLitestar
includes a plugin system for extending
serialization/deserialization and OpenAPI
generation, with built-in support for SQLAlchemy.
It also offers a simple but powerful dependency
injection system inspired by pytest, and supports
typical ASGI middleware for CORS, CSRF, rate
limiting, and more.\n\nThe framework is known for
its speed, being on par with or faster than
comparable ASGI frameworks. It is open to
contributions and supported by a community of
sponsors and contributors. Documentation and
community support are available through various
channels, including Discord and
Matrix.","key_features":[{"name":"High-Performance
Data Handling","description":"Litestar offers
high-performance data validation and parsing,
making it suitable for building efficient
APIs.","emoji":"⚡"},{"name":"Dependency
Injection","description":"The framework includes a
simple but powerful dependency injection system
inspired by pytest, allowing for flexible
application
architecture.","emoji":"🔌"},{"name":"ORM
Integration","description":"Litestar supports
first-class ORM integration, including SQLAlchemy
and Piccolo ORM, for seamless database
interactions.","emoji":"🗄️"},{"name":"Authorization
Primitives","description":"It provides route guards
and authorization mechanisms to secure API
endpoints.","emoji":"🔒"},{"name":"Plugin
System","description":"Litestar has a plugin system
to extend its capabilities, including
serialization/deserialization and OpenAPI
generation.","emoji":"🔧"},{"name":"Fast
Performance","description":"The framework is
designed to be fast, often outperforming other ASGI
frameworks.","emoji":"🚀"},{"name":"Open Source and
Community Driven","description":"Litestar is
open-source and supported by a community of
contributors and sponsors.","emoji":"🌐"}]}
[03/13/25 21:09:37] INFO PromptTask project-research-flask
Output: {"answer":"Flask is a lightweight WSGI web
application framework designed to make getting
started with web development quick and easy, while
also being scalable for more complex applications.
It originated as a simple wrapper around Werkzeug
and Jinja and has grown to become one of the most
popular Python web frameworks. Flask is known for
its simplicity and flexibility, offering
suggestions but not enforcing any dependencies or
project layout. This allows developers to choose
their own tools and libraries. The framework is
supported by the Pallets organization, which also
develops the libraries it uses. Flask has a vibrant
community that contributes extensions to add new
functionalities
easily.","key_features":[{"name":"Lightweight
Framework","description":"Flask is a lightweight
framework that is easy to get started with, making
it ideal for beginners and small
projects.","emoji":"🌟"},{"name":"Scalable","descri
ption":"Despite its simplicity, Flask can scale up
to support complex
applications.","emoji":"📈"},{"name":"Flexibility",
"description":"Flask does not enforce any
dependencies or project layout, allowing developers
to choose their own tools and
libraries.","emoji":"🛠️"},{"name":"Community
Extensions","description":"There are many
community-provided extensions that make adding new
functionality
easy.","emoji":"🔌"},{"name":"Supported by
Pallets","description":"The Pallets organization
develops and supports Flask and its associated
libraries.","emoji":"🤝"}]}
[03/13/25 21:09:39] INFO PromptTask project-research-fastapi
Output: {"answer":"FastAPI is a modern,
high-performance web framework for building APIs
with Python. It is designed to be easy to use and
learn, with a focus on speed and efficiency.
FastAPI leverages standard Python type hints to
provide a robust and intuitive development
experience. It is known for its high performance,
comparable to NodeJS and Go, and is one of the
fastest Python frameworks available. FastAPI is
built on top of Starlette for the web parts and
Pydantic for the data parts, ensuring both speed
and reliability.\n\nFastAPI is widely used in
production environments and is praised for its
automatic interactive API documentation, which is
generated from the code itself. This makes it
easier for developers to understand and use the
APIs. The framework is also standards-based, fully
compatible with OpenAPI and JSON Schema, which
facilitates integration with other systems and
tools.\n\nFastAPI is used by many large companies
and projects, including Microsoft, Uber, and
Netflix, due to its scalability and ease of use. It
is licensed under the MIT license, making it open
and accessible for modification and
distribution.","key_features":[{"name":"High
Performance","description":"FastAPI provides very
high performance, on par with NodeJS and Go, making
it one of the fastest Python frameworks
available.","emoji":"⚡"},{"name":"Ease of
Use","description":"Designed to be easy to use and
learn, FastAPI reduces the time spent reading
documentation and
debugging.","emoji":"🧠"},{"name":"Automatic
Documentation","description":"Generates automatic
interactive API documentation using Swagger UI and
ReDoc, making it easier to understand and use
APIs.","emoji":"📄"},{"name":"Standards-Based","des
cription":"Fully compatible with OpenAPI and JSON
Schema, facilitating integration with other systems
and tools.","emoji":"📏"},{"name":"Robust and
Scalable","description":"Provides production-ready
code with features like automatic validation and
conversion of data, making it suitable for
large-scale applications.","emoji":"🏗️"}]}
The text provides an overview of four popular Python web frameworks: Django, Flask, FastAPI, and Litestar, highlighting their key features and benefits.
1. **Django**: A high-level framework known for rapid development, security, and scalability. It is free, open-source, and helps developers focus on application writing by handling many web development tasks.
2. **Flask**: A lightweight and flexible framework ideal for beginners and small projects. It allows developers to choose their tools and libraries, supported by a vibrant community and the Pallets organization.
3. **FastAPI**: A modern, high-performance framework for building APIs, known for its speed, ease of use, and automatic interactive API documentation. It is standards-based and widely used by large companies due to its scalability.
4. **Litestar**: An ASGI framework focused on high-performance data handling, dependency injection, and ORM integration. It supports both function-based and class-based route handlers and is known for its speed and community-driven development.
Each framework offers unique features, making them suitable for different types of projects and developer preferences.
This produces a concise summary. But one strength of a Workflow is its ability to fan out and converge results. Let’s remove the direct PromptSummaryEngine
usage and use a built-in summary Task instead.
TextSummaryTask
The TextSummaryTask leverages the PromptSummaryEngine
behind the scenes. We’ll have our project-research Tasks converge into one summary Task:
from pydantic import BaseModel
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.drivers.web_search.duck_duck_go import DuckDuckGoWebSearchDriver
from griptape.rules import Rule, Ruleset
from griptape.structures import Workflow
from griptape.tasks import PromptTask, TextSummaryTask
from griptape.tools import WebScraperTool, WebSearchTool
class Feature(BaseModel):
name: str
description: str
emoji: str
class Output(BaseModel):
answer: str
key_features: list[Feature]
projects = ["django", "flask", "fastapi", "litestar"]
workflow = Workflow(
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
Rule("You run 'Oswald's Open Source', a company for helping people learn about open source."),
],
),
],
)
prompt_driver = OpenAiChatPromptDriver(model="gpt-4o")
for project in projects:
task = PromptTask(
id=f"project-research-{project}",
input="Tell me about the open source project: {{ project }}.",
prompt_driver=prompt_driver,
context={"project": project},
output_schema=Output,
tools=[
WebSearchTool(
web_search_driver=DuckDuckGoWebSearchDriver(),
),
WebScraperTool(),
],
child_ids=["summary"],
)
workflow.add_tasks(task)
workflow.add_task(TextSummaryTask(input="{{ parents_output_text }}", id="summary"))
workflow.run()
print(workflow.output)
[03/13/25 21:07:46] INFO PromptTask project-research-django
Input: Tell me about the open source project:
django.
INFO PromptTask project-research-flask
Input: Tell me about the open source project:
flask.
INFO PromptTask project-research-fastapi
Input: Tell me about the open source project:
fastapi.
INFO PromptTask project-research-litestar
Input: Tell me about the open source project:
litestar.
[03/13/25 21:07:48] INFO Subtask 2b7789f5282f4232b669554bf9043105
Actions: [
{
"tag": "call_6ZoNzVy3yQmj1uX22zlBRiDi",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "litestar open source project"
}
}
}
]
INFO Subtask 1583bdc4d4774dc3bb144fcc9963222b
Actions: [
{
"tag": "call_7DDFXL51jKge0wFmMpoA1RVJ",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "FastAPI open source project"
}
}
}
]
INFO Subtask b7b79459549a4c49b96687b91e30d102
Actions: [
{
"tag": "call_Kef5M6OMWG2rPClvq6gCABYc",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "Django open source project"
}
}
}
]
INFO Subtask 34e80f19a6f141488df876d9614f0e34
Actions: [
{
"tag": "call_jDiIXwciqV4tLwdL2C7WgCBh",
"name": "WebSearchTool",
"path": "search",
"input": {
"values": {
"query": "Flask open source project"
}
}
}
]
[03/13/25 21:07:49] INFO Subtask 1583bdc4d4774dc3bb144fcc9963222b
Response: {"title":
"Kludex/awesome-fastapi-projects - GitHub", "url":
"https://github.com/Kludex/awesome-fastapi-projects
", "description": "Contribute to
Kludex/awesome-fastapi-projects development by
creating an account on GitHub. List of FastAPI
projects! :sunglasses: :rocket: . Contribute to
Kludex/awesome-fastapi-projects development by
creating an account on GitHub. ... Fund open source
developers The ReadME Project. GitHub community
articles Repositories. Topics Trending ..."}
{"title": "Top 23 Fastapi Open-Source Projects -
LibHunt", "url":
"https://www.libhunt.com/topic/fastapi",
"description": "Which are the best open-source
Fastapi projects? This list will help you: fastapi,
full-stack-fastapi-template, Hello-Python, serve,
sqlmodel, HivisionIDPhotos, and
Douyin_TikTok_Download_API. LibHunt. Popularity
Index Add a project About. Fastapi. Open-source
projects categorized as Fastapi"}
{"title": "GitHub - mjhea0/awesome-fastapi: A
curated list of awesome things ...", "url":
"https://github.com/mjhea0/awesome-fastapi",
"description": "Awesome FastAPI Projects -
Organized list of projects that use FastAPI.
Bitcart - Platform for merchants, users and
developers which offers easy setup and use. Bali -
Simplify Cloud Native Microservices development
base on FastAPI and gRPC. Bunnybook - A tiny social
network built with FastAPI, React+RxJs, Neo4j,
PostgreSQL, and Redis."}
{"title": "Any open-source project that uses
FastAPI? : r/FastAPI - Reddit", "url":
"https://www.reddit.com/r/FastAPI/comments/n6afvm/a
ny_opensource_project_that_uses_fastapi/",
"description": "Angular is Google's open source
framework for crafting high-quality front-end web
applications. r/Angular2 exists to help spread
news, discuss current developments and help solve
problems. Welcome! Members Online"}
{"title": "fastapi opensource project - DEV
Community", "url":
"https://dev.to/codewitgabi/fastapi-opensource-proj
ect-2205", "description": "There is a quick and
easy was to learn a tool and master it quickly and
that's by building projects. With that in mind, I
decided to start a fastapi open source project that
covers most backend concepts and majority of what
could be found in the official documentation. With
this project, contributors will be able to .
Understand the workflow of ..."}
INFO Subtask 34e80f19a6f141488df876d9614f0e34
Response: {"title": "Python Flask Projects with
Source Code (Beginners to Advanced)", "url":
"https://www.geeksforgeeks.org/flask-projects/",
"description": "Deploying Flask Projects. Once you
have completed your Flask project, you'll want to
deploy it for the world to see. Consider the
following deployment options: Deployment Options.
Heroku: A cloud platform that simplifies the
deployment process. PythonAnywhere: A hosting
service specifically designed for Python web
applications."}
{"title": "10+ Top Python Flask Projects in 2025 -
with Source Code", "url":
"https://machinelearningprojects.net/flask-projects
/", "description": "Many Flask projects with source
code are part of active open-source communities.
Engaging with these communities allows you to learn
from others, seek advice, and collaborate on
improving existing projects. Steps to Start a Flask
Project Installing Flask. To start a Flask project,
developers need to install Flask using pip, the
Python package ..."}
{"title": "Top 23 Flask Open-Source Projects -
LibHunt", "url":
"https://www.libhunt.com/topic/flask",
"description": "For Flask, the Flask Mega-Tutorial
has a free online version. There are also two
courses over at TestDriven.io worth recommending:
TDD with Python, Flask and Docker and
Authentication with Flask, React, and Docker. If
you prefer video, there are many Flask courses on
Udemy but the best video course I've seen is Build
a SaaS App with Flask and ..."}
{"title": "GitHub - pallets/flask: The Python micro
framework for building web ...", "url":
"https://github.com/pallets/flask", "description":
"Flask is a lightweight WSGI web application
framework. It is designed to make getting started
quick and easy, with the ability to scale up to
complex applications. It began as a simple wrapper
around Werkzeug and Jinja, and has become one of
the most popular Python web application
frameworks.. Flask offers suggestions, but doesn't
enforce any dependencies or project layout."}
{"title": "Awesome Flask - GitHub", "url":
"https://github.com/mjhea0/awesome-flask",
"description": "Connexion - Open source,
OpenAPI-based, REST framework built on top of
Flask. Flasgger - OpenAPI and Swagger UI. Builds
the API from Flasgger models, marshmallow models,
dicts, or YAML files. ... Please support this open
source project by purchasing one of our Flask
courses. Learn how to build, test, and deploy
microservices powered by Docker ..."}
INFO Subtask 2b7789f5282f4232b669554bf9043105
Response: {"title": "GitHub -
litestar-org/litestar: Production-ready, Light,
Flexible and ...", "url":
"https://github.com/litestar-org/litestar",
"description": "Litestar is an open-source project,
and we enjoy the support of our sponsors to help
fund the exciting work we do. A huge thanks to our
sponsors: Check out our sponsors in the docs. If
you would like to support the work that we do
please consider becoming a sponsor via Polar.sh
(preferred), GitHub or Open Collective."}
{"title": "Litestar - GitHub", "url":
"https://github.com/litestar-org/", "description":
"Litestar is an open-source project, and we enjoy
the support of our sponsors to help fund the
exciting work we do. A huge thanks to our sponsors:
Gold Sponsors. Silver Sponsors. Check out our
sponsors in the docs. If you would like to support
the work that we do please consider becoming a
sponsor on GitHub or Open Collective."}
{"title": "litestar/README.md at main \u00b7
litestar-org/litestar - GitHub", "url":
"https://github.com/litestar-org/litestar/blob/main
/README.md", "description": "Litestar is an
open-source project, and we enjoy the support of
our sponsors to help fund the exciting work we do.
A huge thanks to our sponsors: Check out our
sponsors in the docs. If you would like to support
the work that we do please consider becoming a
sponsor via Polar.sh (preferred), GitHub or Open
Collective."}
{"title": "litestar - PyPI", "url":
"https://pypi.org/project/litestar/",
"description": "Like all Litestar projects, this
application is open to contributions, big and
small. Sponsors. Litestar is an open-source
project, and we enjoy the support of our sponsors
to help fund the exciting work we do. A huge thanks
to our sponsors: Check out our sponsors in the
docs"}
{"title": "Exploring LiteStar: A Python Framework
for Lightweight Web ... - Medium", "url":
"https://medium.com/@rajputgajanan50/exploring-lite
star-a-python-framework-for-lightweight-web-develop
ment-e3a9749f23de", "description":
"\ud83d\udc49What is LiteStar?. LiteStar is a
Python web framework designed for simplicity and
flexibility. It is open-source and built with the
goal of being easy to learn and use, making it an
excellent ..."}
INFO Subtask b7b79459549a4c49b96687b91e30d102
Response: {"title": "10 Must-See Django Open-Source
Projects to Inspire Your Next Web App", "url":
"https://medium.com/@luisprooc/10-must-see-django-o
pen-source-projects-to-inspire-your-next-web-app-70
7c963b4a66", "description": "Django Job Portal. One
of the benefits of using this Open Source Project
is the flexibility it offers. With access to the
source code, developers can customize and extend
the platform to meet the ..."}
{"title": "GitHub - wsvincent/awesome-django: A
curated list of awesome things ...", "url":
"https://github.com/wsvincent/awesome-django",
"description": "Zulip - Open-source team chat.
Django-CRM - Open Source Python CRM based on
Django. django-job-portal - Job portal application
using Django. Built with Django - Curated list of
awesome Django projects. PostHog - Open-source
product analytics. HyperKitty - A web interface to
access GNU Mailman v3 archives."}
{"title": "django-project \u00b7 GitHub Topics
\u00b7 GitHub", "url":
"https://github.com/topics/django-project",
"description": "Django Dashboard Black -
Open-source Seed Project | AppSeed. ... A free,
open-source Blog CMS based on the \"Django\" and
\"Editorial\" HTML5 theme. blog cms django html5
podcast skill django-application django-cms
django-project videocast. Updated Mar 6, 2025;
Python;"}
{"title": "Top 45+ Django Projects with Source Code
for 2025 [Beginners to ...", "url":
"https://www.geeksforgeeks.org/django-projects/",
"description": "Open In App. Next Article: Top 10
Django Projects For Beginners With Source Code.
Python Django Projects with Source Code (Beginners
to Advanced) ... Python Django Projects with Source
Code - Adding a project portfolio to your resume
helps to show your skills and potential to your
recruiter. Because in the tech space, real-time
project ..."}
{"title": "The web framework for perfectionists
with deadlines | Django", "url":
"https://www.djangoproject.com/", "description":
"Django is a high-level Python web framework that
encourages rapid development and clean, pragmatic
design. ... It's free and open source. Ridiculously
fast. Django was designed to help developers take
applications from concept to completion as quickly
as possible. ... Our non-profit supports the
project Support Django Your contribution makes
..."}
[03/13/25 21:07:51] INFO Subtask d4c6c61effc640b29b46a9eb8d282c4a
Actions: [
{
"tag": "call_ENztKlQLhg4oY2FmupaTPOLp",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url": "https://www.djangoproject.com/"
}
}
}
]
INFO Subtask 9b283ff59c3f41a295711edeca3f8c39
Actions: [
{
"tag": "call_z6KbmCpjEv6KB39ltcrxuKw7",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url":
"https://www.libhunt.com/topic/fastapi"
}
}
}
]
INFO Subtask 0902dedca90e4c35bc1b3c5278d6e93f
Actions: [
{
"tag": "call_41g5XeJ94bCumciahVo35eOd",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url":
"https://github.com/litestar-org/litestar"
}
}
}
]
[03/13/25 21:07:52] INFO Subtask d4c6c61effc640b29b46a9eb8d282c4a
Response: Meet Django
Django is a high-level Python web framework that
encourages rapid development and clean, pragmatic
design. Built by experienced developers, it takes
care of much of the hassle of web development, so
you can focus on writing your app without needing
to reinvent the wheel. It’s free and open source.
- Ridiculously fast.
-
Django was designed to help developers take
applications from concept to completion as quickly
as possible.
- Reassuringly secure.
-
Django takes security seriously and helps
developers avoid many common security mistakes.
- Exceedingly scalable.
-
Some of the busiest sites on the web leverage
Django’s ability to quickly and flexibly scale.
[Learn more about
Django](https://www.djangoproject.com/start/overvie
w/)
Join the Community
[Back to Top](#top)
INFO Subtask 9b283ff59c3f41a295711edeca3f8c39
Response: Revolutionize your code reviews with AI.
CodeRabbit offers PR summaries, code walkthroughs,
1-click suggestions, and AST-based analysis. Boost
productivity and code quality across all major
languages with each PR.[Learn more →]
Top 23 Fastapi Open-Source Projects
-
Last year I wrote a series of articles explaining
how FastAPI works. It was a rewarding experience,
since I was able to both share my knowledge and
learn more about it.
-
[CodeRabbit](https://www.coderabbit.ai/?utm_source=
libhunt&utm_medium=web&utm_campaign=libhunt_dec_24)
CodeRabbit: AI Code Reviews for Developers.
Revolutionize your code reviews with AI. CodeRabbit
offers PR summaries, code walkthroughs, 1-click
suggestions, and AST-based analysis. Boost
productivity and code quality across all major
languages with each PR.
-
[full-stack-fastapi-template](/r/full-stack-fastapi
-template)Full stack, modern web application
template. Using FastAPI, React, SQLModel,
PostgreSQL, Docker, GitHub Actions, automatic HTTPS
and more.
Flask Tutorial:
https://palletsprojects.com/p/flask/ FastAPI
Tutorial:
https://github.com/tiangolo/full-stack-fastapi-temp
late Django REST Framework Tutorial:
https://www.django-rest-framework.org/tutorial/quic
kstart/ Nginx Configuration Guide:
https://docs.nginx.com/nginx/admin-guide/web-server
/web-server/ Confluent Kafka Python Client:
https://docs.confluent.io/platform/current/clients/
api-docs/confluent-kafka-python.html Remember: This
is a high-level overview. Each step involves
further research and configuration based on your
specific requirements.
-
[Hello-Python](/r/Hello-Python)Curso para aprender
el lenguaje de programación Python desde cero y
para principiantes. 100 clases, 44 horas en vídeo,
código, proyectos y grupo de chat. Fundamentos,
frontend, backend, testing, IA...
-
-
Source: https://github.com/fastapi/sqlmodel
-
[HivisionIDPhotos](/r/HivisionIDPhotos)⚡️HivisionID
Photos: a lightweight and efficient AI ID photos
tools. 一个轻量级的AI证件照制作算法。
Project mention: HivisionIDPhotos: A lightweight
and efficient AI ID photos tools
|[news.ycombinator.com](https://news.ycombinator.co
m/item?id=41395289)| 2024-08-29 -
[Douyin_TikTok_Download_API](/r/Douyin_TikTok_Downl
oad_API)🚀「Douyin_TikTok_Download_API」是一个开箱
即用的高性能异步抖音、快手、TikTok、Bilibili数据爬
取工具,支持API调用,在线批量解析及下载。
-
[Nutrient](https://www.nutrient.io/sdk?utm_campaign
=ad2-2025-02-12&utm_source=libhunt&utm_medium=spons
oring)Nutrient – The #1 PDF SDK Library, trusted by
10K+ developers. Other PDF SDKs promise a lot -
then break. Laggy scrolling, poor mobile UX, tons
of bugs, and lack of support cost you endless
frustrations. Nutrient’s SDK handles billion-page
workloads - so you don’t have to debug PDFs. Used
by ~1 billion end users in more than 150 different
countries.
-
Project mention: Ask HN: Company wants us to
upskill in AI. What is the best approach? |
[news.ycombinator.com](https://news.ycombinator.com
/item?id=41204691)| 2024-08-09 -
-
Project mention: Show HN: Web Development with
Htmx, Type-Guided Components, Pure Python |
[news.ycombinator.com](https://news.ycombinator.com
/item?id=40572219)| 2024-06-04How do you compare
withhttps://github.com/pydantic/FastUI (made by the
authors of Pydantic)?
-
[serge](/r/serge)A web interface for chatting with
Alpaca through llama.cpp. Fully dockerized, with an
easy to use API.
-
-
-
Project mention: Running Durable Workflows in
Postgres Using DBOS |
[news.ycombinator.com](https://news.ycombinator.com
/item?id=42379974)| 2024-12-10Disclaimer: I'm a
co-founder of Hatchet
(https://github.com/hatchet-dev/hatchet), which is
a Postgres-backed task queue that supports durable
execution.
> Because a step transition is just a Postgres
write (~1ms) versus an async dispatch from an
external orchestrator (~100ms), it means DBOS is
25x faster than AWS Step Functions
Durable execution engines deployed as an external
orchestrator will always been slower than direct DB
writes, but the 1ms delay versus ~100ms doesn't
seem inherent to the orchestrator being external.
In the case of Hatchet, pushing work takes ~15ms
and invoking the work takes ~1ms if deployed in the
same VPC, and 90% of that execution time is on the
database. In the best-case, the external
orchestrator should take 2x as long to write a step
transition (round-trip network call to the
orchestrator + database write), so an ideal
external orchestrator would be ~2ms of latency
here.
There are also some tradeoffs to a library-only
mode that aren't discussed. How would work that
requires global coordination between workers behave
in this model? Let's say, for example, a global
rate limit -- you'd ideally want to avoid
contention on rate limit rows, assuming they're
stored in Postgres, but each worker attempting to
acquire a rate limit simultaneously would slow down
start time significantly (and place additional load
on the DB). Whereas with a single external
orchestrator (or leader election), you can
significantly increase throughput by acquiring rate
limits as part of a push-based assignment process.
The same problem of coordination arises if many
workers are competing for the same work -- for
example if a machine crashes while doing work, as
described in the article. I'm assuming there's some
kind of polling happening which uses FOR UPDATE
SKIP LOCKED, which concerns me as you start to
scale up the number of workers.
-
-
-
-
https://github.com/poem-web/poem is one Rust
framework with swagger definitions out of the box.
-
Project mention: Farfalle: AI search engine –
self-host with local or cloud LLMs |
[news.ycombinator.com](https://news.ycombinator.com
/item?id=40466851)| 2024-05-24 -
[opyrator](/r/opyrator)🪄 Turns your machine
learning code into microservices with web API,
interactive GUI, and more.
-
[fastapi-admin](/r/fastapi-admin)A fast admin
dashboard based on FastAPI and TortoiseORM with
tabler ui, inspired by Django admin
-
-
[datamodel-code-generator](/r/datamodel-code-genera
tor)Pydantic model and dataclasses.dataclass
generator for easy conversion of JSON, OpenAPI,
JSON Schema, and YAML data sources.
-
[SaaSHub](https://www.saashub.com)SaaSHub -
Software Alternatives and Reviews. SaaSHub helps
you find the best software and product alternatives
Fastapi discussion
Fastapi related posts
-
A Generic Backend for All Your Apps
-
Show HN: Jsonblog-schema – a JSON schema for making
your blog from one file
-
Polar – An open source Merchant of Record
-
I built a word guessing game with LLM
-
LeetCode but You Can Force People to Code in Light
Mode >:)
-
Edge TTS
-
Self-hosted version of Microsoft's OmniParser
Image-to-text model
-
[A note from our sponsor -
CodeRabbit](https://www.coderabbit.ai/?utm_source=l
ibhunt&utm_medium=web&utm_campaign=libhunt_dec_24)c
oderabbit.ai | 13 Mar 2025
Index
What are some of the best open-source Fastapi
projects? This list will help you:
| # | Project | Stars |
|---|---|---|
| 1 |
|
INFO Subtask 0902dedca90e4c35bc1b3c5278d6e93f
Response: Litestar is a powerful, flexible yet
opinionated ASGI framework, focused on building
APIs, and offers high-performance data validation
and parsing, dependency injection, first-class ORM
integration, authorization primitives, and much
more that's needed to get applications up and
running.
Check out the [documentation
📚](https://docs.litestar.dev/) for a detailed
overview of
its features!
Additionally, the [Litestar fullstack
repository](https://github.com/litestar-org/litesta
r-fullstack)
can give you a good impression how a fully fledged
Litestar application may look.
Table of Contents
pip install litestar
from litestar import Litestar, get
@get("/")
def hello_world() -> dict[str, str]:
"""Keeping the tradition alive with hello world."""
return {"hello": "world"}
app = Litestar(route_handlers=[hello_world])
[Class based
controllers](#class-based-controllers)[Dependency
Injection](#dependency-injection)[Layered
Middleware](#middleware)[Plugin
System](#plugin-system-orm-support-and-dtos)[OpenAP
I 3.1 schema generation](#openapi)[Life Cycle
Hooks](#request-life-cycle-hooks)[Route Guards
based Authorization](#route-guards)- Support for
dataclasses
,TypedDict
,[pydantic version 1 and version
2](https://docs.pydantic.dev/latest/),[msgspec](htt
ps://github.com/jcrist/msgspec)and[attrs](https://w
ww.attrs.org/en/stable/) - Layered parameter
declaration
- Support for
[RFC
9457](https://datatracker.ietf.org/doc/html/rfc9457
)standardized "Problem Detail" error responses
[Automatic API documentation
with](#redoc-swagger-ui-and-stoplight-elements-api-
documentation):[Trio](https://trio.readthedocs.io/e
n/stable/)support (built-in,
via[AnyIO](https://anyio.readthedocs.io/))-
Ultra-fast validation, serialization and
deserialization using
[msgspec](https://github.com/jcrist/msgspec) -
SQLAlchemy integration
- Piccolo ORM Support
Pre-built Example Apps
[litestar-hello-world](https://github.com/litestar-
org/litestar-hello-world): A bare-minimum
application setup. Great for testing and POC
work.[litestar-fullstack](https://github.com/litest
ar-org/litestar-fullstack): A reference application
that contains most of the boilerplate required for
a web application. It features a Litestar app
configured with best practices, SQLAlchemy 2.0 and
SAQ, a frontend integrated with Vitejs and Jinja2
templates, Docker, and more. Like all Litestar
projects, this application is open to
contributions, big and small.
Litestar is an open-source project, and we enjoy
the support of our sponsors to help fund the
exciting work we do.
A huge thanks to our sponsors:
[Check out our sponsors in the
docs](https://docs.litestar.dev/dev/#sponsors)
If you would like to support the work that we do
please consider [becoming a
sponsor](https://polar.sh/litestar-org)
via [Polar.sh](https://polar.sh/litestar-org)
(preferred),
[GitHub](https://github.com/sponsors/litestar-org)
or [Open
Collective](https://opencollective.com/litestar).
Also, exclusively with
[Polar](https://polar.sh/litestar-org), you can
engage in pledge-based sponsorships.
While supporting function-based route handlers,
Litestar also supports and promotes python OOP
using class based controllers:
Example for class-based controllers
from typing import List, Optional
from datetime import datetime
from litestar import Controller, get, post, put,
patch, delete
from litestar.dto import DTOData
from pydantic import UUID4
from my_app.models import User, PartialUserDTO
class UserController(Controller):
path = "/users"
@post()
async def create_user(self, data: User) -> User:
...
@get()
async def list_users(self) -> List[User]: ...
@get(path="/{date:int}")
async def list_new_users(self, date: datetime) ->
List[User]: ...
@patch(path="/{user_id:uuid}", dto=PartialUserDTO)
async def partial_update_user(
self, user_id: UUID4, data: DTOData[PartialUserDTO]
) -> User: ...
@put(path="/{user_id:uuid}")
async def update_user(self, user_id: UUID4, data:
User) -> User: ...
@get(path="/{user_name:str}")
async def get_user_by_name(self, user_name: str) ->
Optional[User]: ...
@get(path="/{user_id:uuid}")
async def get_user(self, user_id: UUID4) -> User:
...
@delete(path="/{user_id:uuid}")
async def delete_user(self, user_id: UUID4) ->
None: ...
Litestar is rigorously typed, and it enforces
typing. For example, if you forget to type a return
value for a route handler, an exception will be
raised. The reason for this is that Litestar uses
typing data to generate OpenAPI specs, as well as
to validate and parse data. Thus, typing is
essential to the framework.
Furthermore, Litestar allows extending its support
using plugins.
Litestar has a plugin system that allows the user
to extend serialization/deserialization, OpenAPI
generation, and other features.
It ships with a builtin plugin for SQL Alchemy,
which allows the user to use SQLAlchemy declarative
classes "natively" i.e., as type parameters that
will be serialized/deserialized and to return them
as values from route handlers.
Litestar also supports the programmatic creation of
DTOs with a DTOFactory
class, which also supports the use of
plugins.
Litestar has custom logic to generate OpenAPI 3.1.0
schema, include optional generation of examples
using the
[
polyfactory](https://pypi.org/project/polyfactory/)
library.
Litestar serves the documentation from the
generated OpenAPI schema with:
All these are available and enabled by default.
Litestar has a simple but powerful DI system
inspired by pytest. You can define named
dependencies - sync or async - at different levels
of the application, and then selective use or
overwrite them.
Example for DI
from litestar import Litestar, get
from litestar.di import Provide
async def my_dependency() -> str: ...
@get("/")
async def index(injected: str) -> str:
return injected
app = Litestar([index], dependencies={"injected":
Provide(my_dependency)})
Litestar supports typical ASGI middleware and ships
with middlewares to handle things such as
- CORS
- CSRF
- Rate limiting
- GZip and Brotli compression
- Client- and server-side sessions
Litestar has an authorization mechanism called
guards
, which allows the user to define guard functions
at different
level of the application (app, router, controller
etc.) and validate the request before hitting the
route handler
function.
Example for route guards
from litestar import Litestar, get
from litestar.connection import ASGIConnection
from litestar.handlers.base import BaseRouteHandler
from litestar.exceptions import
NotAuthorizedException
async def is_authorized(connection: ASGIConnection,
handler: BaseRouteHandler) -> None:
# validate authorization
# if not authorized, raise NotAuthorizedException
raise NotAuthorizedException()
@get("/", guards=[is_authorized])
async def index() -> None: ...
app = Litestar([index])
Litestar supports request life cycle hooks,
similarly to Flask - i.e. before_request
and after_request
Litestar is fast. It is on par with, or
significantly faster than comparable ASGI
frameworks.
You can see and run the benchmarks
[here](https://github.com/litestar-org/api-performa
nce-tests),
or read more about it
[here](https://docs.litestar.dev/latest/benchmarks)
in our documentation.
Litestar is open to contributions big and small.
You can always [join our
discord](https://discord.gg/X3FJqy8d2j) server
or [join our
Matrix](https://matrix.to/#/#litestar:matrix.org)
space
to discuss contributions and project maintenance.
For guidelines on how to contribute, please
see [the contribution
guide](/litestar-org/litestar/blob/main/CONTRIBUTIN
G.rst).
Thanks goes to these wonderful people:
[Emoji
Key](https://allcontributors.org/docs/en/emoji-key)
This project follows the
[all-contributors](https://github.com/all-contribut
ors/all-contributors) specification.
Contributions of any kind welcome!
[03/13/25 21:07:53] INFO Subtask 5234609451914f538ae434394a22b4e6
Actions: [
{
"tag": "call_S6YLRGV6xnp5FQSl8xl68iV6",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url":
"https://github.com/Kludex/awesome-fastapi-projects
"
}
}
}
]
INFO Subtask 5234609451914f538ae434394a22b4e6
Response: View the website:
[https://kludex.github.io/awesome-fastapi-projects/
](https://kludex.github.io/awesome-fastapi-projects
/)
The instructions below assume you have
[pyenv](https://github.com/pyenv/pyenv) installed.
If you don't, use any other method to create a
virtual environment
and install Python 3.11.4.
- Install Python 3.11.4
pyenv install 3.11.4
- Create a virtual environment
pyenv virtualenv 3.11.4 awesome-fastapi-projects
- Activate the virtual environment
pyenv local awesome-fastapi-projects
There is a Makefile
with some useful commands to help you get started.
For available commands, run make help
. To install dependencies and pre-commit hooks,
run:
make
The frontend is built with
[React](https://reactjs.org/) and
[Next.js](https://nextjs.org/).
It is being statically built and served on GitHub
Pages:
[https://kludex.github.io/awesome-fastapi-projects/
](https://kludex.github.io/awesome-fastapi-projects
/)
To run the frontend locally, you need to install
[Node.js](https://nodejs.org/en/) and
[pnpm](https://pnpm.io/).
The node version is specified in the .node-version
file.
To easily manage the node version, you can use
[fnm](https://github.com/Schniz/fnm).
Then, run the following commands:
make front
This will install the dependencies and start the
development server.
The frontend will be available at
[http://localhost:3000](http://localhost:3000).
[03/13/25 21:07:54] INFO Subtask 12485d4e4b044d8fbae098f1f7274bf6
Actions: [
{
"tag": "call_iGwUbKslexi3GAhQyzKjBm3N",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url": "https://github.com/pallets/flask"
}
}
}
]
INFO Subtask 12485d4e4b044d8fbae098f1f7274bf6
Response: Flask is a lightweight
[WSGI](https://wsgi.readthedocs.io/) web
application framework. It is designed
to make getting started quick and easy, with the
ability to scale up to
complex applications. It began as a simple wrapper
around
[Werkzeug](https://werkzeug.palletsprojects.com/)
and [Jinja](https://jinja.palletsprojects.com/),
and has become one of the most popular Python web
application frameworks.
Flask offers suggestions, but doesn't enforce any
dependencies or project layout. It is up to the
developer to choose the tools and libraries they
want to use. There are many extensions provided by
the community that make adding new functionality
easy.
# save this as app.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
$ flask run
* Running on http://127.0.0.1:5000/ (Press CTRL+C
to quit)
The Pallets organization develops and supports
Flask and the libraries
it uses. In order to grow the community of
contributors and users, and
allow the maintainers to devote more time to the
projects, [please
donate today](https://palletsprojects.com/donate).
See our [detailed contributing
documentation](https://palletsprojects.com/contribu
ting/) for many ways to
contribute, including reporting issues, requesting
features, asking or answering
questions, and making PRs.
INFO PromptTask project-research-django
Output: {"answer":"Django is a high-level Python
web framework that promotes rapid development and
clean, pragmatic design. It is free and open
source, making it accessible for developers to use
and contribute to. Django is designed to help
developers take applications from concept to
completion as quickly as possible, focusing on
efficiency and speed. It is known for its security
features, helping developers avoid common security
pitfalls, and its scalability, which allows it to
handle the demands of some of the busiest sites on
the web.","key_features":[{"name":"Rapid
Development","description":"Django is designed to
help developers quickly take applications from
concept to
completion.","emoji":"⚡"},{"name":"Security","desc
ription":"Django takes security seriously and helps
developers avoid many common security
mistakes.","emoji":"🔒"},{"name":"Scalability","des
cription":"Django can handle the demands of some of
the busiest sites on the web, offering flexibility
and scalability.","emoji":"📈"}]}
[03/13/25 21:07:56] INFO Subtask cdcd9788c77d4eb68670bd5b09c37915
Actions: [
{
"tag": "call_04RbBkYWTEXvtoE2IJoto7Mm",
"name": "WebScraperTool",
"path": "get_content",
"input": {
"values": {
"url":
"https://github.com/mjhea0/awesome-fastapi"
}
}
}
]
[03/13/25 21:07:57] INFO Subtask cdcd9788c77d4eb68670bd5b09c37915
Response: A curated list of awesome things related
to FastAPI.
[FastAPI](https://fastapi.tiangolo.com/) is a
modern, high-performance, batteries-included Python
web framework that's perfect for building RESTful
APIs.
[FastAPI
Admin](https://github.com/fastapi-admin/fastapi-adm
in)- Functional admin panel that provides a user
interface for performing CRUD operations on your
data. Currently only works with the Tortoise
ORM.[FastAPI Amis
Admin](https://github.com/amisadmin/fastapi-amis-ad
min)- A high-performance, efficient and easily
extensible FastAPI admin framework.[Piccolo
Admin](https://github.com/piccolo-orm/piccolo_admin
)- A powerful and modern admin GUI, using the
Piccolo ORM.[SQLAlchemy
Admin](https://github.com/aminalaee/sqladmin)-
Admin Panel for FastAPI/Starlette that works with
SQLAlchemy models.[Starlette
Admin](https://github.com/jowilf/starlette-admin)-
Admin framework for FastAPI/Starlette, supporting
SQLAlchemy, SQLModel, MongoDB, and ODMantic.
[AuthX](https://github.com/yezz123/AuthX)-
Customizable Authentications and Oauth2 management
for FastAPI.[FastAPI
Auth](https://github.com/dmontagu/fastapi-auth)-
Pluggable auth that supports the OAuth2 Password
Flow with JWT access and refresh tokens.[FastAPI
Azure
Auth](https://github.com/Intility/fastapi-azure-aut
h)- Azure AD authentication for your APIs with
single and multi tenant support.[FastAPI Cloud
Auth](https://github.com/tokusumi/fastapi-cloudauth
)- Simple integration between FastAPI and cloud
authentication services (AWS Cognito, Auth0,
Firebase Authentication).[FastAPI
Login](https://github.com/MushroomMaula/fastapi_log
in)- Account management and authentication (based
on[Flask-Login](https://github.com/maxcountryman/fl
ask-login)).[FastAPI JWT
Auth](https://github.com/IndominusByte/fastapi-jwt-
auth)- JWT auth (based
on[Flask-JWT-Extended](https://github.com/vimalloc/
flask-jwt-extended)).[FastAPI
Permissions](https://github.com/holgi/fastapi-permi
ssions)- Row-level permissions.[FastAPI
Security](https://github.com/jacobsvante/fastapi-se
curity)- Implements authentication and
authorization as dependencies in FastAPI.[FastAPI
Simple
Security](https://github.com/mrtolkien/fastapi_simp
le_security)- Out-of-the-box API key security
manageable through path operations.[FastAPI
Users](https://github.com/fastapi-users/fastapi-use
rs)- Account management, authentication,
authorization.
[Edgy ORM](https://github.com/dymmond/edgy)-
Complex databases made simple.[FastAPI
SQLAlchemy](https://github.com/mfreeborn/fastapi-sq
lalchemy)- Simple integration between FastAPI
and[SQLAlchemy](https://www.sqlalchemy.org/).[Fasta
pi-SQLA](https://github.com/dialoguemd/fastapi-sqla
)- SQLAlchemy extension for FastAPI with support
for pagination, asyncio, and
pytest.[FastAPIwee](https://github.com/Ignisor/Fast
APIwee)- A simple way to create REST API based
on[PeeWee](https://github.com/coleifer/peewee)model
s.[GINO](https://github.com/python-gino/gino)- A
lightweight asynchronous ORM built on top of
SQLAlchemy core for Python
asyncio.[ORM](https://github.com/encode/orm)- An
async
ORM.[ormar](https://collerek.github.io/ormar/)-
Ormar is an async ORM that uses Pydantic validation
and can be used directly in FastAPI requests and
responses so you are left with only one set of
models to maintain. Alembic migrations
included.[FastAPI
Example](https://collerek.github.io/ormar/latest/fa
stapi/)- Using FastAPI with ormar.
[Piccolo](https://github.com/piccolo-orm/piccolo)-
An async ORM and query builder, supporting Postgres
and SQLite, with batteries (migrations, security,
etc).[FastAPI
Examples](https://github.com/piccolo-orm/piccolo_ex
amples)- Using FastAPI with Piccolo.
[Prisma Client
Python](https://github.com/RobertCraigie/prisma-cli
ent-py)- An auto-generated, fully type safe ORM
powered by Pydantic and tailored specifically for
your schema - supports SQLite, PostgreSQL, MySQL,
MongoDB, MariaDB and more.[Tortoise
ORM](https://tortoise.github.io)- An easy-to-use
asyncio ORM (Object Relational Mapper) inspired by
Django.[FastAPI
Example](https://tortoise.github.io/examples/fastap
i.html)- An example of the Tortoise-ORM FastAPI
integration.[Tutorial: Setting up Tortoise ORM with
FastAPI](https://web.archive.org/web/20200523174158
/https://robwagner.dev/tortoise-fastapi-setup/)[Aer
ich](https://github.com/tortoise/aerich)- Tortoise
ORM migrations tools.
[Saffier ORM](https://github.com/tarsil/saffier)-
The only Python ORM you will ever
need.[SQLModel](https://sqlmodel.tiangolo.com/)-
SQLModel (which is powered by Pydantic and
SQLAlchemy) is a library for interacting with SQL
databases from Python code, with Python objects.
[asyncpgsa](https://github.com/CanopyTax/asyncpgsa)
- A wrapper
around[asyncpg](https://github.com/MagicStack/async
pg)for use with[SQLAlchemy
Core](https://docs.sqlalchemy.org/en/latest/core/).
[Databases](https://github.com/encode/databases)-
Async SQL query builder that works on top of
the[SQLAlchemy
Core](https://docs.sqlalchemy.org/en/latest/core/)e
xpression
language.[PyPika](https://github.com/kayak/pypika)-
A SQL query builder that exposes the full richness
of the SQL language.
[Beanie](https://github.com/BeanieODM/beanie)-
Asynchronous Python ODM for MongoDB, based
on[Motor](https://motor.readthedocs.io/en/stable/)a
nd[Pydantic](https://docs.pydantic.dev/latest/),
which supports data and schema migrations out of
the box.[MongoEngine](http://mongoengine.org/)- A
Document-Object Mapper (think ORM, but for document
databases) for working with MongoDB from
Python.[Motor](https://motor.readthedocs.io/)-
Asynchronous Python driver for
MongoDB.[ODMantic](https://art049.github.io/odmanti
c/)- AsyncIO MongoDB ODM integrated
with[Pydantic](https://docs.pydantic.dev/latest/).[
PynamoDB](https://github.com/pynamodb/PynamoDB)- A
pythonic interface to Amazon's DynamoDB.
[Pydantic-SQLAlchemy](https://github.com/tiangolo/p
ydantic-sqlalchemy)- Convert SQLAlchemy models
to[Pydantic](https://docs.pydantic.dev/latest/)mode
ls.[FastAPI-CamelCase](https://nf1s.github.io/fasta
pi-camelcase/)- CamelCase JSON support for FastAPI
utilizing[Pydantic](https://docs.pydantic.dev/lates
t/).[CamelCase Models with FastAPI and
Pydantic](https://medium.com/analytics-vidhya/camel
-case-models-with-fast-api-and-pydantic-5a8acb6c0ee
e)- Accompanying blog post from the author of the
extension.
[FastAPI Code
Generator](https://github.com/koxudaxi/fastapi-code
-generator)- Create a FastAPI app from an OpenAPI
file, enabling schema-driven development.[FastAPI
Client
Generator](https://github.com/dmontagu/fastapi_clie
nt)- Generate a mypy- and IDE-friendly API client
from an OpenAPI spec.[FastAPI Cruddy
Framework](https://github.com/mdconaway/fastapi-cru
ddy-framework)- A companion library to FastAPI
designed to bring the development productivity of
Ruby on Rails, Ember.js or Sails.js to the FastAPI
ecosystem.[FastAPI
MVC](https://github.com/fastapi-mvc/fastapi-mvc)-
Developer productivity tool for making high-quality
FastAPI production-ready APIs.[FastAPI
Profiler](https://github.com/sunhailin-Leo/fastapi_
profiler)- A FastAPI Middleware of
joerick/pyinstrument to check your service
performance.[FastAPI
Versioning](https://github.com/DeanWay/fastapi-vers
ioning)- API versioning.[Jupyter Notebook REST
API](https://github.com/Invictify/Jupter-Notebook-R
EST-API)- Run your Jupyter notebooks as RESTful API
endpoints.[Manage
FastAPI](https://github.com/ycd/manage-fastapi)-
CLI tool for generating and managing FastAPI
projects.[msgpack-asgi](https://github.com/florimon
dmanca/msgpack-asgi)-
Automatic[MessagePack](https://msgpack.org/)content
negotiation.
[FastAPI
Mail](https://github.com/sabuhish/fastapi-mail)-
Lightweight mail system for sending emails and
attachments (individual and bulk).
[Apitally](https://github.com/apitally/apitally-py)
- API analytics, monitoring, and request logging
for FastAPI.[ASGI Correlation
ID](https://github.com/snok/asgi-correlation-id)-
Request ID logging middleware.[FastAPI
Cache](https://github.com/comeuplater/fastapi_cache
)- A simple lightweight cache system.[FastAPI
Cache](https://github.com/long2ice/fastapi-cache)-
A tool to cache FastAPI response and function
results, with support for Redis, Memcached,
DynamoDB, and in-memory backends.[FastAPI
Chameleon](https://github.com/mikeckennedy/fastapi-
chameleon)- Adds integration of the Chameleon
template language to FastAPI.[FastAPI
CloudEvents](https://github.com/sasha-tkachev/fasta
pi-cloudevents)-[CloudEvents](https://cloudevents.i
o/)integration for FastAPI.[FastAPI
Contrib](https://github.com/identixone/fastapi_cont
rib)- Opinionated set of utilities: pagination,
auth middleware, permissions, custom exception
handlers, MongoDB support, and Opentracing
middleware.[FastAPI
CRUDRouter](https://github.com/awtkns/fastapi-crudr
outer)- A FastAPI router that
automatically creates and documents CRUD routes for
your models.[FastAPI
Events](https://github.com/melvinkcx/fastapi-events
)- Asynchronous event dispatching/handling library
for FastAPI and Starlette.[FastAPI
FeatureFlags](https://github.com/Pytlicek/fastapi-f
eatureflags)- Simple implementation of feature
flags for FastAPI.[FastAPI
Jinja](https://github.com/AGeekInside/fastapi-jinja
)- Adds integration of the Jinja template language
to FastAPI.[FastAPI
Lazy](https://github.com/yezz123/fastango)- Lazy
package to start your project using
FastAPI.[FastAPI
Limiter](https://github.com/long2ice/fastapi-limite
r)- A request rate limiter for FastAPI.[FastAPI
Listing](https://github.com/danielhasan1/fastapi-li
sting)- A library to design/build listing APIs
using component-based architecture, inbuilt query
paginator, sorter, django-admin like filters & much
more.[FastAPI
MQTT](https://github.com/sabuhish/fastapi-mqtt)- An
extension for the MQTT protocol.[FastAPI
Opentracing](https://github.com/wesdu/fastapi-opent
racing)- Opentracing middleware and database
tracing support for FastAPI.[FastAPI
Pagination](https://github.com/uriyyo/fastapi-pagin
ation)- Pagination for FastAPI.[FastAPI
Plugins](https://github.com/madkote/fastapi-plugins
)- Redis and Scheduler plugins.[FastAPI
ServiceUtils](https://github.com/skallfass/fastapi_
serviceutils)- Generator for creating API
services.[FastAPI
SocketIO](https://github.com/pyropy/fastapi-socketi
o)- Easy integration for FastAPI and
SocketIO.[FastAPI
Utilities](https://github.com/fastapiutils/fastapi-
utils)- Reusable utilities: class-based views,
response inferring router, periodic tasks, timing
middleware, SQLAlchemy session, OpenAPI spec
simplification.[FastAPI Websocket
Pub/Sub](https://github.com/authorizon/fastapi_webs
ocket_pubsub)- The classic pub/sub pattern made
easily accessible and scalable over the web and
across your cloud in realtime.[FastAPI Websocket
RPC](https://github.com/authorizon/fastapi_websocke
t_rpc)- RPC (bidirectional JSON RPC) over
Websockets made easy, robust, and production
ready.[OpenTelemetry FastAPI
Instrumentation](https://github.com/open-telemetry/
opentelemetry-python-contrib/tree/main/instrumentat
ion/opentelemetry-instrumentation-fastapi)- Library
provides automatic and manual instrumentation of
FastAPI web frameworks, instrumenting http
requests served by applications utilizing the
framework.[Prerender Python
Starlette](https://github.com/BeeMyDesk/prerender-p
ython-starlette)- Starlette middleware for
Prerender.[Prometheus FastAPI
Instrumentator](https://github.com/trallnag/prometh
eus-fastapi-instrumentator)- A configurable and
modular Prometheus Instrumentator for your FastAPI
application.[SlowApi](https://github.com/laurents/s
lowapi)- Rate limiter (based
on[Flask-Limiter](https://flask-limiter.readthedocs
.io)).[Starlette
Context](https://github.com/tomwojcik/starlette-con
text)- Allows you to store and access the request
data anywhere in your project, useful for
logging.[Starlette
Exporter](https://github.com/stephenhillier/starlet
te_exporter)- One more prometheus integration for
FastAPI and Starlette.[Starlette
OpenTracing](https://github.com/acidjunk/starlette-
opentracing)- Opentracing support for Starlette and
FastAPI.[Starlette
Prometheus](https://github.com/perdy/starlette-prom
etheus)- Prometheus integration for FastAPI and
Starlette.[Strawberry
GraphQL](https://github.com/strawberry-graphql/stra
wberry)- Python GraphQL library based on
dataclasses.
[Documentation](https://fastapi.tiangolo.com/)-
Comprehensive
documentation.[Tutorial](https://fastapi.tiangolo.c
om/tutorial/)- Official tutorial showing you how to
use FastAPI with most of its features, step by
step.[Source
Code](https://github.com/fastapi/fastapi)- Hosted
on
GitHub.[Discord](https://discord.com/invite/VQjSZae
Jmf)- Chat with other FastAPI users.
[TestDriven.io
FastAPI](https://testdriven.io/blog/topics/fastapi/
)- Multiple FastAPI-specific articles that focus on
developing and testing production-ready RESTful
APIs, serving up machine learning models, and more.
[Build The Next Generation Of Python Web
Applications With
FastAPI](https://www.pythonpodcast.com/fastapi-web-
application-framework-episode-259/)- In this
episode of[Podcast
Init](https://www.pythonpodcast.com/), the creator
of FastAPI,[Sebastián
Ramirez](https://tiangolo.com/), shares his
motivations for building FastAPI and how it works
under the hood.[FastAPI on
PythonBytes](https://pythonbytes.fm/episodes/show/1
23/time-to-right-the-py-wrongs?time_in_sec=855)-
Nice overview of the project.
[FastAPI has Ruined Flask Forever for
Me](https://towardsdatascience.com/fastapi-has-ruin
ed-flask-forever-for-me-73916127da)[Why we switched
from Flask to FastAPI for production machine
learning](https://medium.com/@calebkaiser/why-we-sw
itched-from-flask-to-fastapi-for-production-machine
-learning-765aab9b3679)- In-depth look at why you
may want to move from Flask to FastAPI.
[Async SQLAlchemy with
FastAPI](https://stribny.name/posts/fastapi-asyncal
chemy/)- Learn how to use SQLAlchemy
asynchronously.[Build and Secure an API in Python
with
FastAPI](https://blog.yezz.me/blog/Build-and-Secure
-an-API-in-Python-with-FastAPI)- Secure and
maintain an API based on FastAPI and
SQLAlchemy.[Deploy a Dockerized FastAPI App to
Google Cloud
Platform](https://towardsdatascience.com/deploy-a-d
ockerized-fastapi-app-to-google-cloud-platform-24f7
2266c7ef)- A short guide to deploying a Dockerized
Python app to Google Cloud Platform using Cloud Run
and a SQL instance.[Deploy Machine Learning Models
with Keras, FastAPI, Redis and
Docker](https://medium.com/analytics-vidhya/deploy-
machine-learning-models-with-keras-fastapi-redis-an
d-docker-4940df614ece)[Deploying Iris
Classifications with FastAPI and
Docker](https://towardsdatascience.com/deploying-ir
is-classifications-with-fastapi-and-docker-7c9b83fd
ec3a)- Dockerizing a FastAPI
application.[Developing and Testing an Asynchronous
API with FastAPI and
Pytest](https://testdriven.io/blog/fastapi-crud/)-
Develop and test an asynchronous API with FastAPI,
Postgres, Pytest, and Docker using Test-Driven
Development.[FastAPI for Flask
Users](https://amitness.com/posts/fastapi-vs-flask)
- Learn FastAPI with a side-by-side code comparison
to Flask.[Getting started with GraphQL in Python
with FastAPI and
Ariadne](https://blog.yezz.me/blog/Getting-started-
with-GraphQL-in-Python-with-FastAPI-and-Ariadne)-
Generate a FullStack playground using FastAPI,
GraphQL and
Ariadne.[Implementing FastAPI Services –
Abstraction and Separation of
Concerns](https://camillovisini.com/coding/abstract
ing-fastapi-services)- FastAPI application and
service structure for a more maintainable
codebase.[Introducing FARM Stack - FastAPI, React,
and
MongoDB](https://www.mongodb.com/developer/language
s/python/farm-stack-fastapi-react-mongodb/)-
Getting started with a complete FastAPI web
application stack.[Multitenancy with FastAPI,
SQLAlchemy and
PostgreSQL](https://mergeboard.com/blog/6-multitena
ncy-fastapi-sqlalchemy-postgresql/)- Learn how to
make FastAPI applications multi-tenant
ready.[Porting Flask to FastAPI for ML Model
Serving](https://www.pluralsight.com/tech-blog/port
ing-flask-to-fastapi-for-ml-model-serving/)-
Comparison of Flask vs FastAPI.[Real-time data
streaming using FastAPI and
WebSockets](https://stribny.name/posts/real-time-da
ta-streaming-using-fastapi-and-websockets/)- Learn
how to stream data from FastAPI directly into a
real-time chart.[Running FastAPI applications in
production](https://stribny.name/posts/fastapi-prod
uction/)- Use Gunicorn with systemd for production
deployments.[Serving Machine Learning Models with
FastAPI in
Python](https://medium.com/@8B_EC/tutorial-serving-
machine-learning-models-with-fastapi-in-python-c1a2
7319c459)- Use FastAPI to quickly and easily deploy
and serve machine learning models in Python as a
RESTful API.[Streaming video with
FastAPI](https://stribny.name/posts/fastapi-video/)
- Learn how to serve video streams.[Using
Hypothesis and Schemathesis to Test
FastAPI](https://testdriven.io/blog/fastapi-hypothe
sis/)- Apply property-based testing to FastAPI.
[PyConBY 2020: Serve ML models easily with
FastAPI](https://www.youtube.com/watch?v=z9K5pwb0rt
8)- From the talk by Sebastian Ramirez you will
learn how to easily build a production-ready web
(JSON) API for your ML models with FastAPI,
including best practices by default.[PyCon UK 2019:
FastAPI from the ground
up](https://www.youtube.com/watch?v=3DLwPcrE5mA)-
This talk shows how to build a simple REST API for
a database from the ground up using FastAPI.
[Building a Stock Screener with
FastAPI](https://www.youtube.com/watch?v=5GorMC2lPp
k)- A you build a web-based stock screener with
FastAPI, you'll be introduced to many of FastAPI's
features, including Pydantic models, dependency
injection, background tasks, and SQLAlchemy
integration.[Building Web APIs Using
FastAPI](https://www.youtube.com/watch?v=Pe66M8mn-w
A)- Use FastAPI to build a web application
programming interface (RESTful API).[FastAPI - A
Web Framework for
Python](https://www.youtube.com/watch?v=PUhio8CprhI
&list=PL5gdMNl42qynpY-o43Jk3evfxEKSts3HS)- See how
to do numeric validations with FastAPI.[FastAPI vs.
Django vs.
Flask](https://www.youtube.com/watch?v=9YBAOYQOzWs)
- Which framework is best for Python in 2020? Which
uses async/await the best? Which is the
fastest?[Serving Machine Learning Models As API
with
FastAPI](https://www.youtube.com/watch?v=mkDxuRvKUL
8)- Build a machine learning API with FastAPI.
[Test-Driven Development with FastAPI and
Docker](https://testdriven.io/courses/tdd-fastapi/)
- Learn how to build, test, and deploy a text
summarization microservice with Python, FastAPI,
and Docker.[Modern APIs with FastAPI and
Python](https://training.talkpython.fm/courses/gett
ing-started-with-fastapi)- A course designed to get
you creating new APIs running in the cloud with
FastAPI quickly.[Full Web Apps with FastAPI
Course](https://training.talkpython.fm/courses/full
-html-web-applications-with-fastapi)- You'll learn
to build full web apps with FastAPI, equivalent to
what you can do with Flask or Django.[The
Definitive Guide to Celery and
FastAPI](https://testdriven.io/courses/fastapi-cele
ry/)- Learn how to add Celery to a FastAPI
application to provide asynchronous task
processing.
[FastAPI Best
Practices](https://github.com/zhanymkanov/fastapi-b
est-practices)- Collection of best practices in a
GitHub repo.
(Platforms-as-a-Service)
[AWS Elastic
Beanstalk](https://aws.amazon.com/elasticbeanstalk/
)[Deta](https://www.deta.sh/)([example](https://dev
.to/athulcajay/fastapi-deta-ni5))[Fly](https://fly.
io)([tutorial](https://fly.io/docs/python/framework
s/fastapi/),[Deploy from a Git
repo](https://github.com/fly-apps/hello-fastapi))[G
oogle App
Engine](https://cloud.google.com/appengine)[Heroku]
(https://www.heroku.com/)([Step-by-step
tutorial](https://tutlinks.com/create-and-deploy-fa
stapi-app-to-heroku/),[ML model on Heroku
tutorial](https://testdriven.io/blog/fastapi-machin
e-learning/))[Microsoft Azure App
Service](https://azure.microsoft.com/en-us/products
/app-service/)
(Infrastructure-as-a-Service)
Frameworks:
[Chalice](https://github.com/aws/chalice)[Mangum](h
ttps://mangum.io/)- Adapter for running ASGI
applications with AWS Lambda and API
Gateway.[Vercel](https://vercel.com/)- (formerly
Zeit)
([example](https://github.com/Snailedlt/Markdown-Vi
deos)).
Compute:
[Full Stack FastAPI and PostgreSQL - Base Project
Generator](https://github.com/fastapi/full-stack-fa
stapi-template)- Full Stack FastAPI Template ,
which includes FastAPI, React, SQLModel,
PostgreSQL, Docker, GitHub Actions, automatic
HTTPS, and more (developed by the creator of
FastAPI,[Sebastián
Ramírez](https://github.com/tiangolo)).[FastAPI and
Tortoise
ORM](https://github.com/prostomarkeloff/fastapi-tor
toise)- Powerful but simple template for web APIs
w/ FastAPI (as web framework) and Tortoise-ORM (for
working via database without headache).[FastAPI
Model Server
Skeleton](https://github.com/eightBEC/fastapi-ml-sk
eleton)- Skeleton app to serve machine learning
models
production-ready.[cookiecutter-spacy-fastapi](https
://github.com/microsoft/cookiecutter-spacy-fastapi)
- Quick deployments of spaCy models with
FastAPI.[cookiecutter-fastapi](https://github.com/a
rthurhenrique/cookiecutter-fastapi)- Cookiecutter
template for FastAPI projects using: Machine
Learning, Poetry, Azure Pipelines and
pytest.[openapi-python-client](https://github.com/o
penapi-generators/openapi-python-client)- Generate
modern FastAPI Python clients (via FastAPI) from
OpenAPI.[Pywork](https://github.com/vutran1710/Yeom
anPywork)-[Yeoman](https://yeoman.io/)generator to
scaffold a FastAPI
app.[fastapi-gino-arq-uvicorn](https://github.com/l
eosussan/fastapi-gino-arq-uvicorn)- Template for a
high-performance async REST API, in Python.
FastAPI + GINO + Arq + Uvicorn (w/ Redis and
PostgreSQL).[FastAPI and React
Template](https://github.com/Buuntu/fastapi-react)-
Full stack cookiecutter boilerplate using FastAPI,
TypeScript, Docker, PostgreSQL, and React.[FastAPI
Nano](https://github.com/rednafi/fastapi-nano)-
Simple FastAPI template with factory pattern
architecture.[FastAPI
template](https://github.com/s3rius/FastAPI-templat
e)- Flexible, lightweight FastAPI project
generator.
It includes support for SQLAlchemy, multiple
databases, CI/CD, Docker, and Kubernetes.[FastAPI
on Google Cloud
Run](https://github.com/anthonycorletti/cloudrun-fa
stapi)- Boilerplate for API building with FastAPI,
SQLModel, and Google Cloud Run.[FastAPI with
Firestore](https://github.com/anthonycorletti/fires
tore-fastapi)- Boilerplate for API building with
FastAPI and Google Cloud
Firestore.[fastapi-alembic-sqlmodel-async](https://
github.com/jonra1993/fastapi-alembic-sqlmodel-async
)- This is a project template which uses FastAPI,
Alembic, and async SQLModel as
ORM.[fastapi-starter-project](https://github.com/mi
rzadelic/fastapi-starter-project)- A project
template which uses FastAPI, SQLModel, Alembic,
Pytest, Docker, GitHub Actions CI.[Full Stack
FastAPI and MongoDB - Base Project
Generator](https://github.com/mongodb-labs/full-sta
ck-fastapi-mongodb)- Full stack, modern web
application generator, which includes FastAPI,
MongoDB, Docker, Celery, React frontend, automatic
HTTPS and more.[Uvicorn Poetry FastAPI Project
Template](https://github.com/max-pfeiffer/uvicorn-p
oetry-fastapi-project-template)- Cookiecutter
project template for starting a FastAPI
application. Runs in a Docker container with
Uvicorn ASGI server on Kubernetes. Supports AMD64
and ARM64 CPU architectures.
[inboard](https://github.com/br3ndonland/inboard)-
Docker images to power your FastAPI apps and help
you ship
faster.[uvicorn-gunicorn-fastapi-docker](https://gi
thub.com/tiangolo/uvicorn-gunicorn-fastapi-docker)-
Docker image with Uvicorn managed by Gunicorn for
high-performance FastAPI web applications in Python
3.7 and 3.6 with performance
auto-tuning.[uvicorn-gunicorn-poetry](https://githu
b.com/max-pfeiffer/uvicorn-gunicorn-poetry)- Docker
image with Gunicorn using Uvicorn workers for
running Python web applications. Uses Poetry for
managing dependencies and setting up a virtual
environment. Supports AMD64 and ARM64 CPU
architectures.[uvicorn-poetry](https://github.com/m
ax-pfeiffer/uvicorn-poetry)- Docker image with
Uvicorn ASGI server for running Python web
applications on Kubernetes. Uses Poetry for
managing dependencies and setting up a virtual
environment. Supports AMD64 and ARM64 CPU
architectures.
[Astrobase](https://github.com/anthonycorletti/astr
obase)- Simple, fast, and secure deployments
anywhere.[Awesome FastAPI
Projects](https://github.com/Kludex/awesome-fastapi
-projects)- Organized list of projects that use
FastAPI.[Bitcart](https://github.com/bitcart/bitcar
t)- Platform for merchants, users and developers
which offers easy setup and
use.[Bali](https://github.com/bali-framework/bali)-
Simplify Cloud Native Microservices development
base on FastAPI and
gRPC.[Bunnybook](https://github.com/pietrobassi/bun
nybook)- A tiny social network built with FastAPI,
React+RxJs, Neo4j, PostgreSQL, and
Redis.[Coronavirus-tg-api](https://github.com/egbak
ou/coronavirus-tg-api)- API for tracking the global
coronavirus (COVID-19, SARS-CoV-2)
outbreak.[Dispatch](https://github.com/Netflix/disp
atch)- Manage security incidents.- FastAPI CRUD
Example:
[FastAPI with
Observability](https://github.com/Blueswen/fastapi-
observability)- Observe FastAPI app with three
pillars of observability: Traces (Tempo), Metrics
(Prometheus), Logs (Loki) on Grafana through
OpenTelemetry and
OpenMetrics.[DogeAPI](https://github.com/yezz123/Do
geAPI)- API with high performance to create a
simple blog and CRUD with
OAuth2PasswordBearer.[FastAPI Websocket
Broadcast](https://github.com/kthwaite/fastapi-webs
ocket-broadcast)- Websocket 'broadcast'
demo.[FastAPI with Celery, RabbitMQ, and
Redis](https://github.com/GregaVrbancic/fastapi-cel
ery)- Minimal example utilizing FastAPI and Celery
with RabbitMQ for task queue, Redis for Celery
backend, and Flower for monitoring the Celery
tasks.[JeffQL](https://github.com/yezz123/JeffQL/)-
Simple authentication and login API using GraphQL
and JWT.[JSON-RPC
Server](https://github.com/smagafurov/fastapi-jsonr
pc)- JSON-RPC server based on
FastAPI.[Mailer](https://github.com/rclement/mailer
)- Dead-simple mailer micro-service for static
websites.[Markdown-Videos](https://github.com/Snail
edlt/Markdown-Videos)- API for generating
thumbnails to embed into your markdown
content.[Nemo](https://github.com/harshitsinghai77/
nemo-backend)- Be productive with Nemo.[OPAL (Open
Policy Administration
Layer)](https://github.com/authorizon/opal)-
Real-time authorization updates on top of
Open-Policy; built with FastAPI, Typer, and FastAPI
WebSocket
pub/sub.[Polar](https://github.com/polarsource/pola
r)- A funding and monetization platform for
developers, built with FastAPI, SQLAlchemy,
Alembic, and Arq.[RealWorld Example App -
mongo](https://github.com/markqiu/fastapi-mongodb-r
ealworld-example-app)[RealWorld Example App -
postgres](https://github.com/nsidnev/fastapi-realwo
rld-example-app)[redis-streams-fastapi-chat](https:
//github.com/leonh/redis-streams-fastapi-chat)- A
simple Redis Streams backed chat app using
Websockets, Asyncio and FastAPI/Starlette.[Sprites
as a
service](https://github.com/ljvmiranda921/sprites-a
s-a-service)- Generate your personal 8-bit avatars
using Cellular
Automata.[Slackers](https://github.com/uhavin/slack
ers)- Slack webhooks
API.[TermPair](https://github.com/cs01/termpair)-
View and control terminals from your browser with
end-to-end
encryption.[Universities](https://github.com/ycd/un
iversities)- API service for obtaining information
about +9600 universities worldwide.
Please support this open source project by checking
out our sponsors:
INFO PromptTask project-research-litestar
Output: {"answer":"Litestar is an open-source ASGI
framework designed for building APIs with a focus
on high performance, flexibility, and ease of use.
It provides features such as data validation and
parsing, dependency injection, ORM integration, and
authorization primitives. Litestar supports both
function-based and class-based route handlers, and
it is rigorously typed to ensure data validation
and OpenAPI specification generation.\n\nThe
framework includes a plugin system for extending
serialization/deserialization and OpenAPI
generation, and it integrates with SQLAlchemy for
ORM support. Litestar also offers middleware for
handling CORS, CSRF, rate limiting, and
more.\n\nLitestar is known for its speed, being on
par with or faster than comparable ASGI frameworks.
It is open to contributions and supported by
sponsors, with options for pledge-based
sponsorships via Polar.sh, GitHub, or Open
Collective.","key_features":[{"name":"High
Performance","description":"Litestar is designed to
be fast, with performance on par with or exceeding
other ASGI
frameworks.","emoji":"⚡"},{"name":"Flexible and
Opinionated","description":"While offering
flexibility, Litestar provides opinionated defaults
to streamline API
development.","emoji":"🔧"},{"name":"Data
Validation and Parsing","description":"Supports
high-performance data validation and parsing using
libraries like msgspec and
pydantic.","emoji":"✅"},{"name":"Dependency
Injection","description":"Inspired by pytest,
Litestar offers a simple yet powerful dependency
injection system.","emoji":"🔗"},{"name":"ORM
Integration","description":"First-class support for
SQLAlchemy and Piccolo ORM, allowing seamless
database
interactions.","emoji":"🗄️"},{"name":"Authorization
Primitives","description":"Includes route guards
for defining authorization logic at various
application levels.","emoji":"🔒"},{"name":"OpenAPI
3.1 Support","description":"Automatically generates
OpenAPI 3.1 schemas, including optional example
generation.","emoji":"📜"},{"name":"Middleware
Support","description":"Includes built-in
middleware for CORS, CSRF, rate limiting, and
more.","emoji":"🛡️"},{"name":"Plugin
System","description":"Allows extension of
serialization/deserialization and OpenAPI
generation
features.","emoji":"🔌"},{"name":"Community and
Contributions","description":"Open to contributions
and supported by a community of sponsors and
contributors.","emoji":"🤝"}]}
[03/13/25 21:07:58] INFO PromptTask project-research-flask
Output: {"answer":"Flask is a lightweight WSGI web
application framework designed to make getting
started with web development quick and easy, while
also being scalable for more complex applications.
It originated as a simple wrapper around Werkzeug
and Jinja, and has grown to become one of the most
popular Python web application frameworks. Flask is
known for its simplicity and flexibility, offering
suggestions but not enforcing any dependencies or
project layout. This allows developers to choose
their own tools and libraries. The community
provides many extensions to easily add new
functionalities. Flask is developed and supported
by the Pallets organization, which also maintains
the libraries it uses. The project encourages
community contributions and support through
donations.","key_features":[{"name":"Lightweight
Framework","description":"Flask is a lightweight
framework that allows for quick and easy web
application
development.","emoji":"🌟"},{"name":"WSGI
Compatibility","description":"Flask is a WSGI web
application framework, making it compatible with a
wide range of web
servers.","emoji":"🔗"},{"name":"Flexibility","desc
ription":"Flask offers flexibility by not enforcing
any dependencies or project layout, allowing
developers to choose their own tools and
libraries.","emoji":"🛠️"},{"name":"Community
Extensions","description":"There are many
community-provided extensions that make it easy to
add new functionality to Flask
applications.","emoji":"🔌"},{"name":"Pallets
Organization","description":"Flask is developed and
supported by the Pallets organization, which also
maintains the libraries it uses.","emoji":"🏢"}]}
[03/13/25 21:08:01] INFO PromptTask project-research-fastapi
Output: {"answer":"FastAPI is a modern,
high-performance, Python web framework for building
APIs with Python 3.6+ based on standard Python type
hints. It is designed to be easy to use and to
provide high performance, on par with NodeJS and Go
(thanks to Starlette and Pydantic). FastAPI is
particularly well-suited for building RESTful APIs
and is known for its speed and ease of use.\n\nKey
features of FastAPI include automatic generation of
OpenAPI and JSON Schema documentation, dependency
injection, and asynchronous request handling. It is
widely used for building web applications and
microservices, and it integrates seamlessly with
popular Python libraries and tools such as
SQLAlchemy, Pydantic, and others.\n\nFastAPI has
gained popularity for its simplicity and
performance, making it a preferred choice for
developers looking to build APIs quickly and
efficiently.","key_features":[{"name":"High
Performance","description":"FastAPI is designed to
be fast and efficient, with performance on par with
NodeJS and Go.","emoji":"⚡"},{"name":"Automatic
Documentation","description":"Automatically
generates OpenAPI and JSON Schema documentation for
your APIs.","emoji":"📄"},{"name":"Type
Hints","description":"Utilizes Python type hints to
provide editor support and data
validation.","emoji":"🔍"},{"name":"Asynchronous
Support","description":"Supports asynchronous
request handling, making it suitable for
high-performance
applications.","emoji":"🔄"},{"name":"Dependency
Injection","description":"Built-in support for
dependency injection, allowing for clean and
modular code.","emoji":"🔗"}]}
INFO TextSummaryTask summary
Input: {"answer":"Django is a high-level Python web
framework that promotes rapid development and
clean, pragmatic design. It is free and open
source, making it accessible for developers to use
and contribute to. Django is designed to help
developers take applications from concept to
completion as quickly as possible, focusing on
efficiency and speed. It is known for its security
features, helping developers avoid common security
pitfalls, and its scalability, which allows it to
handle the demands of some of the busiest sites on
the web.","key_features":[{"name":"Rapid
Development","description":"Django is designed to
help developers quickly take applications from
concept to
completion.","emoji":"⚡"},{"name":"Security","desc
ription":"Django takes security seriously and helps
developers avoid many common security
mistakes.","emoji":"🔒"},{"name":"Scalability","des
cription":"Django can handle the demands of some of
the busiest sites on the web, offering flexibility
and scalability.","emoji":"📈"}]}
{"answer":"Flask is a lightweight WSGI web
application framework designed to make getting
started with web development quick and easy, while
also being scalable for more complex applications.
It originated as a simple wrapper around Werkzeug
and Jinja, and has grown to become one of the most
popular Python web application frameworks. Flask is
known for its simplicity and flexibility, offering
suggestions but not enforcing any dependencies or
project layout. This allows developers to choose
their own tools and libraries. The community
provides many extensions to easily add new
functionalities. Flask is developed and supported
by the Pallets organization, which also maintains
the libraries it uses. The project encourages
community contributions and support through
donations.","key_features":[{"name":"Lightweight
Framework","description":"Flask is a lightweight
framework that allows for quick and easy web
application
development.","emoji":"🌟"},{"name":"WSGI
Compatibility","description":"Flask is a WSGI web
application framework, making it compatible with a
wide range of web
servers.","emoji":"🔗"},{"name":"Flexibility","desc
ription":"Flask offers flexibility by not enforcing
any dependencies or project layout, allowing
developers to choose their own tools and
libraries.","emoji":"🛠️"},{"name":"Community
Extensions","description":"There are many
community-provided extensions that make it easy to
add new functionality to Flask
applications.","emoji":"🔌"},{"name":"Pallets
Organization","description":"Flask is developed and
supported by the Pallets organization, which also
maintains the libraries it uses.","emoji":"🏢"}]}
{"answer":"FastAPI is a modern, high-performance,
Python web framework for building APIs with Python
3.6+ based on standard Python type hints. It is
designed to be easy to use and to provide high
performance, on par with NodeJS and Go (thanks to
Starlette and Pydantic). FastAPI is particularly
well-suited for building RESTful APIs and is known
for its speed and ease of use.\n\nKey features of
FastAPI include automatic generation of OpenAPI and
JSON Schema documentation, dependency injection,
and asynchronous request handling. It is widely
used for building web applications and
microservices, and it integrates seamlessly with
popular Python libraries and tools such as
SQLAlchemy, Pydantic, and others.\n\nFastAPI has
gained popularity for its simplicity and
performance, making it a preferred choice for
developers looking to build APIs quickly and
efficiently.","key_features":[{"name":"High
Performance","description":"FastAPI is designed to
be fast and efficient, with performance on par with
NodeJS and Go.","emoji":"⚡"},{"name":"Automatic
Documentation","description":"Automatically
generates OpenAPI and JSON Schema documentation for
your APIs.","emoji":"📄"},{"name":"Type
Hints","description":"Utilizes Python type hints to
provide editor support and data
validation.","emoji":"🔍"},{"name":"Asynchronous
Support","description":"Supports asynchronous
request handling, making it suitable for
high-performance
applications.","emoji":"🔄"},{"name":"Dependency
Injection","description":"Built-in support for
dependency injection, allowing for clean and
modular code.","emoji":"🔗"}]}
{"answer":"Litestar is an open-source ASGI
framework designed for building APIs with a focus
on high performance, flexibility, and ease of use.
It provides features such as data validation and
parsing, dependency injection, ORM integration, and
authorization primitives. Litestar supports both
function-based and class-based route handlers, and
it is rigorously typed to ensure data validation
and OpenAPI specification generation.\n\nThe
framework includes a plugin system for extending
serialization/deserialization and OpenAPI
generation, and it integrates with SQLAlchemy for
ORM support. Litestar also offers middleware for
handling CORS, CSRF, rate limiting, and
more.\n\nLitestar is known for its speed, being on
par with or faster than comparable ASGI frameworks.
It is open to contributions and supported by
sponsors, with options for pledge-based
sponsorships via Polar.sh, GitHub, or Open
Collective.","key_features":[{"name":"High
Performance","description":"Litestar is designed to
be fast, with performance on par with or exceeding
other ASGI
frameworks.","emoji":"⚡"},{"name":"Flexible and
Opinionated","description":"While offering
flexibility, Litestar provides opinionated defaults
to streamline API
development.","emoji":"🔧"},{"name":"Data
Validation and Parsing","description":"Supports
high-performance data validation and parsing using
libraries like msgspec and
pydantic.","emoji":"✅"},{"name":"Dependency
Injection","description":"Inspired by pytest,
Litestar offers a simple yet powerful dependency
injection system.","emoji":"🔗"},{"name":"ORM
Integration","description":"First-class support for
SQLAlchemy and Piccolo ORM, allowing seamless
database
interactions.","emoji":"🗄️"},{"name":"Authorization
Primitives","description":"Includes route guards
for defining authorization logic at various
application levels.","emoji":"🔒"},{"name":"OpenAPI
3.1 Support","description":"Automatically generates
OpenAPI 3.1 schemas, including optional example
generation.","emoji":"📜"},{"name":"Middleware
Support","description":"Includes built-in
middleware for CORS, CSRF, rate limiting, and
more.","emoji":"🛡️"},{"name":"Plugin
System","description":"Allows extension of
serialization/deserialization and OpenAPI
generation
features.","emoji":"🔌"},{"name":"Community and
Contributions","description":"Open to contributions
and supported by a community of sponsors and
contributors.","emoji":"🤝"}]}
[03/13/25 21:08:07] INFO TextSummaryTask summary
Output: The text provides an overview of four
popular Python web frameworks: Django, Flask,
FastAPI, and Litestar.
1. **Django**: A high-level framework known for
rapid development, security, and scalability. It is
open-source and helps developers quickly build
applications with a focus on efficiency.
2. **Flask**: A lightweight and flexible framework
that allows for quick web development. It is known
for its simplicity, WSGI compatibility, and
community extensions, and is supported by the
Pallets organization.
3. **FastAPI**: A modern, high-performance
framework for building APIs, known for its speed
and ease of use. It features automatic
documentation, type hints, asynchronous support,
and dependency injection.
4. **Litestar**: An ASGI framework focused on high
performance and flexibility. It offers features
like data validation, ORM integration, and
middleware support, with a strong emphasis on
community contributions and sponsorships.
The text provides an overview of four popular Python web frameworks: Django, Flask, FastAPI, and Litestar.
1. **Django**: A high-level framework known for rapid development, security, and scalability. It is open-source and helps developers quickly build applications with a focus on efficiency.
2. **Flask**: A lightweight and flexible framework that allows for quick web development. It is known for its simplicity, WSGI compatibility, and community extensions, and is supported by the Pallets organization.
3. **FastAPI**: A modern, high-performance framework for building APIs, known for its speed and ease of use. It features automatic documentation, type hints, asynchronous support, and dependency injection.
4. **Litestar**: An ASGI framework focused on high performance and flexibility. It offers features like data validation, ORM integration, and middleware support, with a strong emphasis on community contributions and sponsorships.
Info
{{ parents_output_text }}
is an automatic context variable that contains the text output of all parent Tasks in the Workflow.
Info
Notice we assign child_ids
to our parallel PromptTask
s and set an id
on the TextSummaryTask
. This ensures the Workflow correctly connects their outputs.
Finally, let’s visualize our Workflow:
from pydantic import BaseModel
from griptape.drivers.prompt.openai_chat_prompt_driver import OpenAiChatPromptDriver
from griptape.drivers.web_search.duck_duck_go import DuckDuckGoWebSearchDriver
from griptape.rules import Rule, Ruleset
from griptape.structures import Workflow
from griptape.tasks import PromptTask, TextSummaryTask
from griptape.tools import WebScraperTool, WebSearchTool
from griptape.utils import StructureVisualizer
class Feature(BaseModel):
name: str
description: str
emoji: str
class Output(BaseModel):
answer: str
key_features: list[Feature]
projects = ["django", "flask", "fastapi", "litestar"]
workflow = Workflow(
rulesets=[
Ruleset(
name="Backstory",
rules=[
Rule("Your name is Oswald."),
Rule("You run 'Oswald's Open Source', a company for helping people learn about open source."),
],
),
],
)
prompt_driver = OpenAiChatPromptDriver(model="gpt-4o")
for project in projects:
task = PromptTask(
id=f"project-research-{project}",
input="Tell me about the open source project: {{ project }}.",
prompt_driver=prompt_driver,
context={"project": project},
output_schema=Output,
tools=[
WebSearchTool(
web_search_driver=DuckDuckGoWebSearchDriver(),
),
WebScraperTool(),
],
child_ids=["summary"],
)
workflow.add_tasks(task)
workflow.add_task(TextSummaryTask(input="{{ parents_output_text }}", id="summary"))
print(StructureVisualizer(workflow).to_url())
Visit the printed URL in your logs to view a diagram illustrating the Workflow’s structure:
Conclusion and Next Steps
That’s it—you’ve built your first generative AI application with Griptape, exploring:
- Simple and advanced Task usage
- Dynamic prompt creation with Jinja templating
- Structured output for more reliable data handling
- Conversation memory for stateful interactions
- Tools for extending LLM capabilities
- Parallel Task orchestration with Workflows
- Text summarization using Engines
This is just the tip of the iceberg. For topic-based guides, continue exploring the Griptape documentation. For more detailed guides, demos, and advanced techniques, check out Griptape Tradeschool.