1 of 2 release files were uploaded without provenance metadata. View details.
Agenty
A Pythonic framework for building AI agents and LLM pipelines, powered by pydantic-ai. The framework emphasizes simplicity and maintainability without sacrificing power, making it an ideal choice for rapid prototyping.
Agenty provides a clean, type-safe interface for creating:
- Conversational AI agents with structured inputs and outputs
- LLM pipelines
- Complex agent interactions with minimal boilerplate
Key Features
- Built on pydantic-ai for type validation
- Automatic conversation history management
- Intuitive Pythonic interfaces
The framework is currently only officially tested with the OpenAI API (through a proxy such as LiteLLM/OpenRouter) although theoretically it supports all the models supported by pydantic-ai.
Installation
pip install agenty
Or with uv:
uv add agenty
Quick Preview
Here's a simple example to get started:
import asyncio
from agenty import Agent
from pydantic_ai.models.openai import OpenAIModel
async def main():
agent = Agent(
model=OpenAIModel(
"gpt-4o",
api_key="your-api-key"
),
system_prompt="You are a helpful and friendly AI assistant."
)
response = await agent.run("Hello, how are you?")
print(response)
asyncio.run(main())
In most cases, to build a custom AI agent, you'll want to create your own class that inherits from Agent. The below is functionally equivalent to the above code (and is the recommended way to use this framework)
import asyncio
from agenty import Agent
from pydantic_ai.models.openai import OpenAIModel
class Assistant(Agent):
model = OpenAIModel("gpt-4o", api_key="your-api-key")
system_prompt = "You are a helpful and friendly AI assistant."
async def main():
agent = Assistant()
response = await agent.run("Hello, how are you?")
print(response)
asyncio.run(main())
Tools
Add capabilities to your agents with simple decorators:
class WeatherAgent(Agent):
system_prompt = "You help users check the weather."
def __init__(self, location: str):
super().__init__()
self.location = location
self.temperature = 72 # Simulated temperature
@tool
def get_temperature(self) -> float:
"""Get the current temperature."""
return self.temperature
@tool
def get_location(self) -> str:
"""Get the configured location."""
return self.location
Structured I/O
Define type-safe inputs and outputs for predictable behavior:
from agenty import Agent
from agenty.types import BaseIO
class User(BaseIO):
name: str
age: int
hobbies: List[str]
class UserExtractor(Agent[str, User]):
input_schema = str
output_schema = User
system_prompt = "Extract user information from the text"
Agent Pipelines
Chain multiple agents together for complex workflows:
class TextCleaner(Agent[str, str]):
model = OpenAIModel("gpt-4o-mini", api_key="your-api-key")
system_prompt = "Clean and format the input text"
class SentimentAnalyzer(Agent[str, str]):
model = OpenAIModel("gpt-4o-mini", api_key="your-api-key")
system_prompt = "Analyze the sentiment of the text"
# Create and use the pipeline
pipeline = TextCleaner() | SentimentAnalyzer()
result = await pipeline.run("This is my input text!")
Templates
Create dynamic prompts with Jinja templates:
class DynamicGreeter(Agent):
system_prompt = """
You are a greeter who:
- Speaks in a {{TONE}} tone
- Gives {{LENGTH}} responses
"""
TONE: str = "friendly"
LENGTH: str = "concise"
Hooks
Transform inputs and outputs with hooks:
class MyAgent(Agent[str, str]):
@hook.input
def add_prefix(self, input: str) -> str:
return f"prefix_{input}"
@hook.output
def add_suffix(self, output: str) -> str:
return f"{output}_suffix"
📚 Like what you see? Read the Documentation to learn more!
Requirements
- Python >= 3.12
License
MIT License - see the LICENSE file for details.
Author
Jonathan Chun (@jonchun)
Metadata
Release files for agenty 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Incomplete provenance
1 of 2 files were uploaded without provenance metadata.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agenty-0.2.1.tar.gz | 121.9 kB | With provenance | Details for agenty-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agenty-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for agenty-0.2.1-py3-none-any.whl |
Total release size: 145.7 kB
Release files / agenty-0.2.1.tar.gz
Incomplete provenance
This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.
We recommend further investigation before installing this file. View details.
| Download URL | agenty-0.2.1.tar.gz |
|---|---|
| Size | 121.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
757743a2a821a93135ca259b9ff7cea93b92bbeb4492376a6e66908c7d653ad9
|
|
BLAKE2b-256 checksum How to use checksums |
57f36cf59f4abcb6d061c0e547cb15fdda348ffac0a3079c97e0615f099f9285
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 11, 2025.
Transparency logRelease files / agenty-0.2.1-py3-none-any.whl
Incomplete provenance
This file belongs to a release with incomplete provenance: while other files in this release have provenance metadata, this file does not.
We recommend further investigation before installing this file. View details.
| Download URL | agenty-0.2.1-py3-none-any.whl |
|---|---|
| Size | 23.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8be1b1ba74442b4a59c9e32351f1dc6b36f8de3c1a06d4ce75785f1eb4ca5757
|
|
BLAKE2b-256 checksum How to use checksums |
66ae11f898242e242db9a99d57c6609710d46555635e55c2038902d6ac2f8236
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.5.30
|
Security for agenty 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Incomplete provenance
1 of 2 release files were uploaded without provenance metadata.
Attestation for agenty-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 11, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.