The Managed Agents API is the agent runtime hosted by Model Studio: sessions, sandboxes, tool execution, and event streams are all managed by the platform.
Prerequisites
- Activate Bailian and create an API Key.
- Get the workspace ID: open the dropdown in the upper-right corner of the Model Studio console. The ID looks like
ws_xxxxxxxxxxxx.
Endpoint
The API base URL is composed from the workspace and region:
workspace_id: workspace ID, for examplews_xxxxxxxxxxxxregion: region ID. Onlycn-beijingis supported.
SDK
In addition to calling the REST API directly, you can integrate with the Python or Java SDK. The Managed Agents module requires Python SDK v1.26.2 or later, and Java SDK v2.22.24 or later. If you have an older version installed, run the install command again to upgrade.
Requests and responses
- Request bodies are JSON with
Content-Type: application/json. - Every response carries an
x-request-idheader that helps locate the specific request. - List endpoints support pagination:
limit(default 20, max 100) andpage(omit on the first request; subsequent requests pass thenext_pagevalue returned by the previous response). When the response no longer containsnext_page, you have reached the last page.
Available APIs
Resource | Endpoint | Purpose |
|---|---|---|
| Create an agent | |
| Get an agent | |
| List agents | |
| Update an agent (auto-increments the version) | |
| Archive an agent | |
| Create an environment | |
| Get an environment | |
| List environments | |
| Update an environment | |
| Delete an environment | |
| Archive an environment | |
| Create a session | |
| Get a session | |
| List sessions | |
| Update a session (for example, rename) | |
| Delete a session | |
| Archive a session | |
| Send an event (deliver a user message or tool receipt to the agent) | |
| List event history; subscribe to the SSE event stream (streaming output) | |
| Upload a file (multipart/form-data) | |
| Query file metadata | |
| List files | |
| Delete a file | |
| Create a Memory Store | |
| List Memory Stores | |
| Get a Memory Store | |
| Update a Memory Store | |
| Archive a Memory Store | |
| Create a Memory (memory file) | |
| List Memories | |
| Get a Memory | |
| Update a Memory | |
| Delete a Memory | |
| List Memory Versions (history) | |
| Get a Memory Version | |
| Redact a Memory Version body | |
| Create a skill | |
| Get a skill | |
| List skills | |
| Delete a skill | |
| Upload a new skill version | |
| Get a skill version | |
| List skill versions | |
| Download a skill package | |
| Create a Vault | |
| Retrieve a Vault | |
| List Vaults | |
| Update a Vault | |
| Delete a Vault | |
| Archive a Vault | |
| Create a Credential | |
| Retrieve a Credential | |
| List Credentials | |
| Update a Credential | |
| Delete a Credential | |
| Archive a Credential | |
| Create a Webhook | |
| Retrieve a Webhook | |
| List Webhooks | |
| Update a Webhook | |
| Delete a Webhook | |
| Enable a Webhook | |
| Disable a Webhook | |
| Test a Webhook | |
| Reset the signing secret | |
| List webhook events |