Skip to main content

smartcomment: A General-Purpose Execution Graph Tracing Package.

Project description

smartcomment

smartcomment is a lightweight Python tracing toolkit for recording execution graphs from existing systems. It lets developers annotate variables, operations, and dependencies without reorganizing the original program.

The package is designed for systems that maintain complex state over time, such as multi-agent systems, memory systems, and data workflows. Instead of only recording events or function calls, smartcomment records how variables flow through developer-specified operations, making the resulting trace useful for visualization, program understanding, and failure attribution.

Installation

Install the core package:

pip install smartcomment

Install optional visualization dependencies:

pip install smartcomment[viz]

For local development from source:

git clone https://github.com/zjunlp/smartcomment.git
cd smartcomment
pip install -e .

Quick Example

from smartcomment import comment_fn, comment_graph


@comment_fn(
    op_name="demo.generate",
    comment="Generate a response from a user query.",
    category="generation",
)
def generate_response(query: str) -> str:
    return "smartcomment records execution graphs."


with comment_graph() as graph:
    response = generate_response("What does smartcomment do?")

print(graph.to_runtime_graph().to_markdown())

Documentation

The repository includes a set of focused guides under docs/.

Citation

If you use smartcomment in your work, please cite:

@misc{deng2026memtracetracingattributingerrors,
      title={MemTrace: Tracing and Attributing Errors in Large Language Model Memory Systems}, 
      author={Xinle Deng and Ruobin Zhong and Hujin Peng and Xiaoben Lu and Yanzhe Wu and Guang Li and Buqiang Xu and Yunzhi Yao and Jizhan Fang and Haoliang Cao and Junjie Guo and Yuan Yuan and Ziqing Ma and Yuanqiang Yu and Rui Hu and Baohua Dong and Hangcheng Zhu and Ningyu Zhang},
      year={2026},
      eprint={2605.28732},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2605.28732}, 
}

License

This project is released under the MIT License.

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

smartcomment-0.1.1.tar.gz (53.9 kB view details)

Uploaded Source

Built Distribution

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

smartcomment-0.1.1-py3-none-any.whl (66.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartcomment-0.1.1.tar.gz
  • Upload date:
  • Size: 53.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for smartcomment-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8dce97f44ac8d36357228966d5df144956e4c0d68b38d3df126c031b23a5a6ee
MD5 476b031c6c4061c22fe415d271c9dc03
BLAKE2b-256 2d78a97813703022e560605a98858a44e6fa945ee071b9b1b723a19b14e27edd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartcomment-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 66.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for smartcomment-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 938203e3a4e40008e2fd92b1ab13a9f4f19cbe3f6d925e76a333fc07e4fc4f7f
MD5 fc2c0e25d3a4427eda80ed6396e6da37
BLAKE2b-256 45206bc8db980b60401f8f783751b59535bed1ec15c754a3e3642381777bb626

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