Summary
The Python SDK currently uses generic exceptions like RuntimeError and Exception. Creating domain-specific exception classes will improve error handling and debugging.
Current State
- Location:
sdk/python/agentfield/
- Issue: Generic exceptions throughout the codebase
- Current: Only
RateLimitError exists as a custom exception
Proposed Exception Classes
Create the following exception hierarchy:
class AgentFieldError(Exception):
"""Base exception for all AgentField SDK errors."""
pass
class AgentFieldClientError(AgentFieldError):
"""Error communicating with the AgentField control plane."""
pass
class ExecutionTimeoutError(AgentFieldError):
"""Execution timed out waiting for completion."""
pass
class MemoryAccessError(AgentFieldError):
"""Error accessing agent memory storage."""
pass
class RegistrationError(AgentFieldError):
"""Error registering agent with control plane."""
pass
class ValidationError(AgentFieldError):
"""Input validation error."""
pass
Tasks
- Create
sdk/python/agentfield/exceptions.py with exception classes
- Export exceptions from
sdk/python/agentfield/__init__.py
- Update docstrings with raised exceptions information
Acceptance Criteria
Files
sdk/python/agentfield/exceptions.py (new)
sdk/python/agentfield/__init__.py (update exports)
Using AI to solve this issue? Read our AI-Assisted Contributions guide for testing requirements, prompt strategies, and common pitfalls to avoid.
Summary
The Python SDK currently uses generic exceptions like
RuntimeErrorandException. Creating domain-specific exception classes will improve error handling and debugging.Current State
sdk/python/agentfield/RateLimitErrorexists as a custom exceptionProposed Exception Classes
Create the following exception hierarchy:
Tasks
sdk/python/agentfield/exceptions.pywith exception classessdk/python/agentfield/__init__.pyAcceptance Criteria
exceptions.py__init__.pypytest)ruff check)Files
sdk/python/agentfield/exceptions.py(new)sdk/python/agentfield/__init__.py(update exports)