Create the endpoint
This example uses Python and FastAPI. Install its dependencies in a server project:
Create
token_server.py:
LIVEKIT_URL. These rules also
apply to self-hosted Egma. For a private-network LiveKit server, use project
credentials instead.
Connect Egma to the endpoint
In your agent repository, setLIVEKIT_TOKEN_ENDPOINT to the full public URL
ending in /egma/livekit-token. Load the same EGMA_TOKEN_SECRET from your
secret store. This command passes the authorization header through standard
input:
--modality chat after adding the worker’s text configuration.
Use the returned connection ID to start a run.
Check that the worker joins the egma-sim- room and receives any test metadata.
Egma makes one token request per simulation. It allows 20 seconds for the
response, does not follow redirects, and accepts a response body up to 64 KiB.
It joins the room once with the participant token. A voice simulation
publishes and subscribes to audio. A chat simulation joins as one text-only
client: it publishes no media tracks, subscribes to no audio, and performs no
audio decoding, speech-to-text, text-to-speech, recording, or voice processing.
Egma waits 30 seconds for your worker to join and answer, then ends the
simulation as agent_never_joined.
Egma leaves when the conversation ends. It never deletes the room and never
uses the token again, so your token endpoint owns cleanup for this room.
Configure your worker to shut down when the caller leaves. A short empty-room
timeout on your LiveKit project is one way to clean the room up.