# AI and ML

AI adapters and agents, chat sessions, knowledge notes, ML models and their configurations.

## Operations

```graphql
# AI and ML (ai-ml)
# AI adapters and agents, chat sessions, knowledge notes, ML models and their configurations.
# Query
chatAIAvailability: ChatAIAvailability!  # Report configured adapter eligibility for this tenant
compileSchemaXML: String!  # Compile standalone XML schema syntax into JSON Schema without persisting it; host restrictions apply when embedded
concept: Concept  # Fetch a single concept by ID
concepts: ConceptConnection!  # List the tenant's concepts with pagination
describeQuerySchema: QuerySchemaPayload!  # Analyze a MicroSQL query and return the inferred result schema (column names, data types) without executing it
exportMLModelConfig: ExportMLModelConfigPayload!  # Export an ML model config as JSON or YAML
generateDefaultDataQuery: String  # Generate a default GraphQL data query for an event topic
getAIAdapter: AIAdapterOutput  # Fetch an AI adapter by ID
getAIAgent: AIAgentState  # Fetch an AI agent by ID
getChatSession: ChatSessionState  # Fetch a chat session by ID
getMLModelConfig: MLModelConfigOutput  # Fetch an ML model config by ID
getMLModelConfigVersion: MLModelConfigVersionOutput  # Get a specific ML model config version by ID
getMagicQueryGraphQL: MagicQueryOperation!  # Resolves a Magic Query string to the real GraphQL operation and variables it runs, so consumers can graduate from the façade to raw GraphQL
getMagicQuerySchema: MagicQuerySchema!  # Returns the input JSON Schema and output introspection for a Magic Query noun, so consumers (especially LLMs) can learn its contract before calling magicQuery
helpChapter: HelpChapter  # Read a chapter of the current published manual edition
helpChapters: [HelpChapterInfo!]!  # List human-facing manual chapters from the running deployment
iacGuides: [IaCGuide!]!  # Every authoring guide, for a tool that syncs them to a folder
iacSchema: IaCSchemaDocument!  # The infrastructure-only view of this schema, for declarative tooling
iacSchemaDocument: IaCSchemaDocumentPayload!  # Fetch the JSON Schema document a SCHEMA-kind validator references, for declarative tooling
iacValidate: IaCValidationResult!  # Validate an infrastructure artifact
knowledgeNote: KnowledgeNote  # Fetch a single knowledge note by ID
knowledgeNotes: KnowledgeNoteConnection!  # List knowledge notes with pagination and filtering
listAIAdapters: AIAdapterConnection!  # List AI adapters with pagination and filtering
listAIAgents: AIAgentConnection!  # List AI agents with pagination
listChatSessions: ChatSessionConnection!  # List chat sessions with pagination and filtering
listDataChangeEventTopics: [DataChangeEventGroup!]!  # List all valid data change event topics, grouped by resource
listMLModelConfigVersions: MLModelConfigVersionConnection!  # List versions for an ML model config, newest first, with pagination
listMLModelConfigs: MLModelConfigConnection!  # List ML model configs with pagination and filtering
listMagicQueries: [MagicQueryInfo!]!  # Lists every available Magic Query noun with a short description and its options — the discovery entry point
magicQuery: JSON!  # Executes a Magic Query string and returns the predefined query's JSON result
ping: String!  # Health check endpoint
renderSchemaXML: String!  # Render JSON Schema as native XML without dropping unsupported keywords or changing a saved document
reportQuery: ReportQueryPayload!  # Execute a MicroSQL reporting query against the analytics schema
retrieveKnowledge: KnowledgeRetrieval!  # The retrieval (RAG) entry point
schemaAuthoringCatalog: JSON!  # Compiler-owned vocabulary for the standalone XML JSON Schema dialect, including native form annotations
searchHelp: HelpSearchResult!  # Search human-facing manuals using shared semantic and text retrieval
# Mutation
captureKnowledge: CaptureKnowledgePayload!  # Capture a knowledge subgraph — concepts, a note, and instance/semantic edges — in one atomic transaction
clearChatMessages: ChatSessionPayload!  # Clear all messages from a chat session
confirmKnowledgeNote: KnowledgeNotePayload!  # Endorse a note: increments its confirmation count (raising its retrieval trust weight) and promotes a PENDING note to LIVE
createAIAdapter: UpsertAIAdapterPayload!  # Create a new AI adapter
createAIAgent: UpsertAIAgentPayload!  # Create a new AI agent
createChatSession: ChatSessionPayload!  # Create a new chat session
createConcept: ConceptPayload!  # Manually author a concept in the ontology
createKnowledgeNote: KnowledgeNotePayload!  # Contribute a knowledge note about a concept or an entity
createMLModelConfig: UpsertMLModelConfigPayload!  # Create a new ML model config
deleteAIAdapter: DeletePayload!  # Delete an AI adapter
deleteAIAgent: DeletePayload!  # Delete an AI agent
deleteChatSession: DeletePayload!  # Delete a chat session
deleteConcept: DeletePayload!  # Delete a concept
deleteKnowledgeNote: DeletePayload!  # Delete a note and any graph edges it sourced
deleteMLModelConfig: DeletePayload!  # Delete an ML model config
forecastMLModel: ForecastMLModelPayload!  # Forecast future values using a trained time-series model
importMLModelConfig: ImportMLModelConfigPayload!  # Import an ML model config from JSON or YAML
markKnowledgeNotesContradict: KnowledgeNotePayload!  # Record that two notes contradict each other; the conflict is surfaced by `retrieveKnowledge` via `KnowledgeHit
predictMLModel: PredictMLModelPayload!  # Run a prediction using a trained ML model
previewMLModelPipeline: DataScriptPreview!  # Run the data pipeline over a sample WITHOUT training and return the emitted fields
publishMLModelVersion: PublishMLModelVersionPayload!  # Set a version as the published version used for predictions
retrainSystemModels: RetrainSystemModelsPayload!  # Manually trigger retraining of all system-managed ML models for the current tenant
sendChatMessage: ChatMessageResponse!  # Send a message to a chat session and receive an AI response
testAIAdapter: TestAIAdapterPayload!  # Verify provider credentials and all effective configured models using provider model endpoints
trainMLModel: TrainMLModelPayload!  # Trigger training for an ML model
unmarkKnowledgeNotesContradict: KnowledgeNotePayload!  # Remove a previously recorded contradiction between two notes
updateAIAdapter: UpsertAIAdapterPayload!  # Update an AI adapter
updateAIAgent: UpsertAIAgentPayload!  # Update an AI agent
updateChatSession: ChatSessionPayload!  # Update an existing chat session
updateConcept: ConceptPayload!  # Rename or reclassify an existing concept
updateKnowledgeNote: KnowledgeNotePayload!  # Edit a note's body or scope, or supersede it with a replacement
updateMLModelConfig: UpsertMLModelConfigPayload!  # Update an ML model config
upsertAIAdapter: UpsertAIAdapterPayload!  # Create or update an AI adapter
upsertAIAgent: UpsertAIAgentPayload!  # Create or update an AI agent
upsertMLModelConfig: UpsertMLModelConfigPayload!  # Create or update an ML model config
upsertMLModelSource: UpsertMLModelConfigPayload!  # Create or replace ML XML authoring source
# Subscription
chatMessageStream: ChatSessionStreamChunk!  # Stream AI responses for a chat message in real-time
dataChangeEvents: DataChangeEvent!  # Subscribe to real-time data change events
mlModelTrainingStatus: MLModelTrainingStatusEvent!  # Stream real-time training status events for an ML model config

# Call describe_operation(name) for arguments and input types.
```

## Exact schema

Download [complete SDL](/schemas/ai-ml.graphql) (144295 bytes). Use the SDL to validate operations; the digest omits argument signatures.

## Guides
