@@ -7,33 +7,38 @@ This file provides guidance for agents working with code in this repository.
77### Python SDK Development
88
99** Testing:**
10+
1011``` bash
11- make test # Run all tests
12+ just test # Run all tests
1213uv run pytest tests/specific_test.py # Run specific test
1314```
1415
1516** Linting and Formatting:**
17+
1618``` bash
17- make check # Check lockfile, formatting, and linting
18- make lint # Check linting only
19- make format # Apply formatting fixes
19+ just check # Check lockfile, formatting, and linting
20+ just lint # Check linting only
21+ just format # Apply formatting fixes
2022```
2123
2224** Documentation Generation:**
25+
2326``` bash
24- make docs # Generate schema documentation
27+ just docs # Generate schema documentation
2528```
2629
2730** Build and Environment:**
31+
2832``` bash
29- make dev # Sync default dev dependencies
30- make build # Build source and wheel distributions
31- make clean # Remove local build/test artifacts
33+ just dev # Sync default dev dependencies
34+ just build # Build source and wheel distributions
35+ just clean # Remove local build/test artifacts
3236```
3337
3438## Project Architecture
3539
3640### Repository Structure
41+
3742- ** Root Level:** Python SDK package, project metadata, tests, and examples
3843- ** ` src/dify_plugin/ ` :** Main Python SDK implementation
3944- ** ` examples/ ` :** Complete plugin examples (GitHub, OpenAI, Jina, etc.)
@@ -43,48 +48,56 @@ make clean # Remove local build/test artifacts
4348The Dify Plugin SDK follows a modular architecture with clear separation of concerns:
4449
4550#### Core Components (` src/dify_plugin/core/ ` )
51+
4652- ** ` runtime.py ` :** Session management and backwards invocation system
4753- ** ` plugin_executor.py ` :** Main execution engine for plugin operations
4854- ** ` plugin_registration.py ` :** Plugin discovery and registration system
4955- ** ` server/ ` :** Multi-protocol communication layer (stdio, TCP, serverless)
5056
5157#### Plugin Types (` src/dify_plugin/interfaces/ ` )
58+
5259- ** ` model/ ` :** AI model integrations (LLM, embedding, TTS, etc.)
5360- ** ` tool/ ` :** Tool providers and individual tools
5461- ** ` agent/ ` :** Agent strategy implementations
5562- ** ` endpoint/ ` :** HTTP endpoint handlers
5663- ** ` trigger/ ` :** Event trigger handlers
5764
5865#### Communication Patterns
66+
59671 . ** Local Install:** stdio-based communication for development
60682 . ** Remote Install:** TCP-based communication for production deployment
61693 . ** Serverless:** HTTP-based communication for serverless environments
6270
6371#### Plugin Manifest System
72+
6473- ** ` manifest.yaml ` :** Plugin metadata and configuration
6574- ** Version Management:** Semantic versioning with compatibility matrix
6675- ** Runtime Configuration:** Memory limits, permissions, language requirements
6776
6877### Key Architectural Patterns
6978
7079#### Session-based Runtime
80+
7181- Each plugin operation runs in a ` Session ` context
7282- Sessions provide access to invocations (model, tool, app, storage, file)
7383- Backwards invocation allows plugins to call Dify services
7484
7585#### Multi-Modal Communication
86+
7687- ** Full-duplex:** Real-time bidirectional communication (Local/Remote)
7788- ** HTTP streaming:** Server-sent events for serverless environments
7889- ** Blob handling:** Chunked transfer for large binary data
7990
8091#### Provider-Tool Architecture
92+
8193- ** Providers:** Authentication and configuration management
8294- ** Tools:** Individual operations within a provider
8395- ** Credentials:** OAuth and API key management with validation
8496
8597## Plugin Examples Structure
8698
8799Each example in ` examples/ ` follows a consistent structure:
100+
88101- ** ` manifest.yaml ` :** Plugin metadata
89102- ** ` main.py ` :** Plugin entry point
90103- ** ` provider/ ` :** Provider configuration and implementation
@@ -102,5 +115,5 @@ Each example in `examples/` follows a consistent structure:
102115
1031161 . Use existing examples as templates for new plugins
1041172 . Implement plugin interfaces in the appropriate category
105- 3 . Run ` make check` before submitting code changes
106- 4 . Run ` make test` when changes affect runtime behavior, SDK interfaces, or examples
118+ 3 . Run ` just check` before submitting code changes
119+ 4 . Run ` just test` when changes affect runtime behavior, SDK interfaces, or examples
0 commit comments