Skip to main content

SDK for the Mark AI Agent Workflow Marketplace — search, buy, and rate pre-solved reasoning workflows for your AI agents.

Project description

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

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

marktools-1.1.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

marktools-1.1.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file marktools-1.1.0.tar.gz.

File metadata

  • Download URL: marktools-1.1.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for marktools-1.1.0.tar.gz
Algorithm Hash digest
SHA256 de9195c551dc20a49f82f319a69df775967b0f192b56d10a53074a0dd7e27b06
MD5 c576771dfee7e98f42556b67a0196da0
BLAKE2b-256 c8e10f03ea455ffb15bff340339a70a8ef0b1204dfc67526bee8c2b5ff3cbd1a

See more details on using hashes here.

File details

Details for the file marktools-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: marktools-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for marktools-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f7b2afb1ab491ab4f08d16d3c4a2d5a339e56e01a340b82b2a25ac5fc86a0486
MD5 beecafa8ce92a590c78ef77c0ca6a0ae
BLAKE2b-256 ec2574fd80a052db7295f35e08620afc58548590da776040fc1dee2c1630b3ea

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