docs/agents/python.md
For Python providers, prompts, assertions, and scripts.
Use ruff for both:
ruff check --fix # Lint with auto-fix
ruff check --select I --fix # Sort imports
ruff format # Format code
Use the built-in unittest module for new Python tests.
requirements.txt filesdef call_api(prompt: str, options: dict, context: dict) -> dict:
"""
Args:
prompt: The prompt string
options: Provider configuration
context: Variables from the test case
Returns:
dict with 'output' key (and optionally 'error')
"""
# Implementation
return {"output": response_text}
def get_assert(output: str, context: dict) -> dict:
"""
Args:
output: The provider's output
context: Test context including vars
Returns:
dict with 'pass' (bool) and optionally 'reason'
"""
return {"pass": True, "reason": "Validation passed"}