Skip to main content

marktools

The SDK that lets AI agents buy pre-solved reasoning workflows.

PyPI Python License

marktools gives your AI agents access to a marketplace of expert-crafted, pre-solved reasoning workflows. Instead of spending thousands of tokens figuring out how to file Ohio taxes or plan a multi-city trip from scratch, your agent calls mark.estimate(), gets a price quote, and buys a battle-tested solution — complete with step-by-step instructions, edge cases, and domain knowledge.

Quick Start

pip install marktools

3 Lines to Supercharge Any Agent

from marktools import MarkClient

mark = MarkClient()

# 1. Estimate — is the marketplace worth it? (free, no credits)
estimate = mark.estimate("File Ohio 2024 taxes with W2 and itemized deductions")

# 2. Buy — purchase the best solution
receipt = mark.buy(estimate.session_id, estimate.best_solution.solution_id)

# 3. Use — step-by-step instructions, edge cases, domain knowledge
for wf in receipt.execution_plan.workflows:
    print(f"📋 {wf.workflow_title}")
    for step in wf.workflow.steps:
        print(f"  Step {step['step']}: {step['thought']}")

One-shot: solve()

# Auto-estimate + auto-buy the best solution in one call
receipt = mark.solve("File Ohio 2024 taxes with W2 and itemized deductions")
print(f"Tokens charged: {receipt.tokens_charged}")

Use with Claude (Anthropic)

from marktools import MarkTools
from anthropic import Anthropic

mark = MarkTools()
client = Anthropic()

response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=4096,
    tools=mark.to_anthropic(),   # ← plug in the tools
    messages=[{"role": "user", "content": "Help me file my Ohio taxes for 2024"}],
)

# Execute tool calls
for block in response.content:
    if block.type == "tool_use":
        result = mark.execute(block.name, block.input)
        print(f"Tool: {block.name} → {result[:200]}")

Use with OpenAI

from marktools import MarkTools
from openai import OpenAI

mark = MarkTools()
client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4o",
    tools=mark.to_openai(),      # ← plug in the tools
    messages=[{"role": "user", "content": "Help me file my Ohio taxes for 2024"}],
)

# Execute tool calls
for call in response.choices[0].message.tool_calls or []:
    import json
    result = mark.execute(call.function.name, json.loads(call.function.arguments))

Use with LangChain

from marktools import MarkTools

mark = MarkTools()
tool_definitions = mark.to_langchain()

Tools Reference

marktools exposes 3 core tools + 1 optional:

Tool Cost Description
mark_estimate Free Search marketplace, get pricing & ranked solutions
mark_buy Credits Purchase solution, get full execution plan
mark_rate Free Rate a workflow after use (improves marketplace)
mark_search Free Browse/filter marketplace workflows

mark_estimate — Search & Price

estimate = mark.client.estimate(
    query="File Ohio 2024 taxes with W2 and itemized deductions",
    context={"state": "ohio", "year": 2024, "income": 87000}
)

# Returns ranked solutions:
for sol in estimate.solutions:
    print(f"  {sol.solution_id}: {sol.pricing.total_cost_tokens} tokens "
          f"({sol.pricing.savings_percentage}% savings)")

mark_buy — Purchase Solution

receipt = mark.client.buy(
    session_id=estimate.session_id,
    solution_id="sol_1"
)

# Full execution plan with steps, edge cases, domain knowledge:
for wf in receipt.execution_plan.workflows:
    for step in wf.workflow.steps:
        print(f"  {step['step']}. {step['action']}: {step['thought']}")

mark_rate — Post-Use Feedback

mark.client.rate("ohio_w2_itemized_2024", rating=5)
# or
mark.client.rate("ohio_w2_itemized_2024", vote="up")

Privacy-First Architecture

All data is sanitized before hitting the marketplace:

result = mark.client.sanitize({
    "name": "John Smith",           # ← removed
    "ssn": "123-45-6789",           # ← removed
    "exact_income": 87432.18,       # ← bucketed to "80k-100k"
    "state": "ohio",                # ← kept
    "year": 2024,                   # ← kept
})
# public_query: {"state": "ohio", "year": 2024, "exact_income": "80k-100k"}
# private_data: {"name": "John Smith", "ssn": "123-45-6789"}

Names, SSNs, emails, and exact incomes never leave the agent's local environment.


Models

All responses are typed Pydantic models:

from marktools import (
    Workflow,           # Marketplace workflow template
    Solution,           # Ranked solution candidate
    EstimateResult,     # Response from estimate()
    PurchaseReceipt,    # Response from buy()
    RateResult,         # Response from rate()
)

Configuration

from marktools import MarkClient

# Option 1: Default (uses https://mark-ai-vqcd.onrender.com)
mark = MarkClient()

# Option 2: Custom API URL (self-hosted)
# export MARK_API_URL=http://localhost:5001
mark = MarkClient(base_url="http://localhost:5001")
Env Variable Description Default
MARK_API_URL API base URL https://mark-ai-vqcd.onrender.com
MARK_API_KEY Optional API key —

Development

# Clone the repo
git clone https://github.com/akhaire21/treehacks-2026
cd treehacks-2026/marktools

# Install in dev mode
pip install -e ".[dev]"

# Run tests
pytest

# Type checking
mypy src/marktools

# Lint
ruff check src/

License

MIT

Metadata

Release files for marktools 1.1.0

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

Source distribution (sdist)

Source distribution for marktools 1.1.0
File Size Uploaded Provenance Actions
marktools-1.1.0.tar.gz 18.1 kB Without provenance Details for marktools-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 36.5 kB

Release files / marktools-1.1.0.tar.gz

Download URL marktools-1.1.0.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
de9195c551dc20a49f82f319a69df775967b0f192b56d10a53074a0dd7e27b06
BLAKE2b-256 checksum
How to use checksums
c8e10f03ea455ffb15bff340339a70a8ef0b1204dfc67526bee8c2b5ff3cbd1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / marktools-1.1.0-py3-none-any.whl

Download URL marktools-1.1.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7b2afb1ab491ab4f08d16d3c4a2d5a339e56e01a340b82b2a25ac5fc86a0486
BLAKE2b-256 checksum
How to use checksums
ec2574fd80a052db7295f35e08620afc58548590da776040fc1dee2c1630b3ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for marktools 1.1.0

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