Skip to main content

Build LLM Agents in a Pythonic way

Project description

PyAgentic

Python Version License: MIT Code style: black Tests

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-core

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)

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

Contributions are welcome! Details coming soon.

Development Setup

# Install dependencies
uv sync --group dev

# Formatting
uv run black -l99 pyagentic

# Linting
uv run flake8 --max-line-length 99 pyagentic

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Release history Release notifications | RSS feed

This version

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyagentic_core-1.0.0.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyagentic_core-1.0.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file pyagentic_core-1.0.0.tar.gz.

File metadata

  • Download URL: pyagentic_core-1.0.0.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pyagentic_core-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1f1012ec1720274a27cfbd87a1ab3d270b859b3a2db2881933f67bf8d05bc7a9
MD5 d9e714d2f36a098386ccef1453d79b7b
BLAKE2b-256 f741445729bb9e3c2b76a7ad7372f021f760e7e5a4b26652418f8bf9658aa37f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyagentic_core-1.0.0.tar.gz:

Publisher: release.yml on rmikulec/pyAgentic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyagentic_core-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyagentic_core-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pyagentic_core-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd10abd602036daed21f9e4ba1a303a82175586712f761eee29d73da28b0326b
MD5 d3a976b64b0e042a8342de4f84ab38e5
BLAKE2b-256 16eb2b695744489e95ec646bf510f13a5fe543bd705a757f7e28de9e5d263ead

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyagentic_core-1.0.0-py3-none-any.whl:

Publisher: release.yml on rmikulec/pyAgentic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page