explaingit

significant-gravitas/gravitasml

Analysis updated 2026-05-18

37Python
This is a quick first-pass explanation. The richer sections — use-cases, tech stack, setup, prompts — are still being generated.

TLDR

GravitasML is a small Python library for parsing simple tag-based markup into Python dictionaries.

Mindmap

A visual breakdown will appear here once this repo is fully enriched.

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

In plain English

GravitasML is a small Python library for parsing simple tag-based markup into Python dictionaries. It was built by the AutoGPT team to handle structured text that AI language models produce, where the output uses XML-style tags to organize data but does not need the full complexity or security risks of a proper XML parser. The main reason to use it instead of a standard XML library is security. Full XML parsers support features like entity expansion and external document references that can be exploited to crash a program or extract data from a server. GravitasML deliberately omits all of those features, so it is safe to run on untrusted output from an AI model or any other source you do not fully control. The library works in two steps: it first breaks the markup text into tokens, then assembles those tokens into a tree and converts the tree to a plain Python dictionary. Nested tags become nested dictionaries. Repeated tags at the same level become a list automatically. Tag names with spaces are normalized to use underscores and lowercase letters. If a section of markup should be kept as a raw string rather than parsed further, you can add a filter marker to the opening tag to suppress parsing for that block. You can also tell the library to convert the parsed result directly into a Pydantic model, which adds field validation on top of the basic parsing. The library does not support tag attributes, self-closing tags, XML namespaces, or generating markup. It is intentionally limited to keep the codebase small and focused on the one task it is designed for.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.