Skip to main content

AgentMark Prompt Core (Python)

Python implementation of the AgentMark prompt-core package. This package provides the high-level runtime for working with AgentMark prompts.

Installation

pip install agentmark-prompt-core

Usage

This package transforms pre-parsed MDX AST trees. The AST is typically obtained by:

  • Parsing MDX with the TypeScript @agentmark-ai/templatedx package
  • Loading a pre-parsed AST from a JSON file
  • Receiving an AST from the AgentMark runtime
import asyncio
import json
from agentmark.prompt_core import create_agentmark, DefaultAdapter

async def main():
    # Create an AgentMark instance with the default adapter
    agentmark = create_agentmark(adapter=DefaultAdapter())

    # Load a pre-parsed MDX AST (from TypeScript parser or JSON file)
    with open("math.prompt.mdx.json") as f:
        ast = json.load(f)

    # Load and format a text prompt
    prompt = await agentmark.load_text_prompt(ast)
    result = await prompt.format(props={"userMessage": "What is 2+2?"})

    print(result)

asyncio.run(main())

Features

  • Prompt Types: Text, Object, Image, and Speech prompts
  • Message Extraction: System, User, and Assistant message roles
  • Attachments: Image and file attachments in User messages
  • Schema Validation: Pydantic-based validation matching TypeScript Zod schemas
  • Adapters: Extensible adapter interface for different LLM providers
  • Eval Registry: Registry for evaluation functions

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
ruff check src tests

# Run type checking
mypy src/agentmark --strict

License

MIT

TypeScript parity roadmap

Known gaps vs @agentmark-ai/prompt-core, tracked as roadmap items:

  • built_in_models validation — TS createAgentMark({ builtInModels }) has no Python equivalent yet.

Metadata

Release files for agentmark-prompt-core 0.12.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 agentmark-prompt-core 0.12.2
File Size Uploaded Provenance Actions
agentmark_prompt_core-0.12.2.tar.gz 152.8 kB Without provenance Details for agentmark_prompt_core-0.12.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentmark-prompt-core 0.12.2
File Interpreter ABI Platform Actions
agentmark_prompt_core-0.12.2-py3-none-any.whl Python 3 none any Details for agentmark_prompt_core-0.12.2-py3-none-any.whl

Total release size: 223.0 kB

Release files / agentmark_prompt_core-0.12.2.tar.gz

Download URL agentmark_prompt_core-0.12.2.tar.gz
Size 152.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c4ae9ada4e83f0e76e1dff767d51133065fb4fb2f247ac7a87accbb1b6c1110b
BLAKE2b-256 checksum
How to use checksums
c7b72f8d02d8ab8d661b24e78074c2c1b2ca0412ea302928a82606548c32b8b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / agentmark_prompt_core-0.12.2-py3-none-any.whl

Download URL agentmark_prompt_core-0.12.2-py3-none-any.whl
Size 70.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be15ced0db843e09d32d1a7d189d4d907e15a20c06c36c1d7c5f1c0bf8ab9a4b
BLAKE2b-256 checksum
How to use checksums
e6af866e853529b99714dd03f3b3c07d9878eab26afb8e0387be0073677a8e5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for agentmark-prompt-core 0.12.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