Skip to main content

Python prompt-core package for AgentMark - high-level runtime for working with AgentMark prompts

Project description

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.

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

agentmark_prompt_core-0.9.0.tar.gz (137.8 kB view details)

Uploaded Source

Built Distribution

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

agentmark_prompt_core-0.9.0-py3-none-any.whl (64.5 kB view details)

Uploaded Python 3

File details

Details for the file agentmark_prompt_core-0.9.0.tar.gz.

File metadata

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

File hashes

Hashes for agentmark_prompt_core-0.9.0.tar.gz
Algorithm Hash digest
SHA256 8ee5315d9cf22c5ab4de2bd36f62c7c9d32a745fe42ba57ff8b2dbaf3da112b8
MD5 20f3f61f3138e18fd84735676a497a93
BLAKE2b-256 342dcbe7cc190ef57b4dfaa6f1818f78da17020bda3b8a58bebe3ef68f50a30d

See more details on using hashes here.

File details

Details for the file agentmark_prompt_core-0.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentmark_prompt_core-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9adf65660c9df51e956afd776234e65c0ffc8b0e413e0a82b340e3f00b785f5
MD5 5e66926abf2f193a77f403c4ca3548b8
BLAKE2b-256 f288a5c28f608d5e9896ca9c56aa61d8fdf362c2019a463b2e486b854a706dad

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