You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started/authentication.md
+48-5Lines changed: 48 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,11 +68,35 @@ client = AsyncAgora(
68
68
)
69
69
```
70
70
71
+
## Pre-built token
72
+
73
+
Pass a manually generated `agora token=...` string via `auth_token`. Use this for debugging or when you want to control the REST API token lifecycle yourself:
74
+
75
+
```python
76
+
from agora_agent import Agora, Area
77
+
from agora_agent.agentkit.token import generate_convo_ai_token
|`channel_name`|`str`| Yes | — | Channel the agent will join |
123
147
|`account`|`str`| Yes | — | Agent UID as a string (e.g. `"1001"`) |
124
-
|`token_expire`|`int`| No |`3600`| Seconds until token expires |
148
+
|`token_expire`|`int`| No |`86400`| Seconds until token expires (max: 86400 = 24 h)|
125
149
|`privilege_expire`|`int`| No |`0`| Seconds until privileges expire (0 = same as `token_expire`) |
126
150
151
+
## Token expiry
152
+
153
+
When the SDK auto-generates a token (app credentials mode, or session without a pre-built `token`), the default lifetime is **86400 seconds (24 hours)** — the Agora maximum. You can customise this via `expires_in` on `create_session()`:
154
+
155
+
```python
156
+
from agora_agent.agentkit import expires_in_hours, expires_in_minutes
`expires_in_hours()` and `expires_in_minutes()` validate the value and raise `ValueError` if it is ≤ 0, or warn and cap at 86400 if it exceeds 24 hours. Valid range: **1–86400 seconds**.
169
+
127
170
## Areas
128
171
129
172
The `area` parameter determines which Agora region your requests are routed to:
Copy file name to clipboardExpand all lines: docs/reference/agent.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,7 @@ create_session(
115
115
token: Optional[str] =None,
116
116
idle_timeout: Optional[int] =None,
117
117
enable_string_uid: Optional[bool] =None,
118
+
expires_in: Optional[int] =None,
118
119
) -> AgentSession
119
120
```
120
121
@@ -127,7 +128,8 @@ Creates an `AgentSession` bound to the given client and channel.
127
128
|`agent_uid`|`str`| Yes | UID for the agent |
128
129
|`remote_uids`|`List[str]`| Yes | UIDs of remote participants |
129
130
|`name`|`Optional[str]`| No | Session name (defaults to agent name) |
130
-
|`token`|`Optional[str]`| No | Pre-built RTC token |
131
+
|`token`|`Optional[str]`| No | Pre-built RTC+RTM token |
132
+
|`expires_in`|`Optional[int]`| No | Token lifetime in seconds (default: `86400` = 24 h, Agora max). Only applies when the token is auto-generated. Use `expires_in_hours()` or `expires_in_minutes()` for clarity. Valid range: 1–86400. |
131
133
|`idle_timeout`|`Optional[int]`| No | Idle timeout in seconds |
132
134
|`enable_string_uid`|`Optional[bool]`| No | Enable string UIDs |
0 commit comments