.NET SDK

dotnet add package Glytos

Targets net8.0 and netstandard2.0.

Setup

using Glytos;

using var glytos = new GlytosClient("gly_...");

To act in a specific environment, name it - dev, staging, prod, or an environment uuid. It defaults to Development.

using var prod = new GlytosClient("gly_...", new GlytosClientOptions { Environment = "prod" });

Text conversations

A thread holds a conversation; a run is one turn on it. The reply is in the result - there is no run to poll. See Chat.

var thread = await glytos.Threads.CreateAsync(agentUuid);
var run = await glytos.Threads.Runs.CreateAsync(thread, "What are your opening hours?");

// Or stream it as it is written
await foreach (var e in glytos.Threads.Runs.StreamAsync(thread, "Summarise the policy"))
{
    if (e.Type == "token") Console.Write(e.Delta);
}

Agents is an alias of Workflows: the product calls them agents, the API path is /workflows. Either works.

Resources

await glytos.Workflows.ListAsync();
await glytos.Workflows.RetrieveAsync(workflowUuid);
await glytos.Workflows.CreateAsync("Receptionist", mode: "prompt");

await glytos.Calls.CreateAsync(new
{
    transport = "phone",
    workflow_uuid = workflowUuid,
    to_number = "+1...",
});
await glytos.Calls.ListAsync();

await glytos.Workflows.SessionAsync(workflowUuid, sessionUuid);

ASP.NET Core

dotnet add package Glytos.Extensions.DependencyInjection
builder.Services.AddGlytos(builder.Configuration["Glytos:ApiKey"]!, options =>
{
    options.Environment = "prod";
});

app.MapGet("/agents", async (GlytosClient glytos) => await glytos.Workflows.ListAsync());

The client covers Agents (alias Workflows), Threads, Folders, Imports, Chat, Calls, PhoneNumbers, SipTrunks, Campaigns, Dnc, Sessions, Webhooks, Tools, KnowledgeBase, VectorStores, Integrations, Automations, TestSuites, Analytics, Billing, Environments, Providers, ApiKeys and Organizations.

Anything not wrapped

await glytos.RequestAsync<JsonElement>("GET", "/audit");

Verifying webhooks

using Glytos;

// The raw body must be the untouched request body - parsing and re-serialising it
// changes the bytes and the signature will not match.
var ok = Webhook.Verify(rawBody, Request.Headers["X-Glytos-Signature"], secret);

See Webhooks.

.NET SDK · Glytos Docs