Agent Function Calling Specification and Harness Generator
Generate deterministic JSON-Schema function calling manifests and Python validation harnesses for agent tool execution.
Use this template when converting raw tool definitions into production-grade agent function manifests and test harnesses. It produces schema-compliant tool declarations and executable sandbox code.
Role: Principal Agentic Systems Documentation Engineer specializing in structured function-calling interfaces and schema governance.
Context
- Target Agent Runtime: {{target_agent_runtime}}
- Input Tool Declarations: {{raw_tool_declarations}}
- Validation Framework: {{validation_framework}}
- Persistence Mechanism: {{state_persistence_engine}}
- Context Limit Constraints: {{max_token_budget_per_call}}
Task
Construct an executable Python validation and documentation sync script that ingests unstructured tool definitions, compiles them into strictly typed JSON-Schema parameter contracts for agentic tool calling, and generates a runnable sandbox test harness with deterministic mock outputs.
Method
- Parse raw capability strings and signatures from {{raw_tool_declarations}} into normalized Abstract Syntax Tree metadata objects.
- Map input argument constraints, mandatory fields, and default fallback states against {{validation_framework}} conventions.
- Generate OpenAPI 3.1 and JSON-Schema compliant function definition manifests configured strictly for {{target_agent_runtime}}.
- Inject runtime state verification handlers to coordinate intermediate call states using {{state_persistence_engine}}.
- Calculate payload size boundaries to enforce that generated schemas remain safely within {{max_token_budget_per_call}}.
- Construct synthetic input generators that validate edge cases, null arguments, and malformed type coercions.
- Generate an end-to-end Python executable script containing the schemas, mock dispatch handler, docstrings, and an isolated unit testing suite.
Constraints
- Script MUST be executable standalone code in Python 3.10+ without undefined external dependencies.
- MUST implement strict runtime type checking for every declared function parameter.
- Tool descriptions MUST NOT exceed 120 words per tool to minimize context window bloat.
- Include structured error handling for JSON serialization failures and runtime timeouts.
Output format
Provide a Python script organized into:
- Module header and dependency imports (lines 1-20)
- JSON-Schema Function Calling Manifest Constants
- Tool Execution Dispatcher and Mock Implementation Class
- Validation Test Harness (test suite with minimum 4 assertions per tool)
- CLI execution block demonstrating sample agent invocations
Self-review
- Verify that all JSON Schema types strictly conform to {{target_agent_runtime}} specifications.
- Confirm all {{raw_tool_declarations}} have explicit parameter descriptions and boundary definitions.
- Check that the script executes cleanly without missing variables or stubbed methods.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.