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/templatedxpackage - 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_modelsvalidation — TScreateAgentMark({ builtInModels })has no Python equivalent yet.
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.12.2.tar.gz
(152.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentmark_prompt_core-0.12.2.tar.gz.
File metadata
- Download URL: agentmark_prompt_core-0.12.2.tar.gz
- Upload date:
- Size: 152.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4ae9ada4e83f0e76e1dff767d51133065fb4fb2f247ac7a87accbb1b6c1110b
|
|
| MD5 |
dd45cb9eda34513e3e34be080bfea545
|
|
| BLAKE2b-256 |
c7b72f8d02d8ab8d661b24e78074c2c1b2ca0412ea302928a82606548c32b8b1
|
File details
Details for the file agentmark_prompt_core-0.12.2-py3-none-any.whl.
File metadata
- Download URL: agentmark_prompt_core-0.12.2-py3-none-any.whl
- Upload date:
- Size: 70.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be15ced0db843e09d32d1a7d189d4d907e15a20c06c36c1d7c5f1c0bf8ab9a4b
|
|
| MD5 |
e87e622a7083851e44b162a4458de26a
|
|
| BLAKE2b-256 |
e6af866e853529b99714dd03f3b3c07d9878eab26afb8e0387be0073677a8e5d
|