Testing
The SDK ships a mock_context() helper so you can test tool functions without a running platform.
from proxima_sdk.testing import mock_context
mock_context
def mock_context(
sources: dict[str, list[dict]] = {},
session: dict = {},
agent_id: str = "test-agent",
user_id: str = "test-user",
) -> PlatformContext
sources maps source IDs to lists of row dicts. The mock knowledge client returns these rows when queried.
Example
from proxima_sdk.testing import mock_context
from my_toolbox.tools import check_overdue_invoices
def test_overdue_invoices():
ctx = mock_context(sources={
"invoices-gold": [
{"invoice_id": "INV-001", "amount": 5000, "days_overdue": 45},
{"invoice_id": "INV-002", "amount": 1200, "days_overdue": 12},
]
})
result = check_overdue_invoices({"threshold_days": 30}, ctx)
assert result["count"] == 1
assert result["invoices"][0]["id"] == "INV-001"
Asserting governance calls
def test_audit_logging():
ctx = mock_context()
my_tool({}, ctx)
assert "queried_invoices" in ctx.governance.logged_actions
✓
Run your tests with pytest — no platform connection required.