Search & Metadata
Discover artifacts programmatically and manage the Context Graph.
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.
Semantic Search
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 Type | Purpose | Key Parameters |
|---|---|---|
find_instances | All records created from a specific Template | template_id |
find_by_variable | Filter by a Template's global variable value | template_id, variable_name, variable_value |
find_by_category | Schema discovery across a type | category (e.g., canvases, functions, workflows) |
find_recent | Recently created or updated artifacts | limit |
count | Count of matching artifacts | varies |
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
| Type | Meaning | Example |
|---|---|---|
delegates_to | Workflow trust | A Workflow delegates execution to a Function |
governs | Schema/permission control | A Dimension governs a set of Templates |
implements | Code-to-interface link | A Function implements a Skill's contract |
related_to | General association | A Canvas relates to a Knowledge Base article |
parent_of | Hierarchical containment | A 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
| Operation | Purpose |
|---|---|
create | Establish a new relationship |
update | Modify an existing relationship's descriptions |
archive | Deactivate a relationship |
get_network | Retrieve the graph around an entity or the entire system |
get_function_dependencies | Audit exactly which tools and credentials a function uses |
Tip: Use
get_function_dependenciesbefore 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.