Skip to main content

Python SDK for AI Agents - Semantic Intelligence for AI builders

Project description

AI SDK for Python

Python SDK for invoking Metadata Dynamic Agents from your AI applications.

Installation

pip install data-ai-sdk

With LangChain integration:

pip install data-ai-sdk[langchain]

Quick Start

from ai_sdk import AISdk

client = AISdk(
    host="https://your-metadata-instance.com",
    token="your-bot-jwt-token"
)

# default AskCollate agent
response = client.agent().call("What data quality tests should I add for the customers table?")
print(response.response)

# Named dynamic agent
response = client.agent("DataQualityPlannerAgent").call(
    "What data quality tests should I add for the customers table?"
)
print(response.response)

Streaming

for event in client.agent("DataQualityPlannerAgent").stream("Analyze the customers table"):
    if event.event_type == "message":
        print(event.content, end="", flush=True)

Async Support

import asyncio
from ai_sdk import AISdk

async def main():
    client = AISdk(
        host="https://your-metadata-instance.com",
        token="your-bot-jwt-token",
        enable_async=True,
    )
    response = await client.agent("DataQualityPlannerAgent").acall(
        "Analyze the customers table"
    )
    print(response.response)

asyncio.run(main())

Context Memories

The client.memories namespace manages reusable Context Center knowledge — preferences, use cases, runbooks, and FAQs that any AI agent can read.

from ai_sdk import (
    AISdk,
    CreateContextMemoryRequest,
    EntityReference,
    MemoryType,
    MemoryVisibility,
)

# Create
created = client.memories.create(CreateContextMemoryRequest(
    name="orders-grain",
    title="Orders grain",
    question="What is the grain of the orders table?",
    answer="One row per order_id.",
    memory_type=MemoryType.NOTE,             # Preference | UseCase | Note | Runbook | Faq
    visibility=MemoryVisibility.SHARED,      # Private | Entity | Shared
    primary_entity=EntityReference(id="<table-uuid>", type="table"),
    tags=["Domain.Analytics"],
))

# Get / list (filter by entity FQN, optional limit)
client.memories.get(created.id)
client.memories.list(primary_entity_fqn="prod.warehouse.orders", limit=50)

# Hybrid NLQ search — combines vector + keyword ranking over the contextMemory index.
# Optional filters scope the search by indexed fields.
results = client.memories.search(
    "how do we measure order volume",
    filters={"visibility": ["Entity", "Shared"]},
    size=10,
    from_=0,
)
for hit in results.hits:
    print(f"[{hit.score:.2f}] {hit.memory.title}: {hit.memory.answer}")

# Soft delete by default; pass hard_delete=True to remove permanently
client.memories.delete(created.id)
client.memories.delete(created.id, hard_delete=True)

Async

Every method has an aXxx counterpart when the client is constructed with enable_async=True:

client = AISdk(host=..., token=..., enable_async=True)

await client.memories.acreate(req)
await client.memories.alist(primary_entity_fqn="prod.warehouse.orders")
await client.memories.aget(memory_id)
await client.memories.asearch("explain customer churn")
await client.memories.adelete(memory_id)

What's stored

Field Notes
name Stable system name (required)
question / answer Canonical Q/A pair (required) — what an agent retrieves
title, description, summary Human-facing text, optional
memory_type Preference, UseCase, Note, Runbook, or Faq
memory_scope EntityScoped (default) or UserGlobal
visibility Private, Entity, or Shared (controls who can read it)
primary_entity Attaches the memory to a specific asset for entity-scoped recall
tags List of tag FQN strings (e.g. "PII.Sensitive")

MCP Tools

Access Model Context Protocol tools from your Metadata instance:

tools = client.mcp.list_tools()

result = client.mcp.call_tool(
    tool=MCPTool.SEARCH_ENTITIES,
    arguments={"query": "customers", "limit": 5},
)

Documentation

License

Collate Community License 1.0

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

data_ai_sdk-0.2.0.tar.gz (93.8 kB view details)

Uploaded Source

Built Distribution

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

data_ai_sdk-0.2.0-py3-none-any.whl (98.3 kB view details)

Uploaded Python 3

File details

Details for the file data_ai_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: data_ai_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 93.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for data_ai_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 245e492734d8b0d624576b8915803662f04dce2fb91af8dbdb4279e34bf40cc1
MD5 c8a9f97677fc0498ae6db9d5b479140e
BLAKE2b-256 1b2ecd4d4738b0fbb14299942ae44ac2837eb1950dd0485e8a62a9718b86f402

See more details on using hashes here.

File details

Details for the file data_ai_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: data_ai_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 98.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for data_ai_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 612d8f21e51f8e1b89ab4f2dedf398a968bb69314e3e15017340ad6e32e1097d
MD5 a8c773bfed3709acf4fcd9858c332c43
BLAKE2b-256 46aaeaddb4387f28f0cd29e0eb9ec03700a67fcec4f6fab39dd92929b4412821

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