Contribute to AFK — conventions, patterns, and quality tools.
This guide is for developers contributing to the AFK framework itself. It covers the implementation workflow, code conventions, testing expectations, and quality tools.
Building an app with AFK? See Building with
AI instead. This page is for AFK framework
contributors.
Start with the Pydantic model or Python protocol that defines the interface. This is the most important step — everything else flows from the contract.
Test the failure paths first — they’re more important than the happy path. Every error should be classified (retryable, terminal, non-fatal).
Copy
def test_tool_timeout_produces_record(): """Timeout should produce a record with success=False, not crash.""" record = await execute_tool(slow_tool_call) assert record.success is False assert "timeout" in record.error.lower()def test_invalid_args_returns_validation_error(): """Bad arguments should return a clear error, not raise.""" record = await execute_tool(bad_args_call) assert record.success is False assert "validation" in record.error.lower()
4
Document interfaces
Add docstrings to public functions and classes. Include parameter descriptions and examples.
Eval tests for agent behavior (prompt produces expected output)
Test failure semantics first. The happy path usually works. The failure
paths are where bugs hide. For every new feature, write at least 2 failure
tests for every 1 success test.