Skip to main content

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.

Metadata

Release files for smartcomment 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartcomment 0.1.2
File Size Uploaded Provenance Actions
smartcomment-0.1.2.tar.gz 83.0 kB Without provenance Details for smartcomment-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for smartcomment 0.1.2
File Interpreter ABI Platform Actions
smartcomment-0.1.2-py3-none-any.whl Python 3 none any Details for smartcomment-0.1.2-py3-none-any.whl

Total release size: 150.0 kB

Release files / smartcomment-0.1.2.tar.gz

Download URL smartcomment-0.1.2.tar.gz
Size 83.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3d745c06f849eccf759d895cbb295249b637ba8b86cbbe1df12fd0f18f751f08
BLAKE2b-256 checksum
How to use checksums
0a56a101bfd9648f309e20145ef80110b9d0d77d14a3b3aca53fdd6b3b0816ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / smartcomment-0.1.2-py3-none-any.whl

Download URL smartcomment-0.1.2-py3-none-any.whl
Size 66.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4585d83477d20074b8f4759c5a00f38c9475816ec34649ca6315625a4c095761
BLAKE2b-256 checksum
How to use checksums
58b7d5cb57f675273313251684bea889aad53d300769e8eafc5ec48158a7270b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for smartcomment 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page