This document provides information for developers working on the Jules Agent SDK.
jules-api-python-sdk/
├── src/
│ └── jules_agent_sdk/
│ ├── __init__.py # Package exports
│ ├── base.py # Sync HTTP client
│ ├── async_base.py # Async HTTP client
│ ├── client.py # Main sync client
│ ├── async_client.py # Main async client
│ ├── exceptions.py # Custom exceptions
│ ├── models.py # Data models
│ ├── sessions.py # Sessions API
│ ├── activities.py # Activities API
│ └── sources.py # Sources API
├── tests/
│ ├── test_client.py # Sync client tests
│ ├── test_async_client.py # Async client tests
│ └── test_models.py # Model tests
├── examples/
│ ├── basic_usage.py # Basic example
│ ├── async_example.py # Async example
│ └── plan_approval_example.py # Plan approval workflow
├── docs/
│ ├── README.md # Main documentation
│ └── DEVELOPMENT.md # This file
├── setup.py # Setup script
├── pyproject.toml # Project metadata
└── LICENSE # MIT License
- Clone the repository:
git clone https://github.com/jules/jules-agent-sdk.git
cd jules-agent-sdk- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install in development mode with all dependencies:
pip install -e ".[dev]"Run all tests:
pytestRun with coverage:
pytest --cov=jules_agent_sdk --cov-report=htmlRun specific test file:
pytest tests/test_client.py -vRun specific test:
pytest tests/test_client.py::TestJulesClient::test_client_initialization -vFormat code with Black:
black src testsCheck formatting:
black --check src testsRun mypy for type checking:
mypy srcRun flake8:
flake8 src testsIf adding a new API endpoint:
- Update the appropriate module in
src/jules_agent_sdk/(e.g.,sessions.py) - Add method with proper type hints and docstrings
- Add corresponding async method in
async_client.py - Update tests
Example:
def new_method(self, param: str) -> ModelType:
"""Description of the method.
Args:
param: Description
Returns:
Description
Example:
>>> client.resource.new_method("value")
"""
response = self.client.get(f"resource/{param}")
return ModelType.from_dict(response)If adding a new data model:
- Add dataclass in
src/jules_agent_sdk/models.py - Implement
from_dict()andto_dict()methods - Add type hints
- Add tests in
tests/test_models.py
Example:
@dataclass
class NewModel:
"""Description of the model."""
field1: str
field2: int
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "NewModel":
"""Create from API response dictionary."""
return cls(
field1=data.get("field1", ""),
field2=data.get("field2", 0),
)
def to_dict(self) -> Dict[str, Any]:
"""Convert to API request dictionary."""
return {
"field1": self.field1,
"field2": self.field2,
}If adding a new exception type:
- Add class in
src/jules_agent_sdk/exceptions.py - Inherit from appropriate base exception
- Update error handling in
base.pyif needed
- Build the package:
python -m build- Upload to Test PyPI:
twine upload --repository testpypi dist/*- Test installation:
pip install --index-url https://test.pypi.org/simple/ jules-agent-sdk- Ensure version is updated in
pyproject.tomlandsetup.py - Build:
python -m build- Upload:
twine upload dist/*We use semantic versioning (MAJOR.MINOR.PATCH):
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
Update version in:
pyproject.tomlsetup.pysrc/jules_agent_sdk/__init__.py
Follow Google-style docstrings:
def function(param1: str, param2: int) -> bool:
"""Short description.
Longer description if needed.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of return value
Raises:
ExceptionType: When this exception is raised
Example:
>>> result = function("test", 42)
>>> print(result)
True
"""When adding features, update:
docs/README.md- Main user documentation- Example files in
examples/
The project uses GitHub Actions for CI/CD:
- Run tests on multiple Python versions
- Check code formatting
- Run type checking
- Generate coverage reports
If you get import errors, ensure the package is installed in development mode:
pip install -e .If async tests fail, ensure pytest-asyncio is installed:
pip install pytest-asyncioIf mypy fails, check:
- All functions have type hints
- Return types are specified
- Optional types use
Optional[T]
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and code quality checks
- Submit a pull request
For questions or issues:
- GitHub Issues: https://github.com/jules/jules-agent-sdk/issues
- Email: support@jules.ai