glytos
The official Glytos server SDK for Python.
Call the Glytos API from your backend with an API key. Build agents once and run them as text or as voice: hold a threaded conversation, stream a reply as it is written, place phone calls, mint browser web-call tokens, manage numbers, and verify webhooks.
Never ship an API key to the browser. For in-browser voice, use the
@glytos/webpackage with a short-lived token you mint here.
Install
pip install glytos
Quickstart
from glytos import Glytos
glytos = Glytos(api_key="gly_...")
# List your agents
agents = glytos.agents.list()
# Mint a web-call token for the browser
token = glytos.calls.web_token(workflow_uuid=agents[0]["uuid"])
print(token["token"], token["ws_url"])
Use it as a context manager to close the HTTP connection cleanly:
with Glytos(api_key="gly_...") as glytos:
overview = glytos.request("GET", "/analytics/overview")
Text conversations
An agent is one definition; nothing forces it to do both text and voice. For text, a thread holds the conversation and a run is one turn on it:
thread = glytos.threads.create(agent=agent_uuid)
run = glytos.threads.runs.create(thread, "What are your opening hours?")
print(run["messages"][-1]["content"])
Stream a long answer instead of waiting for it:
for event in glytos.threads.runs.stream(thread, "Summarise the policy"):
if event.type == "token":
print(event.delta, end="", flush=True)
elif event.type == "done":
print()
Extra context for one turn only, applied below the agent's own instructions and never saved to it:
glytos.threads.runs.create(
thread,
"Rate this transcript",
instructions="Score 1-5 and reply as JSON.",
)
Everything above has an async twin on AsyncGlytos (async for over the stream).
Resources
| Namespace | Methods |
|---|---|
glytos.agents (alias workflows) |
list, retrieve, create, rename, publish, promote, duplicate, archive, delete, templates, export, move_to_folder, remove_from_folder, versions, start_session, send_message, stream_message, run_text |
glytos.threads |
create, retrieve, messages.create, messages.list, runs.create, runs.stream |
glytos.folders |
list, create, rename, delete |
glytos.imports |
sources, create, assistant |
glytos.chat |
token, messages, stream, upload_file |
glytos.calls |
create, list, retrieve, web_token, control |
glytos.phone_numbers |
search, list, providers, provision, import_number, instant, assign, release |
glytos.knowledge_base |
list_documents, create_document, upload_document, search |
glytos.vector_stores |
list, create, retrieve, delete, upload_document |
glytos.tools |
list, create, update, delete |
glytos.campaigns |
list, create, retrieve, start, sync_contacts |
glytos.sessions |
list |
glytos.analytics |
overview |
glytos.webhooks |
list, create, update, delete, events, deliveries, redeliver, verify |
agents and workflows are the same resource under two names: the product calls
them agents, the API path is /workflows. Either works.
Text and voice are separate
An agent is one definition. Nothing forces it to do both:
- A text agent needs only
threads(orchatfor a browser widget). - A voice agent adds
calls,phone_numbersandcampaigns. - The same agent can do both, if you want it to.
Any endpoint without a dedicated helper is one call away with
glytos.request(method, path, json=..., params=...), or
glytos.stream(method, path, json=...) for a Server-Sent Events one.
Errors
Non-2xx responses raise a GlytosError with the API error code, HTTP status,
and the request_id:
from glytos import GlytosError
try:
glytos.workflows.retrieve("missing")
except GlytosError as err:
print(err.status, err.code, err.message)
Webhooks
Verify a delivery came from Glytos before trusting it. Pass the raw request
body, the X-Glytos-Signature header, and your endpoint secret:
from glytos import verify_webhook
# e.g. in a Flask/FastAPI handler
ok = verify_webhook(raw_body, request.headers["X-Glytos-Signature"], webhook_secret)
if not ok:
abort(400)
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glytos-0.2.1.tar.gz.
File metadata
- Download URL: glytos-0.2.1.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05219901ff001b5a8b3cd36e9d0d6257a9efaac51fcf002be35754e8f4abc3fa
|
|
| MD5 |
9fbdabb7f401a8edad3ee5b7d9367428
|
|
| BLAKE2b-256 |
c18d00f873568a801aa819a1206cff8458883cf492f11cee11eeadf7153158fc
|
Provenance
The following attestation bundles were made for glytos-0.2.1.tar.gz:
Publisher:
release.yml on Glytos/glytos-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glytos-0.2.1.tar.gz -
Subject digest:
05219901ff001b5a8b3cd36e9d0d6257a9efaac51fcf002be35754e8f4abc3fa - Sigstore transparency entry: 2321709129
- Sigstore integration time:
-
Permalink:
Glytos/glytos-sdk-python@bf49f9d1286df8af6280869ebc7664a9a672299a -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Glytos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bf49f9d1286df8af6280869ebc7664a9a672299a -
Trigger Event:
push
-
Statement type:
File details
Details for the file glytos-0.2.1-py3-none-any.whl.
File metadata
- Download URL: glytos-0.2.1-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20a6eee7a6481e266d81bc7a17ecc7e7e37e895e6314b4c0a4fbaa8f42f39a3d
|
|
| MD5 |
2d97c9c7e07a29830608043fb0c8ba98
|
|
| BLAKE2b-256 |
c44d03888496e6301fab230091e517a6f9791452b9cac2a1f2811d52e03f6a51
|
Provenance
The following attestation bundles were made for glytos-0.2.1-py3-none-any.whl:
Publisher:
release.yml on Glytos/glytos-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glytos-0.2.1-py3-none-any.whl -
Subject digest:
20a6eee7a6481e266d81bc7a17ecc7e7e37e895e6314b4c0a4fbaa8f42f39a3d - Sigstore transparency entry: 2321709210
- Sigstore integration time:
-
Permalink:
Glytos/glytos-sdk-python@bf49f9d1286df8af6280869ebc7664a9a672299a -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/Glytos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bf49f9d1286df8af6280869ebc7664a9a672299a -
Trigger Event:
push
-
Statement type: