v3
latestOpenAPI 3.0.02026-08-081996601.2 MBTools
Test Lambda tool without creation
Tests a Lambda tool without creating it.
Use this to:
- Validate Python code syntax and security constraints
- Discover input/output schemas from type annotations
- Test execution with sample input
- Verify schema compatibility
- Exercise the lambda tool's tool_configurations with a stand-in test_context that supplies the agent metadata, secrets, and session metadata its $refs resolve against
The function runs in the same secure sandbox environment as production tools.
post/v2/tools/test
Headers
Request-Timeoutinteger
The platform makes a best effort to complete the request in the specified seconds, or it times out.
Request-Timeout-Millisinteger
The platform makes a best effort to complete the request in the specified milliseconds, or it times out.
Request body
Example request
{
"language": "python",
"code": "def process(order_count: int, total_revenue: float) -> dict:\n score = order_count * 10 + total_revenue * 0.1\n return {'score': round(score, 2)}\n",
"execution_configuration": {
"max_execution_time_seconds": 30,
"max_memory_mb": 100
},
"test_input": {
"order_count": 10,
"total_revenue": 500
},
"timeout_seconds": 10,
"test_context": {
"agent": {
"metadata": {
"ticket_api_base": "https://tickets.example.com/api/v1/"
},
"secrets": {
"ticket_api_token": "test-token"
}
},
"session": {
"metadata": {
"tenant_corpus": "kb"
}
}
}
}Response
The validation and execution results.
Example response
{
"validation": {
"status": "valid",
"errors": [
"Line 5: Use of forbidden module 'os'"
]
},
"input_schema": {
"type": "object",
"properties": {
"order_count": {
"type": "integer"
},
"total_revenue": {
"type": "number"
}
},
"required": [
"order_count",
"total_revenue"
]
},
"output_schema": {
"type": "object",
"properties": {
"score": {
"type": "number"
}
}
},
"execution": {
"success": true,
"output": {
"score": 105
},
"latency_millis": 125,
"memory_used_mb": 32,
"validation_results": {
"input_valid": true,
"output_valid": true,
"validation_errors": []
}
}
}