Skip to main content
These tools let your custom code “see” the rest of the system. Use them to find artifacts, build dynamic workflows, and maintain the architectural connections between components.

search_artifacts — Programmatic Discovery

The primary way functions discover and retrieve artifacts within MyAi. Supports both natural language and structured queries. Uses vector embeddings to find artifacts by meaning:
results = default_api.search_artifacts(
    operation="semantic",
    query="Find all documents related to the Q3 Audit",
    limit=20
)

Structured Queries

For precise, programmatic lookups:
Query TypePurposeKey Parameters
find_instancesAll records created from a specific Templatetemplate_id
find_by_variableFilter by a Template’s global variable valuetemplate_id, variable_name, variable_value
find_by_categorySchema discovery across a typecategory (e.g., canvases, functions, workflows)
find_recentRecently created or updated artifactslimit
countCount of matching artifactsvaries

Example: Find Open Support Tickets

def main(team_lead: str):
    results = default_api.search_artifacts(
        operation="query",
        query_type="find_by_variable",
        template_id="support-ticket-template-id",
        variable_name="status",
        variable_value="Open",
        limit=50
    )
    tickets = results.get("artifacts", [])
    for ticket in tickets:
        subject = ticket.get("global_variables", {}).get("subject")
        print(f"  Ticket: {ticket.get('artifact_id')}{subject}")
    return tickets

relationships — The Context Graph

The relationships tool manages the connections between artifacts and Dimensions. It builds self-documenting systems where every component knows why it’s connected to others.

Relationship Types

TypeMeaningExample
delegates_toWorkflow trustA Workflow delegates execution to a Function
governsSchema/permission controlA Dimension governs a set of Templates
implementsCode-to-interface linkA Function implements a Skill’s contract
related_toGeneral associationA Canvas relates to a Knowledge Base article
parent_ofHierarchical containmentA parent artifact contains child components

Perspective Descriptions

Each relationship includes natural language metadata — from_perspective and to_perspective — that captures why two things are connected. This allows the AI to reason about system architecture.
default_api.relationships(
    operation="create",
    from_id="sales-dashboard-canvas",
    to_id="sales-dimension",
    relationship_type="governs",
    from_perspective="I display KPIs for this dimension's sales team.",
    to_perspective="I govern this dashboard and provide its data context."
)

Operations

OperationPurpose
createEstablish a new relationship
updateModify an existing relationship’s descriptions
archiveDeactivate a relationship
get_networkRetrieve the graph around an entity or the entire system
get_function_dependenciesAudit exactly which tools and credentials a function uses
Use get_function_dependencies before deploying a function to production — it lets IT audit every tool and credential the function touches.

Learn More

Functions

Write custom logic that queries artifacts and manages relationships.

Architecture

The big picture of how Dimensions, Skills, and Artifacts connect.