Build LLM Agents in a Pythonic way
Project description
PyAgentic
A declarative framework for building AI agents with OpenAI integration. PyAgentic provides a clean, type-safe way to create intelligent agents using Python's metaclass system and modern async patterns.
✨ Features
- Declarative Agent Definition - Define agents using simple class-based syntax
- Type Safety - Full typing support with Pydantic integration
- Tool Integration - Easy function decoration for agent capabilities
- Context Management - Sophisticated context handling with lifecycle management
- OpenAI Integration - Native support for OpenAI's API with automatic schema generation
- Async Support - Built-in async/await support for scalable applications
- Extensible - Clean architecture for custom tools, context types, and validations
🚀 Quick Start
Installation
pip install pyagentic
Basic Example
from pyagentic import Agent, tool, ContextItem
from typing import List
class WeatherAgent(Agent):
"""An agent that provides weather information."""
location: str = ContextItem(description="Current location")
@tool
def get_weather(self, city: str) -> str:
"""Get current weather for a city."""
# Your weather API logic here
return f"The weather in {city} is sunny and 75°F"
@tool
def get_forecast(self, city: str, days: int = 5) -> List[str]:
"""Get weather forecast for multiple days."""
return [f"Day {i+1}: Partly cloudy" for i in range(days)]
# Create and use the agent
agent = WeatherAgent(location="San Francisco")
response = await agent.run("What's the weather like in New York?")
print(response)
📚 Documentation
- User Guide - Complete guide to using PyAgentic
- API Reference - Detailed API documentation
- Examples - Real-world examples and use cases
- Contributing - How to contribute to PyAgentic
🏗️ Project Structure
pyagentic/
├── pyagentic/ # Core framework code
│ ├── _base/ # Internal implementation
│ └── __init__.py # Public API
├── tests/ # Test suite
│ ├── _base/ # Core tests
│ ├── integration/ # Integration tests
│ └── performance/ # Performance tests
├── examples/ # Example agents
├── templates/ # Agent templates
├── docs/ # Documentation
├── scripts/ # Utility scripts
└── notebooks/ # Jupyter notebooks
🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Clone the repository
git clone https://github.com/pyagentic/pyagentic.git
cd pyagentic
# Install in development mode
make install-dev
# Run tests
make test
# Format code
make format
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- OpenAI for their excellent API and models
- The Python community for amazing tools and libraries
- All contributors who help make this project better
Made with ❤️ by the PyAgentic Team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyagentic_core-1.0.0a4.tar.gz.
File metadata
- Download URL: pyagentic_core-1.0.0a4.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d8d9bddf02be90612fc56132461ea3905a23d2b105015b959ec4d803c5b1b64
|
|
| MD5 |
75f97ff665c80e2c2b378953dcbb3f7c
|
|
| BLAKE2b-256 |
4b7d5878ca585435f741c35dd3aba88f6ab76e6b8fe66a918e142ec447b7a2e5
|
Provenance
The following attestation bundles were made for pyagentic_core-1.0.0a4.tar.gz:
Publisher:
release.yml on rmikulec/pyAgentic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyagentic_core-1.0.0a4.tar.gz -
Subject digest:
2d8d9bddf02be90612fc56132461ea3905a23d2b105015b959ec4d803c5b1b64 - Sigstore transparency entry: 360518964
- Sigstore integration time:
-
Permalink:
rmikulec/pyAgentic@ba8faac7ddf0f037499643f65c45d065b4dde886 -
Branch / Tag:
refs/heads/feat/auto-release - Owner: https://github.com/rmikulec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ba8faac7ddf0f037499643f65c45d065b4dde886 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyagentic_core-1.0.0a4-py3-none-any.whl.
File metadata
- Download URL: pyagentic_core-1.0.0a4-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b4cd17bc23d602b3f19b7b62e38556bf39259ea1b01f1e639adfb42e80a8154
|
|
| MD5 |
6333009fd64dbd3cba7630ce34d75731
|
|
| BLAKE2b-256 |
dbf83bfb4f7cd713def03e376b29a19a5b06a1551c562afba05152ff6ff3ec92
|
Provenance
The following attestation bundles were made for pyagentic_core-1.0.0a4-py3-none-any.whl:
Publisher:
release.yml on rmikulec/pyAgentic
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyagentic_core-1.0.0a4-py3-none-any.whl -
Subject digest:
9b4cd17bc23d602b3f19b7b62e38556bf39259ea1b01f1e639adfb42e80a8154 - Sigstore transparency entry: 360518997
- Sigstore integration time:
-
Permalink:
rmikulec/pyAgentic@ba8faac7ddf0f037499643f65c45d065b4dde886 -
Branch / Tag:
refs/heads/feat/auto-release - Owner: https://github.com/rmikulec
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ba8faac7ddf0f037499643f65c45d065b4dde886 -
Trigger Event:
push
-
Statement type: