magentic
Python decorators that turn typed functions into LLM prompts, combining structured outputs, streaming and tool calls with ordinary Python control flow.
Tags
Description
Install pip install magentic (PyPI 0.41.1; Python 3.10+). @prompt and @chatprompt return values conforming to Python/Pydantic return types. Features include streaming structured results and function calls, LLM-assisted retries, asyncio and OpenTelemetry/Logfire integration. Supports OpenAI, Anthropic and LiteLLM backends and OpenAI-compatible servers; configure provider credentials or a local backend separately. MIT-licensed library.
Agent access
Related
- Pydantic Logfire: OpenTelemetry-based observability platform from the Pydantic team for tracing LLM apps and agents, with SQL querying and evals.
Sources
- https://github.com/jackmpcollins/magentic
- https://github.com/jackmpcollins/magentic/blob/main/LICENSE
- https://pypi.org/project/magentic/
Machine-readable
- JSON
- Markdown
- Source file on GitHub (edit via pull request)