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

Install via pip:

$ pip install textpy-llm

Import in your Python script:

import textpy

Or use our Docker image:

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

👾 Quick Start - Amazing Example - Daily arXiv

Example: Automatically fetch daily updates from arXiv, filter papers by topic, translate abstracts into Chinese, store them in a database, and generate a markdown file to display the abstracts.

😊Real-world Use Case: I personally use TextPy to periodically push these generated markdown files to my blog when new papers are available.

Browse the results at: Daily arXiv

Highlight: You only need to define the functions and use them in your workflow. Our powerful AICompiler recognizes their purpose, automatically generating and executing the necessary code or creating prompts for large language model interaction.

see examples/daily_arxiv.py for the complete implementation.

@code
def get_the_rss_xml_file_str(*, url: str) -> str: ...

@code(pypi=[get_the_rss_xml_file_str(url=ARXIV_URL)])
def get_all_item_in_the_rss_file(*, xml_file_str: str) -> list[dict]: ...

@text
def check_topic_is_satisfactory(*, abstrct: str, topic: str) -> bool: ...

@text
def translate_the_en_abstract_to_zh(*, abstract: str) -> str: ...

@code
def check_link_in_db(*, db_path: str, link: str) -> bool: ...

@code
def save_article_to_db(*, db_path: str, item: dict): ...
# These functions only need to be defined...

🤩 Quick Start - Awesome Example - Deep Paper

Example: Download PDFs from arXiv using their IDs, extract text, generate summaries, and recursively process all cited references. The system visualizes the relationships between papers in an interactive HTML file.

Highlight: All functions in the workflow is generated by TextPy's AICompiler, including installation and usage of external Python packages. Your only responsibility is writing function signatures with clear comments, and the workflow!

NOTE: We strongly recommend running this script in a container since the AICompiler manipulates the external environment during compilation.

To run with Docker:

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

See It In Action:

TextPy Example

📌 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.4.tar.gz (14.1 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.4-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: textpy_llm-0.1.4.tar.gz
  • Upload date:
  • Size: 14.1 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.4.tar.gz
Algorithm Hash digest
SHA256 a43f0ce73ed2e8af794d280fc3e4eb9e0f4be7270cad61578b63af13164baa69
MD5 840d7bc3c010487565bde8aa504ecab5
BLAKE2b-256 584f67d65bd9040593fd06073ee363c1e305d52fb9614eb8df4f14e94ccb8a4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for textpy_llm-0.1.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: textpy_llm-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.8 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f8ab22426d45976cb85b62f88a176df57df59f747e297f2dedeb987a62959cab
MD5 367ebbaddfd217957dc6c4fc549d3f2a
BLAKE2b-256 0cfda2470cb1c64adb5cd0429ba75a1d9c044cc324df181171aca08bb2fa9d99

See more details on using hashes here.

Provenance

The following attestation bundles were made for textpy_llm-0.1.4-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