Skip to main content

Experimental aware runtime framework for Python.

Project description

from src.py_alive import AliveTagfrom src.py_alive import alive_tool

PyAlive

Experimental runtime aware framework for Python.

⚠️ Early development version. API may change.

Your Python class is the agent.

from py_alive import BaseAlive, AliveTag, AliveField, alive_agent, alive_tool
import asyncio
from pydantic_ai import AudioUrl
from pydantic_ai.models.test import TestModel


class Translator(BaseAlive):
    """"""
    text: str = AliveField(default="", description="the text to translate")  # this is for the agents. for you its just normal str!
    
    def __init__(self, text: str):
        super().__init__()
        self.text = text
    
    @alive_agent(llms=TestModel(), exclude=["*"]) #include=[AliveTag("memory")]) <- this will cause error in TestModel(). it will call it with memory 'a' - which not exist
    async def translate(self, specific_instruction: str) -> str:
        """translate memory text to hebrew"""
    
    async def some_func(self) -> str:
        self.text += "its a nice day today. do you know that?"
        if len(self.text) > 100:
            return "oy vey"
        else:
            return await self.translate(specific_instruction="also translate it to arabic")
    
    @alive_agent(llms=TestModel(), exclude=['*'])
    async def transcribe_audio(self, url: AudioUrl) -> str:
        """transcript"""



print(asyncio.run(Translator("hello world").translate()))
print(asyncio.run(Translator("hello world").some_func()))
print(asyncio.run(Translator("hello world").transcribe_audio(url=AudioUrl(url=""))))

install

uv add py-alive

concepts

AliveField — the agent's memory. described, typed, visible to agents. # memory cannot be modified now!

name: str = AliveField[str](default="", description="the customer's name")

@alive_agent — turns a method into an agent. docstring is the prompt.

@alive_agent(llm="openai:gpt-4o")
async def summarize(self) -> str:
    """return a 2 sentence summary of memory content"""

<tool description> — wrap part of the docstring to expose the method as a tool to other agents.

async def clean(self) -> str:
    """<cleans and normalizes memory 'text'>
    remove punctuation, lowercase, strip whitespace
    """

AliveTag — group fields or methods, control agent visibility.

# @AliveTag("memory") -> coming soon for memories. for now all memories are under include/exclude=[AliveTag("memory")] 
name: str = AliveField[str](...)

@alive_agent(llm="openai:gpt-4o", include=[AliveTag("memory")])
async def greet(self) -> None: ...

multiple LLMs → list back

@alive_agent(llm=["openai:gpt-4o", "anthropic:claude-sonnet-4-5"])
async def translate(self) -> list[str]:
    """translate memory 'text' to hebrew"""

  • llms are pydantic-ai models. simple usage: pydantic-ai models
  • don't forget to add your env vars,
OPENAI_API_KEY=""
ANTHROPIC_API_KEY=""
GEMINI_API_KEY=""

etc.. (only what you use)

coming soon

t.auto(task="...", include/exclude=[...])  # autonomous agent over all tools
t.export_as_mcp(port=8000)         # instant MCP server
t.graph                            # visualize agent call graph

built on pydantic-ai

Project details


Download files

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

Source Distribution

py_alive-0.1.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

py_alive-0.1.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file py_alive-0.1.1.tar.gz.

File metadata

  • Download URL: py_alive-0.1.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for py_alive-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d4023f59d4769714dcc7f8df3ecbb23c25f6f7ad3a34ec08c8ece2fbfc9f955
MD5 a7c493452d7c4389f42b9ac35d1ad21c
BLAKE2b-256 7c78f8650a96bb3d234210da9dddc6d73b71fc570366fda54309fe6badb45cad

See more details on using hashes here.

File details

Details for the file py_alive-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: py_alive-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for py_alive-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 698565a10713062588c0bd1e460bf8a58eb7cd40c648ae795b35d14afadd2aa6
MD5 ee1444d5342df9e0944e07c9b185abe8
BLAKE2b-256 126991df19b00f3dfd53dd970adf28fcfcdf6f283cfca111d258ff7da8a64c0d

See more details on using hashes here.

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