Skip to main content
Managed Agent API

API Overview and Authentication

The Managed Agents API is a smart agent hosting runtime provided by Bailian, which manages sessions, sandboxes, tool execution, and event streams on the platform.

Prerequisites

  1. Enable Bailian and create an API Key: Obtain it via the console.
  2. Obtain your Workspace ID: Find it in the dropdown menu at the top-right corner of the Bailian console — it looks like {workspace_id}.

Endpoint

The base API URL is constructed from your workspace ID and region:
https://{workspace_id}.{region}.maas.aliyuncs.com/api/v1/agentstudio
  • workspace_id: Your workspace ID
  • region: Region ID — currently only cn-beijing is supported.

Authentication

All requests must include your API Key in the HTTP Authorization header. A single API Key grants access to all resources within its associated workspace.
Authorization: Bearer <your-api-key>

SDKs

In addition to direct REST API calls, you can integrate using Python or Java SDKs. The Managed Agents module requires:
  • Python SDK v1.26.2 or later
  • Java SDK v2.22.24 or later
If you have an older version installed, re-run the installation command to upgrade.
pip install dashscope

Requests and Responses

  • Request bodies are JSON-formatted with Content-Type: application/json.
  • Every response includes an x-request-id header. Include this ID when submitting support tickets to help accelerate issue resolution.
  • List endpoints support pagination:
    • limit: Number of items per page (default: 20; maximum: 100)
    • page: Page number (omit for first page; use next_page from previous response for subsequent pages).
      If the response does not contain next_page, you’ve reached the last page.

Available APIs

ResourceEndpointPurpose
AgentPOST /agentsCreate an Agent
GET /agents/{agent_id}Retrieve an Agent
GET /agentsList Agents
POST /agents/{agent_id}Update an Agent (auto-generates a new version number)
POST /agents/{agent_id}/archiveArchive an Agent
EnvironmentPOST /environmentsCreate an Environment
GET /environments/{environment_id}Retrieve an Environment
GET /environmentsList Environments
POST /environments/{environment_id}Update an Environment
DELETE /environments/{environment_id}Delete an Environment
POST /environments/{environment_id}/archiveArchive an Environment
Session & EventPOST /sessionsCreate a Session
GET /sessions/{session_id}Retrieve a Session
GET /sessionsList Sessions
POST /sessions/{session_id}Update a Session (e.g., rename)
DELETE /sessions/{session_id}Delete a Session
POST /sessions/{session_id}/archiveArchive a Session
POST /sessions/{session_id}/eventsSend an Event (e.g., user message or tool response to the Agent)
GET /sessions/{session_id}/eventsList event history; subscribe to SSE event stream (for streaming output)
FilePOST /filesUpload a File (multipart/form-data)
GET /files/{file_id}Retrieve File metadata
GET /filesList Files
DELETE /files/{file_id}Delete a File
SkillPOST /skillsCreate a Skill
GET /skills/{skill_id}Retrieve a Skill
GET /skillsList Skills
DELETE /skills/{skill_id}Delete a Skill
POST /skills/{skill_id}/versionsUpload a new version of a Skill
GET /skills/{skill_id}/versions/{version}Retrieve a specific Skill version
GET /skills/{skill_id}/versionsList all versions of a Skill
GET /skills/{skill_id}/versions/{version}/contentDownload a Skill package
VaultPOST /vaultsCreate a Vault
GET /vaults/{vault_id}Retrieve a Vault
GET /vaultsList Vaults
POST /vaults/{vault_id}Update a Vault
DELETE /vaults/{vault_id}Delete a Vault
POST /vaults/{vault_id}/archiveArchive a Vault
CredentialPOST /credentialsCreate a Credential
GET /credentials/{credential_id}Retrieve a Credential
GET /credentialsList Credentials
POST /credentials/{credential_id}Update a Credential
DELETE /credentials/{credential_id}Delete a Credential
POST /credentials/{credential_id}/archiveArchive a Credential
WebhookPOST /webhook_endpointsCreate a Webhook
GET /webhook_endpoints/{id}Retrieve a Webhook
GET /webhook_endpointsList Webhooks
PUT /webhook_endpoints/{id}Update a Webhook
DELETE /webhook_endpoints/{id}Delete a Webhook
POST /webhook_endpoints/{id}/enableEnable a Webhook
POST /webhook_endpoints/{id}/disableDisable a Webhook
POST /webhook_endpoints/{id}/testTest a Webhook
POST /webhook_endpoints/{id}/reset_secretReset the signing secret
GET /webhook_endpoints/{id}/eventsList Webhook events
Overview
Managed Agent API
Sandbox API
Memory API
Flow Agent API
RAG API
Connector API
Framework Integration
Assistant API (Deprecating)
  • Overview