# Class CodeBlock (0.7.0)

0.7.0 (latest) 0.6.0 0.5.0 0.4.0 0.3.0

    CodeBlock(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A code block to be executed instead of a real tool call.

| ## Attribute ||
|---|---|
| **Name** | **Description** |
| `python_code` | `str` Required. Python code which will be invoked in tool fake mode. Expected Python function signature - To catch all tool calls: def fake_tool_call(tool: Tool, input: dict\[str, Any\], callback_context: CallbackContext) -\> Optional\[dict\[str, Any\]\]: To catch a specific tool call: def fake\\_{tool_id}(tool: Tool, input: dict\[str, Any\], callback_context: CallbackContext) -\> Optional\[dict\[str, Any\]\]: If the function returns None, the real tool will be invoked instead. |