Repository navigation
SDK Overview
Looking for runnable examples? See SDK-Examples-DotNet, SDK-Examples-JavaScript, SDK-Examples-Python.
Version: 2.2.1
- Introduction
- Available SDKs
- Installation
- Configuration
- Quick Start
- Services Reference
- Data Models
- Error Handling
Release history lives on the Changelog page. For the underlying HTTP contract, see REST-API-Reference.
The XRCopilot Public SDK provides a simple and efficient way to interact with the XRCopilot Lab Public API. It enables developers to manage topics, profiles, agents, and access common services such as speech synthesis, avatars, and news retrieval.
- Topic Management: Create, update, delete, and query topics and their associated files.
- Profile Management: Handle user profiles, Knowledge Graph synchronization, and indexing.
- Agent Management: Interact with AI agents, manage conversations, and submit per-message feedback.
-
End-user feedback (v2.2.1): submit thumbs-up / thumbs-down (+ optional comment) on individual agent or orchestrator responses and rehydrate per-message "already rated" state on conversation reload — see
AgentService.SubmitFeedbackAsync/GetFeedbackByConversationAsync. -
Q&A pipeline tuning (v2.2.1): per-agent context breadth (
SearchTopK— drives both Azure Search and Knowledge Graph profile retrieval), reasoning mode (Fast / Deep with iteration and timeout caps), permanent agent memory toggle, and per-request reasoning-mode override onUserPrompt. - Diagnostic completion log (v2.2.1): every chat response carries a structured pipeline trace — per-step parameters plus per-injection breakdowns of RAG chunks, KG files, and permanent memories, with top-level counts and prompt-truncation outcome.
- Orchestrators: List/get/validate orchestrator workflows, dispatch executions (fire-and-forget), pause and resume on user interaction, stream live progress over SSE, poll status, cancel, and manage orchestrator-scoped files.
- Common Services: Access voices, avatars (2D and 3D), speech synthesis, and news.
| SDK | Platform | Package Name |
|---|---|---|
| .NET SDK | .NET 8.0+ | Hevolus.XRCopilotLab.Client.Public |
| JavaScript SDK | Browser/Node.js | xrcopilotlab.client.public.js |
| Python SDK | Python 3.10+ | hevolus-xrcopilotlab |
Install via NuGet Package Manager:
dotnet add package Hevolus.XRCopilotLab.Client.PublicOr using the Package Manager Console in Visual Studio:
Install-Package Hevolus.XRCopilotLab.Client.Public- .NET 8.0
- Azure.Storage.Blobs
- Dapper
- Markdig
Install via npm:
npm install xrcopilotlab.client.public.jsThen require the client (the package is published as a CommonJS module exporting the class):
const XRCopilotLabClient = require('xrcopilotlab.client.public.js');Install via pip:
pip install hevolus-xrcopilotlabThen import:
from xrcopilotlab import XRCopilotLabClient- Python 3.10+
- httpx >= 0.27
- httpx-sse >= 0.4
- pydantic >= 2.6
The SDK is async-only: every method is async def and the client must
be awaited. For sync scripts, wrap with asyncio.run(...).
All API requests require an API key for authentication. The API key is passed via the Ocp-Apim-Subscription-Key header. See Getting-Started for how to obtain your subscription key.
The SDK supports multiple API versions. You can specify the version during client initialization:
| Value | Description |
|---|---|
"2025-05-01" |
Default production version |
"YYYY-MM-DD" |
A specific dated API version |
If you omit the version, the SDK defaults to the current production version (2025-05-01).
using XRCopilotLab.Client;
// Initialize the client with the default (production) API version
var client = new AppClient("<YOUR_API_KEY>");
// Or specify the API version explicitly:
// var client = new AppClient("<YOUR_API_KEY>", "2025-05-01");
// Access services
var topics = await client.Topics.GetTopicsAsync("company-id", null);
var profiles = await client.Profiles.GetProfilesAsync("company-id", "topic-id", null);
var agents = await client.Agents.GetAgentsAsync("company-id", "topic-id", null);// Initialize the client with the default (production) API version
const client = new XRCopilotLabClient("<YOUR_API_KEY>");
// Or specify the API version explicitly:
// const client = new XRCopilotLabClient("<YOUR_API_KEY>", "2025-05-01");
// Access services
const topics = await client.getTopicsAsync("company-id", null);
const profiles = await client.getProfilesAsync("company-id", "topic-id", null);
const agents = await client.getAgentsAsync("company-id", "topic-id", null);import asyncio
from xrcopilotlab import XRCopilotLabClient
async def main():
# Async context manager closes the underlying connection pool on exit
async with XRCopilotLabClient(api_key="<YOUR_API_KEY>") as client:
# Or specify a different API version:
# client = XRCopilotLabClient(api_key="<YOUR_API_KEY>", api_version="2025-05-01")
topics = await client.topics.get_topics(company_id="company-id")
profiles = await client.profiles.get_profiles(company_id="company-id", topic_id="topic-id")
agents = await client.agents.get_agents(company_id="company-id", topic_id="topic-id")
asyncio.run(main())The Python SDK groups operations under five service objects on the client
(client.topics, client.profiles, client.agents, client.orchestrators,
client.common) — mirroring the property-style access in the .NET SDK
(client.Topics.GetTopicsAsync(...)).
Naming convention across SDKs. The same logical operation is exposed under three idiomatic names per language:
- .NET: PascalCase +
Asyncsuffix (e.g.GetTopicsAsync).- JavaScript: camelCase +
Asyncsuffix (e.g.getTopicsAsync).- Python: snake_case, no suffix (e.g.
get_topics) — every method isasync def. Methods are grouped underclient.topics,client.profiles,client.agents,client.orchestrators,client.common.The method tables below list the .NET names. Translate to the other SDKs by applying the casing rule. Where the JS or Python name diverges meaningfully (e.g. orchestrator methods), a separate language-specific table is provided.
The Topic Service manages topics and their associated files.
| Method | Description | Parameters |
|---|---|---|
GetTopicsAsync |
Get all topics for a company |
companyId, filter
|
GetTopicListAsync |
Get lightweight topic list |
companyId, filter
|
GetTopicAsync |
Get a specific topic |
companyId, topicId
|
SaveTopicAsync |
Create or update a topic | topic |
DeleteTopicAsync |
Delete a topic |
companyId, topicId
|
CheckTopicExistsAsync |
Check if topic exists |
companyId, topicId, topicName
|
UploadFileAsync |
Upload a file |
stream, companyId, topicId, fileName, scope
|
DeleteFileAsync |
Delete a file |
companyId, topicId, fileName
|
GetFileUrlAsync |
Get file URL |
companyId, topicId, fileName
|
GetFileReadUrlAsync |
Get read-only file URL |
companyId, topicId, fileName
|
GetFileSasUrlAsync |
Get SAS URL for file |
companyId, topicId, fileName, scope
|
GetFileStreamAsync |
Get file as stream |
companyId, topicId, fileName
|
MoveFileAsync |
Move a file |
companyId, topicId, oldPath, newPath
|
DownloadFolderAsBase64Async |
Download files as ZIP |
companyId, topicId, files
|
| Value | Description |
|---|---|
0 |
Profile scope |
1 |
Agent scope |
The Profile Service manages user profiles and Knowledge Graph operations.
| Method | Description | Parameters |
|---|---|---|
GetProfilesAsync |
Get all profiles for a topic |
companyId, topicId, filter
|
GetProfileListAsync |
Get lightweight profile list |
companyId, topicId, filter
|
GetProfileAsync |
Get a specific profile |
companyId, topicId, profileId
|
SaveProfileAsync |
Create or update a profile | profile |
DeleteProfileAsync |
Delete a profile |
companyId, topicId, profileId
|
ActivateProfileAsync |
Activate/deactivate profile | profile |
DeleteProfileFileAsync |
Delete file from profile |
companyId, topicId, profileId, fileName
|
GetIndexingStatusAsync |
Get indexing status | profile |
SyncKnowledgeGraphAsync |
Trigger KG sync |
companyId, topicId, profileId
|
PurgeKnowledgeGraphAsync |
Purge KG data |
companyId, topicId, profileId
|
JS naming note. In the JavaScript SDK the indexing-status method is
getIndexingStatus(noAsyncsuffix). All other methods follow the camelCase +Asyncrule.
The Agent Service manages AI agents and conversations.
| Method | Description | Parameters |
|---|---|---|
GetAgentsAsync |
Get all agents for a topic |
companyId, topicId, filter
|
GetAgentListAsync |
Get lightweight agent list |
companyId, topicId, filter
|
GetAgentAsync |
Get a specific agent |
companyId, topicId, agentId
|
SaveAgentAsync |
Create or update an agent | agent |
DeleteAgentAsync |
Delete an agent |
companyId, topicId, agentId
|
ActivateAgentAsync |
Activate/deactivate agent | agent |
GetWelcomeMessageAsync |
Get welcome message text |
companyId, topicId, agentId, endpointId, language
|
GetFullWelcomeMessageAsync |
Get full welcome response |
companyId, topicId, agentId, endpointId, language
|
ChatAsync |
Send chat message (returns the assistant response) | prompt |
StartChatAsync |
Dispatch a chat message fire-and-forget (returns an acknowledgement; poll history for the result) | prompt |
GetConversationHistoryAsync |
Get conversation history |
companyId, topicId, agentId, conversationId, messages
|
UploadTempFileAsync |
Upload temporary file (optional language of the conversation: a recording is transcribed in it) |
stream, companyId, topicId, agentId, conversationId, fileName, language (optional) |
GetTempFilesStatusAsync |
Get temp-file analysis status |
companyId, topicId, agentId, conversationId
|
DeleteTempFileAsync |
Delete temporary file |
companyId, topicId, agentId, conversationId, fileName
|
SubmitFeedbackAsync (v2.2.1)
|
Submit a thumbs-up / thumbs-down (+ optional comment) on a single chat response | feedback |
GetFeedbackByConversationAsync (v2.2.1)
|
List feedback already saved for a conversation (used to rehydrate per-message thumb state on reload) |
companyId, conversationId
|
Cross-SDK method names: JavaScript uses
submitFeedbackAsync/getFeedbackByConversationAsync; Python usessubmit_feedback/get_feedback_by_conversation. The wire endpoints arePOST /feedbackandGET /feedback/conversation/{companyId}/{conversationId}.
Knowledge-graph queries and document comparison.
QueryKnowledgeGraphAsyncandCompareDocumentAsyncare not part of the public SDK surface — they are not implemented in the .NET, JavaScript, or Python clients. Use the orchestrator-based flows for those scenarios.
The Orchestrator Service drives multi-agent orchestrator workflows (sequential or parallel) and exposes a fire-and-forget execution model with live progress over Server-Sent Events (SSE).
Execution model.
StartExecutionAsyncandResumeExecutionAsyncreturn immediately with anExecutionHandle(HTTP202 Accepted). The actual orchestrator runs asynchronously in the background. To observe progress, either subscribe to the SSE stream (StreamExecutionAsync/subscribeToOrchestration) or pollGetExecutionStatusAsyncuntil the doc reaches a terminal state. The high-level helperExecuteAndWaitAsync(.NET only) wraps execute + stream + interaction prompt + result extraction in a single call.
| Method | Description | Parameters |
|---|---|---|
GetOrchestratorsAsync |
List orchestrators for a company |
companyId, filter, listMode
|
GetOrchestratorAsync |
Get a specific orchestrator (full graph) |
companyId, orchestratorId
|
ValidateOrchestratorAsync |
Validate an orchestrator definition before save/run | orchestrator |
StartExecutionAsync |
Dispatch an orchestrator run (returns 202 + handle) |
companyId, orchestratorId, request, ct
|
ResumeExecutionAsync |
Resume a paused execution with the user's response |
interactionId, orchestrationState, userResponse, ct
|
CancelExecutionAsync |
Request cancellation of a running execution (idempotent) |
companyId, orchestratorId, executionId, ct
|
GetExecutionStatusAsync |
Snapshot status (status, lastSeq, result if terminal) |
companyId, executionId, ct
|
StreamExecutionAsync |
IAsyncEnumerable<OrchestrationEvent> over SSE — auto-reconnects on soft-close |
companyId, executionId, lastEventId, ct
|
ExecuteAndWaitAsync |
High-level wrapper: starts, streams, prompts, returns the final OrchestrationResult
|
companyId, orchestratorId, request, interactionHandler, progressHandler, ct
|
UploadFileAsync |
Upload a file to orchestrator-scoped storage (max 100 MB) |
stream, companyId, orchestratorId, fileName, scope
|
GetFileReadUrlAsync |
Read-only SAS URL for an orchestrator file |
companyId, orchestratorId, fileName
|
DeleteFileAsync |
Delete a file from orchestrator-scoped storage |
companyId, orchestratorId, fileName
|
| Method | Description | Parameters |
|---|---|---|
getOrchestratorsAsync |
List orchestrators for a company |
companyId, filter
|
getOrchestratorAsync |
Get a specific orchestrator (full graph) |
companyId, orchestratorId
|
validateOrchestratorAsync |
Validate an orchestrator definition | orchestrator |
startOrchestrationExecutionAsync |
Dispatch an orchestrator run (returns 202 + handle) |
companyId, orchestratorId, request
|
resumeOrchestrationExecutionAsync |
Resume a paused execution |
interactionId, orchestrationState, userResponse
|
cancelOrchestrationExecutionAsync |
Cancel a running execution |
companyId, orchestratorId, executionId
|
getOrchestrationStatusAsync |
Snapshot status of an execution |
companyId, executionId
|
subscribeToOrchestration |
Callback-style SSE subscription with auto-reconnect; returns {close}
|
companyId, executionId, options
|
streamOrchestrationExecution |
Async generator over SSE events |
companyId, executionId, options
|
executeOrchestrationAndWaitAsync |
High-level wrapper: starts, streams, prompts, returns the final OrchestrationResult
|
companyId, orchestratorId, request, options
|
uploadOrchestratorFileAsync |
Upload a file to orchestrator-scoped storage (max 100 MB) |
file, companyId, orchestratorId, fileName, scope
|
getOrchestratorFileUrlAsync |
Read-only SAS URL for an orchestrator file |
companyId, orchestratorId, fileName
|
deleteOrchestratorFileAsync |
Delete a file from orchestrator-scoped storage |
companyId, orchestratorId, fileName
|
All methods are async def and live under client.orchestrators.
| Method | Description | Parameters |
|---|---|---|
get_orchestrators |
List orchestrators for a company |
company_id, filter=None, list_mode=False
|
get_orchestrator |
Get a specific orchestrator (full graph) |
company_id, orchestrator_id
|
validate_orchestrator |
Validate an orchestrator definition | orchestrator |
start_execution |
Dispatch an orchestrator run (returns 202 + handle) |
company_id, orchestrator_id, request
|
resume_execution |
Resume a paused execution |
interaction_id, orchestration_state, user_response
|
cancel_execution |
Cancel a running execution |
company_id, orchestrator_id, execution_id
|
get_execution_status |
Snapshot status of an execution |
company_id, execution_id
|
stream_execution |
Async generator over SSE events with auto-reconnect |
company_id, execution_id, last_event_id=None
|
subscribe |
Callback-style SSE subscription with auto-reconnect; returns a handle with .close()
|
company_id, execution_id, **callbacks
|
execute_and_wait |
High-level wrapper: starts, streams, prompts on interaction, returns final OrchestrationResult
|
company_id, orchestrator_id, request, interaction_handler, progress_handler
|
extract_interaction_request |
Helper: maps a userInteractionRequired event onto a typed UserInteractionRequest (unwraps the nested payload sub-object on the wire) |
evt |
upload_file |
Upload a file to orchestrator-scoped storage (max 100 MB) |
path_or_data, company_id, orchestrator_id, file_name, scope
|
get_file_read_url |
Read-only SAS URL for an orchestrator file |
company_id, orchestrator_id, file_name
|
delete_file |
Delete a file from orchestrator-scoped storage |
company_id, orchestrator_id, file_name
|
| Value | When emitted | Useful payload fields (evt.Data) |
|---|---|---|
started |
Execution accepted by the worker |
orchestratorId, conversationId
|
stepStarted / stepCompleted
|
Step lifecycle (evt.StepId populated) |
step-specific |
agentUpdate |
Per-agent progress within a step (evt.StepId and evt.AgentId populated) |
agent-specific |
progress |
Free-form progress markers; agent step completions are emitted here with output, agentId, agentName, displayInChat
|
output, agentName
|
userInteractionRequired |
Execution paused; pass interactionId + orchestrationState to ResumeExecutionAsync
|
see table below |
paused / resumed
|
Pause / resume lifecycle markers | |
completed / failed / cancelled
|
Terminal — the SSE stream closes after these | full OrchestrationResult
|
heartbeat |
Keep-alive only; ignore in business logic | n/a |
For step- and agent-scoped events the SDK populates OrchestrationEvent.StepId and OrchestrationEvent.AgentId directly on the event (sourced from top-level fields on the wire frame, not from Data).
evt.Data (a JsonElement) for a userInteractionRequired event contains:
| Field | Type | Notes |
|---|---|---|
interactionId |
string | Pass as the first argument of ResumeExecutionAsync and as userResponse.RequestId. |
message |
string | Question to surface to the user. |
interactionType |
string |
TextInput or Choice. |
options |
array of string | Predefined replies for Choice interactions; absent for TextInput. |
isRequired |
boolean | When false, WasSkipped=true is allowed on the response. |
timeoutSeconds |
integer |
0 or null ⇒ no timeout. |
orchestrationState |
string (JSON) | Opaque resume token — pass unchanged as the second argument of ResumeExecutionAsync. |
agentId |
string | Present only for Agent-step pauses. |
agentName |
string | Present only for Agent-step pauses. |
stepId |
string | Always present. |
stepName |
string | Always present. |
ExtractInteractionRequest (used internally by ExecuteAndWaitAsync) maps these onto a strongly-typed UserInteractionRequest so interactionHandler callbacks receive a clean object — but if you stream events yourself you can read the fields directly off evt.Data.
Wire shape note (all SDKs). The fields above are nested under
evt.data.payloadon the wire — the actual SSE frame is{"seq": ..., "timestamp": ..., "stepId": ..., "payload": { ... fields ... }}. The .NET and Pythonextract_interaction_requesthelpers unwrap the nestedpayloadautomatically; if you parseevt.datayourself, dig intoevt.data["payload"]first.
The Common Service provides access to shared utilities.
| Method | Description | Parameters |
|---|---|---|
GetVoicesAsync |
Get available voices | - |
SpeechAsync |
Convert text to speech | request |
SpeechRecognitionAsync |
Convert speech audio to text | request |
GetAvatarsAsync |
Get human avatars | companyId |
Get3DAvatarsAsync |
Get 3D avatars | companyId |
GetNewsAsync |
Get news items |
last (optional) |
Cross-language conventions. The model definitions below show the .NET shape with PascalCase property names. The other SDKs translate the same shape:
- JavaScript — plain JS objects. Request keys you build (e.g. the chat prompt) use the casing each method documents (
CompanyId,TopicId,Message, …), and they serialise to the camelCase wire shape. Response bodies are returned verbatim fromresponse.json()with no transformation, so they carry the API's PascalCase property names — readresponse.Message,response.ConversationId,history.Messages, etc.- Python — Pydantic v2 classes inheriting from
xrcopilotlab.models._base.CamelCaseModelwith snake_case Python field names (company_id,topic_id). The base class accepts snake_case, camelCase, AND PascalCase JSON on input, and serialises as camelCase on output. SoTopic(company_id="...", topic_id="...")is constructed in Python; over the wire it serialises to{"companyId": "...", "topicId": "..."}.The wire JSON shape is identical across all three SDKs.
Represents a topic container for profiles and agents.
public class Topic
{
public string CompanyId { get; set; }
public string TopicId { get; set; }
public string TopicName { get; set; }
public string Description { get; set; }
public int ProfileNumber { get; set; } // Computed
public int FileNumber { get; set; } // Computed
public int AgentNumber { get; set; } // Computed
public List<TopicFile> TopicFiles { get; set; }
public List<Profile> Profiles { get; set; }
public List<Agent> Agents { get; set; }
}Represents a profile with documents and Knowledge Graph configuration.
public class Profile
{
public string CompanyId { get; set; }
public string TopicId { get; set; }
public string ProfileId { get; set; }
public string ProfileName { get; set; }
public string Description { get; set; }
public bool IsActive { get; set; }
public string DocumentsLanguage { get; set; }
public bool IsKnowledgeGraph { get; set; }
public List<ProfileFile> ProfileFiles { get; set; }
public List<IndexStats> IndexStatistics { get; set; }
}Represents an AI agent with configuration parameters.
public class Agent
{
public string CompanyId { get; set; }
public string TopicId { get; set; }
public string AgentId { get; set; }
public string AgentName { get; set; }
public string Description { get; set; }
public bool IsActive { get; set; }
public DateTime? ExpirationDate { get; set; }
public string SystemMessage { get; set; }
public int? MaxTokens { get; set; }
public float? Temperature { get; set; }
public float? MinRankingScore { get; set; }
public int? MinWordsValidation { get; set; }
public int? NumberOfInteractions { get; set; }
public bool EnableGroundednessDetection { get; set; }
public string ModelName { get; set; } // New in 2.1.0
public bool IsDynamicAgent { get; set; } // New in 2.1.0
public List<AgentMcp> Mcps { get; set; } // New in 2.1.0
public List<TopicFile> HiddenFiles { get; set; } // New in 2.1.0
public int? SearchTopK { get; set; } // New in 2.2.1 — context breadth (3 / 15 / 30, server cap 30; drives both Azure Search AND Knowledge Graph)
public ReasoningMode? ReasoningMode { get; set; } // New in 2.2.1 — Fast=0, Deep=1
public int? MaxReasoningIterations { get; set; } // New in 2.2.1 — Deep loop cap (default 5, max 10)
public int? MaxReasoningSeconds { get; set; } // New in 2.2.1 — Deep loop timeout (default 60, max 120)
public bool EnablePermanentMemory { get; set; } // New in 2.2.1 — agent-scoped memories across conversations
}Represents a chat request to an agent.
public class UserPrompt
{
public string CompanyId { get; set; } // Required
public string TopicId { get; set; } // Required
public string AgentId { get; set; } // Required
public string EndpointId { get; set; } // Required
public string Message { get; set; } // Required
public string AnswerLanguage { get; set; } // Optional
public string ConversationId { get; set; } // Optional (auto-generated if not provided)
public AgentParameters Parameters { get; set; }
public string SignalRConnectionId { get; set; }
public bool? EnableLogs { get; set; }
public ReasoningMode? ReasoningModeOverride { get; set; } // New in 2.2.1 — overrides Agent.ReasoningMode for this request (Fast=0, Deep=1)
public string UserId { get; set; } // Optional (v3.0.2) — end user this request is on behalf of
public Dictionary<string, string> McpContext { get; set; } // Optional (v3.0.2) — non-secret context forwarded to opted-in MCP servers
}
UserId/McpContext(v3.0.2). SetUserIdwhen your application knows the authenticated end user; it partitions per-user conversation history and, when the target MCP server opts in, scopes that server's data to the user.McpContextis an optional map of non-secret key/value pairs forwarded to opted-in MCP servers asX-User-Context-<key>headers (e.g.{ "email": "user@example.com" }).
Note: If
ConversationIdis not provided, the SDK automatically generates a new GUID. To continue an existing conversation, reuse theConversationIdfrom the previous response.
Optional parameters to override agent configuration.
public class AgentParameters
{
public string SystemMessage { get; set; }
public int? MaxTokens { get; set; }
public float? Temperature { get; set; }
public float? MinRankingScore { get; set; }
public int? MinWordsValidation { get; set; }
public int? NumberOfInteractions { get; set; }
public bool EnableGroundednessDetection { get; set; }
}Represents the response from an AI agent.
public class AssistantResponse
{
public string ResponseType { get; set; }
public string Message { get; set; }
public string ConversationId { get; set; }
public string AnswerLanguage { get; set; }
public List<SearchDocument> Documents { get; set; }
public CompletionLog CompletionLog { get; set; }
public string SpeechMessage { get; set; }
public string HtmlMessage { get; set; } // Computed: Markdown to HTML
public string RawMessage { get; set; } // Computed: Plain text
public UserIntent Intent { get; set; }
}Diagnostic trace of the server-side completion pipeline returned with every chat response. Counts (*Count) are always populated for telemetry parity; per-entry breakdowns (*Injected) require EnableLogs = true on the UserPrompt.
public class CompletionLog
{
public List<PipeStep> Steps { get; set; } // pipeline steps (intent, search, etc.)
public List<RagChunkInjection> RagChunksInjected { get; set; } // EnableLogs only
public List<KgChunkInjection> KgChunksInjected { get; set; } // EnableLogs only
public List<KnowledgeGraphCitation> KgCitations { get; set; } // EnableLogs only (v4.1.0)
public List<MemoryInjection> MemoriesInjected { get; set; } // EnableLogs only
public int? RagChunkCount { get; set; } // always populated
public int? KgChunkCount { get; set; } // always populated
public int? MemoriesInjectedCount { get; set; } // always populated
public PromptTruncationInfo PromptTruncated { get; set; } // populated only when trimming was applied
}
public class RagChunkInjection
{
public string ProfileId { get; set; }
public string IndexName { get; set; }
public string DocumentTitle { get; set; }
public string ChunkId { get; set; }
public float? RerankerScore { get; set; }
public int? Bytes { get; set; }
}
public class KgChunkInjection
{
public string ProfileId { get; set; }
public string FileName { get; set; }
public string MimeType { get; set; }
public string Description { get; set; }
}
public class KnowledgeGraphCitation // v4.1.0
{
public string ProfileId { get; set; } // knowledge profile the source belongs to
public string FileName { get; set; } // source file, as ingested
public int PageNumber { get; set; } // 0 when the source is not paginated
public string TextSnippet { get; set; } // short snippet of the cited passage
public string NodeName { get; set; } // graph entity the citation backs
public string DocumentId { get; set; }
public string ChunkId { get; set; }
public double Confidence { get; set; }
}
public class MemoryInjection
{
public Guid? MemoryId { get; set; }
public string Category { get; set; }
public string NormalizedKey { get; set; }
public int? Bytes { get; set; }
}
public class PromptTruncationInfo
{
public bool WasTrimmed { get; set; }
public int HistoryMessagesTrimmed { get; set; }
public bool SystemMessageTruncated { get; set; }
public int EstimatedTokensBefore { get; set; }
public int EstimatedTokensAfter { get; set; }
public int SafeInputLimit { get; set; }
public string ModelName { get; set; }
}KgCitations (kgCitations in JSON, kg_citations in Python) lists the sources the Knowledge Graph used for the answer: up to 12, in a stable order. The agent is instructed to cite only these. In JavaScript the field is part of the CompletionLog schema of the OpenAPI definition.
Behaviour change in 2.2.1: the
SearchTopKvalue on the agent now controls both the Azure Search chunks-per-profile and the Knowledge Graph chunks-per-profile. Previously the KG path was hardcoded to 10. Agents withSearchTopKunset (legacy default) will use 3 chunks/profile on KG queries. SetSearchTopKto 15 or 30 to restore or exceed the legacy KG breadth.
Request for text-to-speech conversion.
public class SpeechRequest
{
public string Text { get; set; }
public string Language { get; set; }
public string VoiceId { get; set; }
}End-user feedback on a single agent or orchestrator chat response. Tenant-scoped: every row carries a CompanyId and every read enforces it in the SQL filter.
public class AgentFeedback
{
public Guid Id { get; set; } // Server-assigned if blank
public required string CompanyId { get; set; } // Tenant discriminator
public required string TopicId { get; set; }
public required string AgentId { get; set; } // Agent or orchestrator id
public string? EndpointId { get; set; }
public string? ConversationId { get; set; }
public string? UserId { get; set; } // Entra ID object id, or null
public required string UserQuestion { get; set; } // NVARCHAR(MAX)
public required string AgentResponse { get; set; } // NVARCHAR(MAX)
public required FeedbackRating Rating { get; set; } // 0 = ThumbsDown, 1 = ThumbsUp
public string? Comment { get; set; }
public DateTime CreatedAt { get; set; } // UTC; server-assigned if default
}
public enum FeedbackRating : byte
{
ThumbsDown = 0,
ThumbsUp = 1
}Represents an orchestrator workflow definition (steps + connections + endpoints).
public class Orchestrator
{
public string CompanyId { get; set; } // Required
public string OrchestratorId { get; set; } // Required
public string Name { get; set; } // Required
public string Description { get; set; }
public bool IsActive { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public string CreatedBy { get; set; }
public string UpdatedBy { get; set; }
public List<OrchestratorStep> Steps { get; set; }
public List<OrchestratorConnection> Connections { get; set; }
public List<OrchestratorEndpoint> OrchestratorEndpoints { get; set; }
public int StepCount { get; } // Computed
public int AgentStepCount { get; } // Computed
public bool HasConditionalSteps { get; } // Computed
}OrchestratorStep.StepType is one of: Agent, Condition, Switch, ParallelGroup, HandoffGroup, UserQuestion, Terminate.
Request body for starting (or resuming-via-handoff) an execution.
public class OrchestrationRequest
{
public string Message { get; set; } // Required — initial user prompt
public string? ExecutionId { get; set; } // Optional — caller can pre-allocate the id
// to join the SSE/SignalR group before dispatch
public string? ConversationId { get; set; }
public string? InitiatedBy { get; set; }
public Dictionary<string, object>? InitialContext { get; set; }
public string? AnswerLanguage { get; set; } // "en", "it", "fr", … or "xx" for multilingual
public bool? EnableLogs { get; set; }
public int? TimeoutSeconds { get; set; }
public bool? ContinueOnFailure { get; set; }
public bool EnableSignalRLogs { get; set; } // Internal debug only — leave false in SDK
public bool TempFiles { get; set; } // Set true if temp files were uploaded for the run
}Tip: allocating
ExecutionIdon the client (Guid.NewGuid().ToString().ToUpperInvariant()) before callingStartExecutionAsynclets you join the SSE stream as soon as the handle returns, with zero risk of missing early events.
Returned by StartExecutionAsync and ResumeExecutionAsync (HTTP 202 Accepted).
public class ExecutionHandle
{
public string ExecutionId { get; set; }
public string Status { get; set; } // "queued" | "running"
}Snapshot returned by GetExecutionStatusAsync.
public class ExecutionStatus
{
public string ExecutionId { get; set; }
public string CompanyId { get; set; }
public string OrchestratorId { get; set; }
public string Status { get; set; } // queued | running | paused | completed | failed | cancelled
public int LastSeq { get; set; } // Highest event seq emitted so far
public bool CancelRequested { get; set; }
public object? Result { get; set; } // OrchestrationResult — only on terminal states
public string? OrchestrationState { get; set; } // Only on paused; pass back to ResumeExecutionAsync
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}A single SSE event delivered by StreamExecutionAsync / subscribeToOrchestration.
public class OrchestrationEvent
{
public string Id { get; set; } // "{executionId}::{seq}" — pass as Last-Event-ID for resume
public string ExecutionId { get; set; }
public int Seq { get; set; }
public string CompanyId { get; set; }
public string OrchestratorId { get; set; }
public string EventType { get; set; } // see "OrchestrationEvent.eventType values" above
public DateTime Timestamp { get; set; }
public object? Data { get; set; } // shape depends on EventType
public string? StepId { get; set; } // step-scoped events
public string? AgentId { get; set; } // agent-scoped events
}The agent uses UserInteractionRequest to ask the user for input; the SDK caller submits a UserInteractionResponse via ResumeExecutionAsync.
public class UserInteractionRequest
{
public string? RequestId { get; set; }
public string? AgentId { get; set; }
public string? AgentName { get; set; }
public UserInteractionType? InteractionType { get; set; } // TextInput | Choice
public string? Message { get; set; }
public string? PromptHint { get; set; }
public List<string>? Options { get; set; } // populated for Choice interactions
public bool? IsRequired { get; set; }
public string? DefaultValue { get; set; }
public int? TimeoutSeconds { get; set; } // 0 = no timeout
}
public class UserInteractionResponse
{
public string? RequestId { get; set; } // must match the agent's RequestId
public string? ResponseValue { get; set; }
public bool? WasSkipped { get; set; }
public DateTime? ResponseTimestamp { get; set; }
public string? AnswerLanguage { get; set; }
public Dictionary<string, object>? Metadata { get; set; }
}The final shape returned inside the completed / failed / cancelled SSE events and in ExecutionStatus.Result.
public class OrchestrationResult
{
public string ExecutionId { get; set; }
public string? ConversationId { get; set; }
public bool Success { get; set; }
public OrchestrationStatus Status { get; set; }
public string? FinalOutput { get; set; }
public string? Error { get; set; }
public TimeSpan Duration { get; set; }
public DateTime StartedAt { get; set; }
public DateTime? CompletedAt { get; set; }
public List<StepResult> StepResults { get; set; }
public Dictionary<string, object>? FinalContext { get; set; }
public OrchestrationMetrics? Metrics { get; set; }
public List<SearchDocument> Documents { get; set; }
public List<DocumentImageMetadata> DocumentImages { get; set; }
public List<AgentTaskGeneratedFile> Files { get; set; }
public bool IsPausedForUserInteraction { get; set; }
public UserInteractionRequest? PendingUserInteraction { get; set; }
public string? OrchestrationState { get; set; }
public List<string> IntermediateMessages { get; set; } // messages of Start / SendMessage steps
public List<OrchestrationIntermediateMessage> IntermediateMessagesRich { get; set; } // same, with the files forwarded from the preceding step
// FinalOutput if present, otherwise the last intermediate message.
public string? GetEffectiveFinalOutput();
}
public class OrchestrationIntermediateMessage
{
public string Text { get; set; }
public List<AgentTaskGeneratedFile>? Files { get; set; }
}When an orchestrator's answer is produced by a SendMessage step, FinalOutput is left empty and the answer is the last intermediate message. Use GetEffectiveFinalOutput() to read "the answer" regardless of which step produced it. These members are available in the .NET SDK.
| Value | Name | Notes |
|---|---|---|
| 0 | Running |
In progress |
| 1 | Completed |
Terminal |
| 2 | Failed |
Terminal |
| 3 | Cancelled |
Terminal |
| 4 | Skipped |
Step-only — not used at execution level |
| 5 | PausedForUserInteraction |
Submit a response via ResumeExecutionAsync
|
The SDK throws exceptions for error conditions. Wrap calls in try-catch blocks:
try
{
var response = await client.Agents.ChatAsync(prompt);
}
catch (HttpRequestException ex)
{
Console.WriteLine($"HTTP Error: {ex.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}Methods return null on error and log to console:
const response = await client.chatAsync(prompt);
if (response === null) {
console.error("Chat request failed");
}The SDK raises a small typed-exception hierarchy. All errors inherit from
XRCopilotError:
| Exception | When raised |
|---|---|
XRCopilotError |
Base class — catch this to handle any SDK error |
XRCopilotApiError |
Non-2xx HTTP response. Carries .status_code, .message, .error_code, .response_text
|
XRCopilotAuthError |
401 / 403 (subclass of XRCopilotApiError) |
XRCopilotValidationError |
validate_orchestrator returned validation issues. Carries .issues
|
from xrcopilotlab import (
XRCopilotApiError,
XRCopilotAuthError,
XRCopilotError,
XRCopilotValidationError,
)
async def safe_chat(client, prompt):
try:
return await client.agents.chat(prompt)
except XRCopilotAuthError as exc:
print(f"Auth failed (HTTP {exc.status_code}): {exc.message}")
except XRCopilotApiError as exc:
print(f"API error (HTTP {exc.status_code}): {exc.message}")
print(f"Response body: {exc.response_text[:200]}")
except XRCopilotError as exc:
# Catch-all for any SDK-raised error
print(f"SDK error: {exc}")
return NoneThe HTTP layer retries idempotent methods (GET / HEAD / PUT / DELETE) with exponential backoff on transient failures (5xx and 429); POST is non-idempotent and is never retried automatically.
See Changelog for SDK release history, and Getting-Started to obtain credentials and make your first call.
© Hevolus Innovation · XRCopilot · Maintained by the XRCopilot team.
Getting Started
API
SDKs
Webhooks & Integrations
- Agent Task Webhooks
- Connections & Action Steps
- Integration Templates
- Authenticated Embed
- Microsoft Agent 365
- Microsoft Teams Notifications
No-code Builders
Orchestrators
Processes
Administration
Reference