Get started with the AI SDK in under 5 minutes.
You need:
- An OpenMetadata or Collate instance with Dynamic Agents enabled
- A Bot JWT token for API authentication
If you don't have a token yet, see Getting Your Credentials in the main documentation.
pip install data-ai-sdk# Your OpenMetadata/Collate server URL
# Examples:
# Collate Cloud: https://your-org.getcollate.io
# Self-hosted: https://openmetadata.yourcompany.com
export AI_SDK_HOST="https://your-org.getcollate.io"
# Your bot's JWT token (from Settings > Bots in your instance)
# This is a long base64-encoded string starting with "eyJ..."
export AI_SDK_TOKEN="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."Note: Never commit tokens to version control. Use environment variables, .env files (with .gitignore), or secrets management.
from ai_sdk import AISdk, AISdkConfig
# Create client from environment
config = AISdkConfig.from_env()
client = AISdk.from_config(config)
# Invoke an agent
response = client.agent("DataQualityPlannerAgent").call(
"What data quality tests should I add?"
)
print(response.response)
client.close()from ai_sdk import Conversation
conv = Conversation(client.agent("DataQualityPlannerAgent"))
print(conv.send("Analyze the customers table"))
print(conv.send("Create tests for the issues you found"))for event in client.agent("SqlQueryAgent").stream("Generate a query"):
if event.type == "content":
print(event.content, end="", flush=True)import asyncio
async def main():
client = AISdk.from_config(
AISdkConfig.from_env(enable_async=True)
)
response = await client.agent("MyAgent").acall("Hello")
print(response.response)
await client.aclose()
asyncio.run(main())The SDK also supports creating and managing resources:
# List bots, personas, and abilities
bots = client.bots.list()
personas = client.personas.list()
abilities = client.abilities.list()
# Create a persona
from ai_sdk.models import CreatePersonaRequest
persona = client.personas.create(CreatePersonaRequest(
name="MyPersona",
description="A helpful analyst",
prompt="You are a helpful data analyst..."
))
# Create an agent
from ai_sdk.models import CreateAgentRequest
agent = client.agents.create(CreateAgentRequest(
name="MyAgent",
description="Custom agent",
persona="MyPersona",
api_enabled=True,
))- Standalone Usage Guide - Complete standalone documentation
- Async Usage - Async patterns and best practices
- Error Handling - Exception handling patterns
- LangChain Integration - Use with LangChain
You haven't set the required environment variables. Run:
export AI_SDK_HOST="https://your-org.getcollate.io"
export AI_SDK_TOKEN="your-jwt-token"Your JWT token is invalid or expired. Generate a new one:
- Go to Settings > Bots in your OpenMetadata/Collate instance
- Select your bot and regenerate the token
- Update your
AI_SDK_TOKENenvironment variable
The agent name doesn't exist or isn't API-enabled:
- Check the exact agent name (case-sensitive)
- Verify the agent exists in your instance under AI Studio
- Ensure "API Enabled" is turned on for the agent
The agent exists but isn't enabled for API use:
- Go to AI Studio in your OpenMetadata/Collate instance
- Edit the agent
- Enable the "API Enabled" toggle
- Save the agent
If using self-hosted OpenMetadata with self-signed certificates:
client = AISdk(
host="https://your-server.com",
token="your-token",
verify_ssl=False # Disable SSL verification (not recommended for production)
)Or set the environment variable:
export AI_SDK_VERIFY_SSL="false"