SDKs

Official client libraries for the Agent API
View as Markdown

Use the official Agent API SDKs to call chat completions, corpus search, evaluators, CTAs, and other endpoints from your application.

Generated with Fern from the same OpenAPI definition as the API Reference.

TypeScript / JavaScript

$npm install apologist
1import { ApologistAgentClient } from "apologist";
2
3const client = new ApologistAgentClient({
4 domain: process.env.APOLOGIST_AGENT_DOMAIN,
5 apiKey: process.env.APOLOGIST_API_KEY,
6});

Package: https://www.npmjs.com/package/apologist

Class: ApologistAgentClient

Repository: apologist-project/apg-sdk-js

Python

$pip install apologist
1import os
2from apologist import ApologistAgentClient
3
4client = ApologistAgentClient(
5 domain=os.environ["APOLOGIST_AGENT_DOMAIN"],
6 api_key=os.environ["APOLOGIST_API_KEY"],
7)

Package: https://pypi.org/project/apologist/

Class: ApologistAgentClient

Repository: apologist-project/apg-sdk-python

Go

$go get github.com/apologist-project/apg-sdk-go
1import (
2 "os"
3
4 "github.com/apologist-project/apg-sdk-go/client"
5 "github.com/apologist-project/apg-sdk-go/option"
6)
7
8c := client.NewApologistAgentClient(
9 option.WithDomain(os.Getenv("APOLOGIST_AGENT_DOMAIN")),
10 option.WithAPIKey(os.Getenv("APOLOGIST_API_KEY")),
11)

Package: https://pkg.go.dev/github.com/apologist-project/apg-sdk-go

Class: client.ApologistAgentClient

Repository: apologist-project/apg-sdk-go

Java

Maven coordinate: ai.apologist:apologist

1import ai.apologist.AgentClient;
2
3AgentClient client = AgentClient.builder()
4 .domain(System.getenv("APOLOGIST_AGENT_DOMAIN"))
5 .apiKey(System.getenv("APOLOGIST_API_KEY"))
6 .build();

Package: https://central.sonatype.com/artifact/ai.apologist/apologist

Class: ai.apologist.AgentClient

Repository: apologist-project/apg-sdk-java

.NET / C#

$dotnet add package apologist
1using Apologist;
2
3var client = new ApologistAgentClient(
4 Environment.GetEnvironmentVariable("APOLOGIST_API_KEY")!,
5 new ClientOptions
6 {
7 Domain = Environment.GetEnvironmentVariable("APOLOGIST_AGENT_DOMAIN"),
8 }
9);

Package: https://www.nuget.org/packages/apologist

Class: Apologist.ApologistAgentClient

Repository: apologist-project/apg-sdk-csharp

PHP

$composer require apologist/apologist
1<?php
2
3use Apologist\ApologistAgentClient;
4
5$client = new ApologistAgentClient(
6 apiKey: getenv('APOLOGIST_API_KEY') ?: null,
7 domain: getenv('APOLOGIST_AGENT_DOMAIN') ?: null,
8);

Package: https://packagist.org/packages/apologist/apologist

Class: Apologist\ApologistAgentClient

Repository: apologist-project/apg-sdk-php

Ruby

$gem install apologist
1require "apologist"
2
3client = Apologist::AgentClient.new(
4 api_key: ENV.fetch("APOLOGIST_API_KEY"),
5 domain: ENV.fetch("APOLOGIST_AGENT_DOMAIN"),
6)

Package: https://rubygems.org/gems/apologist

Class: Apologist::AgentClient

Repository: apologist-project/apg-sdk-ruby

Swift

1// Package.swift dependency:
2.package(url: "https://github.com/apologist-project/apg-sdk-swift.git", from: "0.1.0")
1import Foundation
2import Apologist
3
4guard
5 let domain = ProcessInfo.processInfo.environment["APOLOGIST_AGENT_DOMAIN"],
6 let apiKey = ProcessInfo.processInfo.environment["APOLOGIST_API_KEY"]
7else {
8 fatalError("APOLOGIST_AGENT_DOMAIN and APOLOGIST_API_KEY are required")
9}
10
11let client = ApologistAgentClient(
12 baseURL: "https://\(domain)/api/v1",
13 apiKey: apiKey
14)

Class: ApologistAgentClient

Repository: apologist-project/apg-sdk-swift

Rust

$cargo add apologist
1use apologist::prelude::*;
2use std::env;
3
4let domain = env::var("APOLOGIST_AGENT_DOMAIN").expect("APOLOGIST_AGENT_DOMAIN");
5let api_key = env::var("APOLOGIST_API_KEY").expect("APOLOGIST_API_KEY");
6
7let config = ClientConfig {
8 base_url: format!("https://{domain}/api/v1"),
9 api_key: Some(api_key),
10 ..Default::default()
11};
12let client = ApologistAgentClient::new(config).expect("Failed to build client");

Package: https://crates.io/crates/apologist

Class: ApologistAgentClient

Repository: apologist-project/apg-sdk-rust

Next steps

Browse the API Reference for endpoint details. Endpoint pages include SDK snippets for supported languages once generation has run.