Skip to main content

Official Python SDK for Make Your Agent (MYA) — build AI agents with knowledge bases, tool execution, streaming chat, and per-session token usage

Project description

makeyouragent (Python SDK)

Official Python SDK for Make Your Agent (MYA) — build AI agents with knowledge bases, tool execution, file/image attachments, streaming chat, and per-session token usage.

This is the server-side SDK, feature-equivalent to the Node SDK's server module (@makeyouragent/sdk).

Install

pip install makeyouragent

Quick Start

from makeyouragent import MakeYourAgent

mya = MakeYourAgent(api_key="mya_live_...")

# Create an agent
agent = mya.agents.create({
    "name": "Support Bot",
    "systemPrompt": "You are a helpful support agent.",
})

# Chat (blocking)
res = mya.chat.send(agent["id"], {"message": "What can you help me with?"})
print(res["message"]["content"])
print(res["usage"])         # tokens for THIS call
print(res["sessionUsage"])  # cumulative {totals, byModel} for the whole conversation

# Chat (streaming)
stream = mya.chat.stream(agent["id"], {"message": "Tell me a story"})
for chunk in stream:
    if chunk.type == "content":
        print(chunk.delta, end="", flush=True)
final = stream.final_response()

# Knowledge bases
kb = mya.knowledge_bases.create(agent["id"], {"name": "Docs", "sourceType": "MARKDOWN"})
mya.knowledge_bases.import_(agent["id"], kb["id"], {
    "content": "# Getting Started\n\nWelcome...",
    "title": "Getting Started",
})

# File / image uploads
with open("manual.pdf", "rb") as f:
    mya.files.upload(agent["id"], f.read(), filename="manual.pdf")

# Token usage (billing) — reconcile invoices. from_/to are Unix seconds.
usage = mya.usage.get(from_=1748736000, to=1751327999)
print(usage["totals"]["totalTokens"], usage["byModel"])

Resources

Namespace Methods
mya.agents create, list, get, update, delete
mya.chat send, stream
mya.knowledge_bases create, list, get, delete, import_, search
mya.files upload
mya.images upload
mya.usage get

Use mya.request(path, method=..., body=...) for endpoints not covered by a resource (returns the raw httpx.Response).

Errors

All API and transport failures raise MakeYourAgentError with .status, .code, and .data.

from makeyouragent import MakeYourAgentError

try:
    mya.agents.get("does-not-exist")
except MakeYourAgentError as e:
    print(e.status, e.code, e.message)

Configuration

MakeYourAgent(
    api_key="mya_live_...",
    base_url="https://api.makeyouragent.ai",  # default
    timeout=30.0,                              # seconds
    max_retries=3,                             # retries on 5xx with backoff
)

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

makeyouragent-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

makeyouragent-0.1.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file makeyouragent-0.1.0.tar.gz.

File metadata

  • Download URL: makeyouragent-0.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.11

File hashes

Hashes for makeyouragent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e659a658896a284d31046fa7b8db530262e586bc85161bad0b01cc57641dbfcc
MD5 9ec93ead8c2eecbf67957991f233de76
BLAKE2b-256 a4c4c1609dfa4392cb9590ef75a6046c9fad9c2ed4d93e4d6d35a392c9841a67

See more details on using hashes here.

File details

Details for the file makeyouragent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for makeyouragent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a4fb47db9aa2e0030fde008cfdd97245777bef736852c14cff735261e640876
MD5 37ff0cd7c723224369943bd2f29c7922
BLAKE2b-256 ac20daf90a255c2206307d68997f1e8ad5d88a248157714e4cbdd8fef8829f96

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