Skip to content

Commit a831534

Browse files
[agent builder] Clarify how APIs work with Kibana Spaces (elastic#3636)
Contributes to the non-generated API docs component of elastic/docs-content-internal#434 - Creates a new section explaining Spaces behavior - Links to that section from each `curl` example using a reusable snippet --------- Co-authored-by: florent-leborgne <[email protected]>
1 parent 78d2c79 commit a831534

File tree

2 files changed

+57
-4
lines changed

2 files changed

+57
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:::{tip}
2+
If you're using Spaces, you need to prefix `/api/agent_builder` with `/s/<space_name>`. Refer to [Working with Spaces](#working-with-spaces).
3+
:::

solutions/search/agent-builder/kibana-api.md

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ applies_to:
1010

1111
# Work with {{agent-builder}} using the APIs
1212

13-
This page provides a quick overview of the main Kibana API endpoints for {{agent-builder}}. For complete details including all available parameters, request/response schemas, and error handling, refer to the [Kibana serverless API reference](https://www.elastic.co/docs/api/doc/serverless/group/endpoint-agent-builder).
13+
This page provides a quick overview of the main {{kib}} API endpoints for {{agent-builder}}. For complete details including all available parameters, request/response schemas, and error handling, refer to the [{{kib}} serverless API reference](https://www.elastic.co/docs/api/doc/serverless/group/endpoint-agent-builder).
1414

1515
These APIs allow you to programmatically work with the {{agent-builder}} abstractions.
1616

@@ -21,7 +21,7 @@ The examples in this documentation use Dev Tools [Console](/explore-analyze/quer
2121
GET kbn://api/agent_builder/tools
2222
```
2323

24-
To use these APIs with tools like `curl`, replace the `kbn://` protocol with your Kibana URL.
24+
To use these APIs with tools like `curl`, replace the `kbn://` protocol with your {{kib}} URL.
2525

2626
:::{note}
2727
Set the required environment variables before running curl commands:
@@ -40,6 +40,21 @@ To generate API keys, search for `API keys` in the [global search bar](/explore-
4040
[Learn more](https://www.elastic.co/docs/solutions/search/search-connection-details).
4141
:::
4242

43+
### Working with Spaces
44+
45+
To run APIs in non-default [spaces](/deploy-manage/manage-spaces.md), you must include the space identifier in the URL when making API calls with `curl` or other external tools. Insert `/s/<space_name>` before `/api/agent_builder` in your requests.
46+
47+
For example, to list tools in a space named `my-space`:
48+
49+
```bash
50+
curl -X GET "https://${KIBANA_URL}/s/my-space/api/agent_builder/tools" \
51+
-H "Authorization: ApiKey ${API_KEY}"
52+
```
53+
54+
The default space does not require the `/s/default` prefix.
55+
56+
Dev Tools [Console](/explore-analyze/query-filter/tools/console.md) automatically uses your current space context and does not require the `/s/<space_name>` prefix.
57+
4358
## Available APIs
4459

4560
% TODO: we may remove this list once the API reference is live, but probably helpful in the short term
@@ -66,6 +81,8 @@ GET kbn://api/agent_builder/tools
6681
curl -X GET "https://${KIBANA_URL}/api/agent_builder/tools" \
6782
-H "Authorization: ApiKey ${API_KEY}"
6883
```
84+
:::{include} _snippets/spaces-api-note.md
85+
:::
6986
:::
7087

7188
::::
@@ -130,6 +147,8 @@ curl -X POST "https://${KIBANA_URL}/api/agent_builder/tools" \
130147
}
131148
}'
132149
```
150+
:::{include} _snippets/spaces-api-note.md
151+
:::
133152
:::
134153

135154
::::
@@ -154,6 +173,8 @@ GET kbn://api/agent_builder/tools/{id}
154173
curl -X GET "https://${KIBANA_URL}/api/agent_builder/tools/{id}" \
155174
-H "Authorization: ApiKey ${API_KEY}"
156175
```
176+
:::{include} _snippets/spaces-api-note.md
177+
:::
157178
:::
158179

159180
::::
@@ -179,6 +200,8 @@ curl -X DELETE "https://${KIBANA_URL}/api/agent_builder/tools/{id}" \
179200
-H "Authorization: ApiKey ${API_KEY}" \
180201
-H "kbn-xsrf: true"
181202
```
203+
:::{include} _snippets/spaces-api-note.md
204+
:::
182205
:::
183206

184207
::::
@@ -239,6 +262,8 @@ curl -X PUT "https://${KIBANA_URL}/api/agent_builder/tools/{toolId}" \
239262
}
240263
}'
241264
```
265+
:::{include} _snippets/spaces-api-note.md
266+
:::
242267
:::
243268

244269
::::
@@ -277,6 +302,8 @@ curl -X POST "https://${KIBANA_URL}/api/agent_builder/tools/_execute" \
277302
}
278303
}'
279304
```
305+
:::{include} _snippets/spaces-api-note.md
306+
:::
280307
:::
281308
282309
::::
@@ -303,6 +330,8 @@ GET kbn://api/agent_builder/agents
303330
curl -X GET "https://${KIBANA_URL}/api/agent_builder/agents" \
304331
-H "Authorization: ApiKey ${API_KEY}"
305332
```
333+
:::{include} _snippets/spaces-api-note.md
334+
:::
306335
:::
307336
308337
::::
@@ -371,6 +400,8 @@ curl -X POST "https://${KIBANA_URL}/api/agent_builder/agents" \
371400
}
372401
}'
373402
```
403+
:::{include} _snippets/spaces-api-note.md
404+
:::
374405
:::
375406

376407
::::
@@ -395,6 +426,8 @@ GET kbn://api/agent_builder/agents/{id}
395426
curl -X GET "https://${KIBANA_URL}/api/agent_builder/agents/{id}" \
396427
-H "Authorization: ApiKey ${API_KEY}"
397428
```
429+
:::{include} _snippets/spaces-api-note.md
430+
:::
398431
:::
399432

400433
::::
@@ -457,6 +490,8 @@ curl -X PUT "https://${KIBANA_URL}/api/agent_builder/agents/{id}" \
457490
}
458491
}'
459492
```
493+
:::{include} _snippets/spaces-api-note.md
494+
:::
460495
:::
461496

462497
::::
@@ -482,6 +517,8 @@ curl -X DELETE "https://${KIBANA_URL}/api/agent_builder/agents/{id}" \
482517
-H "Authorization: ApiKey ${API_KEY}" \
483518
-H "kbn-xsrf: true"
484519
```
520+
:::{include} _snippets/spaces-api-note.md
521+
:::
485522
:::
486523

487524
::::
@@ -517,6 +554,8 @@ curl -X POST "https://${KIBANA_URL}/api/agent_builder/converse" \
517554
"input": "What is Elasticsearch?",
518555
"agent_id": "elastic-ai-agent"}'
519556
```
557+
:::{include} _snippets/spaces-api-note.md
558+
:::
520559
:::
521560

522561
::::
@@ -553,6 +592,8 @@ curl -X POST "https://${KIBANA_URL}/api/agent_builder/converse/async" \
553592
"conversation_id": "<CONVERSATION_ID>"
554593
}'
555594
```
595+
:::{include} _snippets/spaces-api-note.md
596+
:::
556597
:::
557598

558599
::::
@@ -577,6 +618,8 @@ GET kbn://api/agent_builder/conversations
577618
curl -X GET "https://${KIBANA_URL}/api/agent_builder/conversations" \
578619
-H "Authorization: ApiKey ${API_KEY}"
579620
```
621+
:::{include} _snippets/spaces-api-note.md
622+
:::
580623
:::
581624

582625
::::
@@ -601,6 +644,8 @@ GET kbn://api/agent_builder/conversations/{conversation_id}
601644
curl -X GET "https://${KIBANA_URL}/api/agent_builder/conversations/{conversation_id}" \
602645
-H "Authorization: ApiKey ${API_KEY}"
603646
```
647+
:::{include} _snippets/spaces-api-note.md
648+
:::
604649
:::
605650

606651
::::
@@ -626,6 +671,8 @@ curl -X DELETE "https://${KIBANA_URL}/api/agent_builder/conversations/{conversat
626671
-H "Authorization: ApiKey ${API_KEY}" \
627672
-H "kbn-xsrf: true"
628673
```
674+
:::{include} _snippets/spaces-api-note.md
675+
:::
629676
:::
630677

631678
::::
@@ -648,9 +695,10 @@ curl -X POST "https://${KIBANA_URL}/api/agent_builder/mcp" \
648695
"method": "tools/list"
649696
}'
650697
```
698+
If you're using Spaces, you need to prefix `/api/agent_builder` with `/s/<space_name>`. Refer to [Working with Spaces](#working-with-spaces).
651699

652700
:::{note}
653-
This endpoint uses the JSON-RPC protocol. The MCP server is used by AI clients like Claude Desktop, Cursor, and VS Code extensions to access your Elastic tools. Use this Kibana API endpoint for testing MCP connectivity or debugging protocol communication. This endpoint requires JSON-RPC formatting and does not work from the Dev Tools Console.
701+
This endpoint uses the JSON-RPC protocol. The MCP server is used by AI clients like Claude Desktop, Cursor, and VS Code extensions to access your Elastic tools. Use this {{kib}} API endpoint for testing MCP connectivity or debugging protocol communication. This endpoint requires JSON-RPC formatting and does not work from the Dev Tools Console.
654702
:::
655703

656704
### A2A protocol
@@ -677,6 +725,8 @@ GET kbn://api/agent_builder/a2a/{agentId}.json
677725
curl -X GET "https://${KIBANA_URL}/api/agent_builder/a2a/{agentId}.json" \
678726
-H "Authorization: ApiKey ${API_KEY}"
679727
```
728+
:::{include} _snippets/spaces-api-note.md
729+
:::
680730
:::
681731

682732
::::
@@ -725,4 +775,4 @@ curl -X GET "https://${KIBANA_URL}/api/agent_builder/a2a/{agentId}.json" \
725775

726776
## API reference
727777

728-
For the full API documentation, refer to the [Kibana serverless API reference](https://www.elastic.co/docs/api/doc/serverless/group/endpoint-agent-builder).
778+
For the full API documentation, refer to the [{{kib}} serverless API reference](https://www.elastic.co/docs/api/doc/serverless/group/endpoint-agent-builder).

0 commit comments

Comments
 (0)