Skip to main content

TextPy: Collaborative Agent Workflow through Programming and Prompting

Project description

TextPy

TextPy ── Collaborative Agent Workflow through Programming and Prompting

🚀 Core Philosophy

P1: Workflow = Programming + Prompting
P2: Programming <-> Prompting
P3: Workflow = Function Signature with Comment

⚡ Revolutionary Features

  • Mixed-Execution: Seamlessly integrates with legacy code
  • AICompiler: Just write function signatures, our powerful compiler will automatically generate natural language instructions or code instructions just in time
  • Self-Replication: Easier implementation of recursive workflows

🔧 Usage

Installation

$ pip install textpy-llm

In your python script, include the line

import textpy

Or use the image to run your code

$ docker pull ghcr.io/yezhengmao1/textpy:latest

🛠️ Quick Start - Simple Example

# examples/write_poem.py
from textpy import code, text

# the text/code will auto-generated by AICompiler(Just in Time)
# we use the litellm to call large language model, default model is deepseek/deepseek-chat
# if you want to use different large language model, @code(api_key="", base_url="", model="")

@text
def generate_poem(*, theme: str, style: str) -> str: ...

@code
# text should in center of the SVG, use a white background, add visually striking elements
def create_svg_from_text_with_svgwrite(*, text: str) -> str: ...

@code
def save_svg_to_file(*, svg: str, path: str): ...

# execute this code
poem = generate_poem(theme="Quantum Physics and Romance", style="haiku")
svg = create_svg_from_text_with_svgwrite(text=poem)
save_svg_to_file(svg=svg, path="poem.svg")

🤩 Quick Start - Awesome Example

Example: Download pdf from arxiv using the arxiv id, extract text from the papers, and summarize them. What makes it powerful is that it can recursively read all cited references and perform the same operations on them. Then it displays the relationships between them in an HTML file. When the script is running, visit localhost:31108 to check if the script is executing correctly, and visit localhost:31108/arxiv.html to view the results.

Highlight: All the functionalities in these workflows are generated by AICompiler in TextPy (including calling and installing other Python packages), while all you do is write function definitions (function signatures) and ... provide comments!!

NOTE: We strongly recommend running this script within a container, as our powerful AICompiler manipulates the external environment during compilation, which can affect your system. You can still run the script directly, refer to examples/arxiv_search.sh for details.

cd ./examples
DEEPSEEK_API=xxx CACHE_DIR="/workspace/.cache" ARXIV_ID=<xxxx.xxxx> ./arxiv_search.sh

Example Video

📌 Contributing

Community contributions are more than welcome, whether it be to fix bugs or to add new features at github.

📜 Citation

@misc{ye2025textpy,
  author = {Zhengmao Ye, Shuyun Yang, Zelong Huang, Jie Zuo, Mingjie Tang},
  title = {TextPy: Collaborative Agent Workflow through Programming and Prompting},
  year = {2025},
  howpublished = {\url{https://github.com/yezhengmao1/TextPy}}
}

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

textpy_llm-0.1.2.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

textpy_llm-0.1.2-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file textpy_llm-0.1.2.tar.gz.

File metadata

  • Download URL: textpy_llm-0.1.2.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for textpy_llm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8daa005babb39a6b55255176cf17b6217e8e3a85bb9d7a129718070f1fbca807
MD5 799c7a1938fdbfbbc9d9a546bdb1a899
BLAKE2b-256 7ee92fc9311039696bea34099acebd6c5e634616cf567e2959d184b37826ed91

See more details on using hashes here.

Provenance

The following attestation bundles were made for textpy_llm-0.1.2.tar.gz:

Publisher: python-publish.yml on yezhengmao1/TextPy

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

File details

Details for the file textpy_llm-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: textpy_llm-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for textpy_llm-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5af5a2d2f04791cbc53a8160a75e1088d2af280427b472aa893eb8e5b8c3d729
MD5 5afb2045b9c0585d36eb6fd887b652cd
BLAKE2b-256 d65e67b93aed03b123d9ca5f54f685e7aa5f4227894287edd5db07b954dfa4c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for textpy_llm-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on yezhengmao1/TextPy

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