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
When processing the streaming response, you'll receive quota usage information in the final `done` event. Here's a JavaScript example of how to handle this:
// Schedule next request after quota reset if needed
166
+
if (remainingRequests ===0) {
167
+
setTimeout(() => {
168
+
// Safe to make next request
169
+
}, remainingTimeMs);
170
+
}
171
+
}
172
+
173
+
eventSource.close();
174
+
});
175
+
```
176
+
146
177
**Using MCP Server Backend Mode via API:**
147
178
148
179
You can override the agent's default backend mode by adding the `use_mcp` parameter:
@@ -182,7 +213,21 @@ event: execution
182
213
data: Your final answer from the agent.
183
214
184
215
event: done
185
-
data: {}
216
+
data: {
217
+
"rateLimitUsage": {
218
+
"maxRequests": 200,
219
+
"remainingRequests": 193,
220
+
"maxTokens": 200000,
221
+
"remainingTokens": 179910,
222
+
"remainingTimeMs": 903
223
+
},
224
+
"monthlyQuotaUsage": {
225
+
"monthlyLimit": 20,
226
+
"remainingQuota": 19,
227
+
"month": "2025-09",
228
+
"remainingTimeMs": 1766899073
229
+
}
230
+
}
186
231
```
187
232
188
233
**Possible Event Types:**
@@ -242,11 +287,36 @@ The final textual answer or a chunk of the answer from the agent for the user. F
242
287
<details>
243
288
<summary><b><code>done</code> (Click to expand)</b></summary>
244
289
245
-
Signals that the agent has finished processing and the response stream is complete.
290
+
Signals that the agent has finished processing and the response stream is complete. This event also includes quota usage information for managing your API limits.
246
291
247
-
```json
248
-
{}
292
+
```json showLineNumbers
293
+
{
294
+
"rateLimitUsage": {
295
+
"maxRequests": 200,
296
+
"remainingRequests": 193,
297
+
"maxTokens": 200000,
298
+
"remainingTokens": 179910,
299
+
"remainingTimeMs": 903
300
+
},
301
+
"monthlyQuotaUsage": {
302
+
"monthlyLimit": 20,
303
+
"remainingQuota": 19,
304
+
"month": "2025-09",
305
+
"remainingTimeMs": 1766899073
306
+
}
307
+
}
249
308
```
309
+
310
+
**Quota Usage Fields:**
311
+
-`maxRequests`: Maximum number of requests allowed in the current rolling window
312
+
-`remainingRequests`: Number of requests remaining in the current window
313
+
-`maxTokens`: Maximum number of tokens allowed in the current rolling window
314
+
-`remainingTokens`: Number of tokens remaining in the current window
315
+
-`remainingTimeMs`: Time in milliseconds until the rolling window resets
316
+
317
+
:::tip Managing quota usage
318
+
Use the quota information in the `done` event to implement client-side rate limiting and avoid hitting API limits. When `remainingRequests` or `remainingTokens` are low, consider adding delays between requests or queuing them for later execution.
319
+
:::
250
320
</details>
251
321
252
322
</TabItem>
@@ -339,17 +409,40 @@ We limit this data storage strictly to these purposes. You can contact us to opt
339
409
340
410
## Limits
341
411
342
-
Port applies limits to AI agent interactions to ensure fair usage across all customers:
412
+
Port applies two different types of limits to AI agent interactions to ensure fair usage across all customers:
413
+
414
+
### Rate limits
415
+
-**Query limit**: ~40 queries per hour
416
+
-**Token usage limit**: 800,000 tokens per hour
417
+
- These limits reset hourly
418
+
419
+
### Monthly quota
420
+
-**Default quota**: 20 AI invocations per month
421
+
- Each invocation of Port AI counts as one request against your quota
422
+
- Quota resets monthly
423
+
343
424
344
-
-**Query limit**: ~40 queries per hour.
345
-
-**Token usage limit**: 800,000 tokens per hour.
346
425
347
426
:::caution Usage limits
348
427
Usage limits may change without prior notice. Once a limit is reached, you will need to wait until it resets.
349
428
If you attempt to interact with an agent after reaching a limit, you will receive an error message indicating that the limit has been exceeded.
350
429
The query limit is estimated and depends on the actual token usage.
351
430
:::
352
431
432
+
### Monitor your usage
433
+
434
+
You can monitor your current usage in several ways:
435
+
436
+
#### Rate limits
437
+
- Check the final `done` event in streaming responses for remaining requests, tokens, and reset time
438
+
439
+
#### Monthly quota
440
+
You can monitor your current monthly quota usage by making a GET request to the `/v1/quota/ai-invocations` endpoint
441
+
442
+
:::tip Proactive quota monitoring
443
+
Check your monthly quota before making multiple AI agent requests to avoid hitting limits. When `remainingQuota` is low, consider implementing rate limiting or queuing requests until the monthly quota resets. Note that you may also encounter hourly rate limits, which are separate from this monthly quota.
444
+
:::
445
+
353
446
## Common errors
354
447
355
448
Here are some common errors you might encounter when working with AI agents and how to resolve them:
@@ -448,6 +541,48 @@ Ensure that:
448
541
The AI invocation entity contains the `feedback` property where you can mark is as `Negative` or `Positive`. We're working on adding a more convenient way to rate conversation from Slack and from the UI.
449
542
</details>
450
543
544
+
<details>
545
+
<summary><b>What are the usage limits and how can I know them? (Click to expand)</b></summary>
546
+
547
+
Port applies the following limits to AI agent interactions:
548
+
-**Query limit**: ~40 queries per hour
549
+
-**Token usage limit**: 800,000 tokens per hour
550
+
551
+
You can monitor your current usage in several ways:
552
+
- Check the final `done` event in streaming responses for remaining requests, tokens, and reset time (hourly rate limits)
553
+
- Make a GET request to `/v1/quota/ai-invocations` to see your monthly quota status
554
+
555
+
Note that Port has both hourly rate limits and monthly quotas. For detailed information, see the [Limits](#limits) section above.
556
+
557
+
</details>
558
+
559
+
<details>
560
+
<summary><b>What happens when I reach a limit and what can I do? (Click to expand)</b></summary>
561
+
562
+
**What happens when you reach a limit:**
563
+
- You are temporarily blocked from making new AI agent requests
564
+
- You will receive an error message indicating which limit has been exceeded
565
+
- Access resumes automatically when the limit resets
566
+
567
+
**What you can do:**
568
+
569
+
**For rate limits (hourly):**
570
+
- Wait for the limits to reset (they reset every hour)
571
+
- Monitor the `remainingTimeMs` field to know exactly when you can make requests again
572
+
- The error message will indicate it's a rate limit issue
573
+
574
+
**For monthly quota:**
575
+
- Wait for the monthly quota to reset at the beginning of the next month
576
+
- Contact our support team to learn more about our plans and quota upgrades available for your organization
577
+
- The error message will indicate it's a quota limit issue
578
+
579
+
**General recommendations:**
580
+
- Implement rate limiting in your applications to avoid hitting limits
581
+
- Monitor your usage proactively using the monitoring methods described above
582
+
- Consider batching requests or optimizing your AI agent interactions for efficiency
583
+
584
+
</details>
585
+
451
586
<details>
452
587
<summary><b>How is my data with AI agents handled? (Click to expand)</b></summary>
Copy file name to clipboardExpand all lines: docs/ai-interfaces/port-mcp-server/overview-and-installation.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -195,6 +195,13 @@ If you encounter errors:
195
195
-**Permission issues**: You may need to run with appropriate permissions
196
196
:::
197
197
198
+
:::warning VSCode action tool issue
199
+
In some versions of VS Code, the MCP server might not start or return an error in the chat because of a configuration issue with the action related tools. To deal with it, [deselect](./available-tools#select-which-tools-to-use) the tools `create_action`, `update_action`, and `delete_action`.
200
+
This is relevant for cases where you see an error like this one:
201
+
```
202
+
Failed to validate tool mcp_port_create_action: Error: tool parameters array type must have items. Please open a Github issue for the MCP server or extension which provides this tool
Copy file name to clipboardExpand all lines: docs/api-reference/approve-an-action-run.api.mdx
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
2
id: approve-an-action-run
3
3
title: "Approve an action run"
4
-
description: "This route allows you to approve or decline a request to execute an action that requires approval.<br/><br/>To learn more about manual approval for actions, check out the [documentation](https://docs.port.io/create-self-service-experiences/set-self-service-actions-rbac/#configure-manual-approval-for-actions)."
4
+
description: "This route allows you to approve or decline a request to execute an"
@@ -36,7 +36,14 @@ import Heading from "@theme/Heading";
36
36
37
37
38
38
39
-
This route allows you to approve or decline a request to execute an action that requires approval.<br/><br/>To learn more about manual approval for actions, check out the [documentation](https://docs.port.io/create-self-service-experiences/set-self-service-actions-rbac/#configure-manual-approval-for-actions).
39
+
This route allows you to approve or decline a request to execute an
40
+
action that requires approval.<br/><br/>To learn more about manual
Set the `version` parameter to `v2` for the latest version of the API.
45
+
:::
46
+
40
47
41
48
<Heading
42
49
id={"request"}
@@ -47,7 +54,7 @@ This route allows you to approve or decline a request to execute an action that
47
54
</Heading>
48
55
49
56
<ParamsDetails
50
-
parameters={[{"schema":{"type":"string","enum":["v1","v2"]},"in":"query","name":"version","required":false},{"schema":{"type":"string"},"in":"path","name":"run_id","required":true,"description":"The identifier of the action run."}]}
57
+
parameters={[{"schema":{"type":"string","enum":["v1","v2"]},"in":"query","name":"version","required":false,"description":"Specifies the API version to use. Please use `v2` for the latest version of the API."},{"schema":{"type":"string"},"in":"path","name":"run_id","required":true,"description":"The identifier of the action run."}]}
0 commit comments