Cloudbase Agent Python SDK - Dify framework integration
Project description
cloudbase-agent-dify
Cloudbase Agent Python SDK - Dify framework integration
This package provides Dify-specific agent implementations for Cloudbase Agent, enabling seamless integration with Dify platform's chat API.
Installation
pip install -e .
Usage
See examples in python-sdk/examples/dify/ for usage examples.
Configuration
Set the following environment variables:
DIFY_API_KEY: Dify API key (required)DIFY_API_BASE: Dify API base URL (optional, defaults tohttps://api.dify.ai/v1)
Implementation Details
This adapter uses direct HTTP requests via httpx instead of relying on third-party SDKs:
- Why direct HTTP? The official
dify-clientpackage on PyPI hasn't been updated since 2023 and may be outdated - Benefits: Full control over API calls, easier to maintain, no dependency on potentially outdated SDKs
- API Reference: Implementation follows the official Dify API documentation: https://docs.dify.ai/api-reference/chat/send-chat-message
Features
- Strict mode: Only
userrole messages are accepted in a single request (prevents semantic inconsistencies) - Automatic conversation management: Uses
conversation_idfrom Dify responses asthread_id - Intelligent retry: Automatically retries once without
conversation_idif format error occurs - Streaming & Blocking: Support for both
streaming(SSE) andblockingresponse modes - Tool call mapping: Complete support for Dify Agent mode tool calls via
agent_thoughtevents
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cloudbase_agent_dify-0.1.1.tar.gz.
File metadata
- Download URL: cloudbase_agent_dify-0.1.1.tar.gz
- Upload date:
- Size: 29.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
328370e489483a9a2c241f7d57c2b3849f5ea696d6fc61dab0dc54608a08c928
|
|
| MD5 |
d1aeb33b2f2d5b10350c7f0a4e5bf36e
|
|
| BLAKE2b-256 |
3001603a2f59f151958401004ca6a3d5a106b6b0c7a87b939eacc0b0c3803aa5
|
File details
Details for the file cloudbase_agent_dify-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cloudbase_agent_dify-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07251dfa99a81269a6e4c8c0d9344a0727f0bcfdb31c4456ce61d2956dc4e30a
|
|
| MD5 |
19b4195f78020c140b843cab53a2af58
|
|
| BLAKE2b-256 |
9d6262f5de3d2c575113cfc36315d9d557ae8655ce81e9aa36ef3b5641926fc1
|