Tool & function calling
AuraScore 81/100

Client Engagement Billing Dispatch Script Generator

Generates a Python tool calling harness to reconcile unbilled hours and trigger billing adjustments across enterprise ERP systems.

Use this template when professional services firms need an automated agent tool schema and script to detect billing anomalies, verify partner rate caps, and dispatch invoice adjustments.

Template

Role: Senior Billing Systems Integration Architect with fifteen years of experience in professional services financial operations.

Context

  • Professional services practice: {{firm_practice_area}}
  • Target ERP platform: {{erp_system_name}}
  • Billing contract rules: {{billing_rate_structure}}
  • Discrepancy trigger level: {{discrepancy_threshold}}
  • Designated approver role: {{approval_authority}}
  • Target currency denomination: {{currency_code}}

Task

Draft an end-to-end Python tool calling handler script and JSON schema specifications that an agent can execute to ingest timecard logs, identify unbilled leakage, validate variance thresholds, and post adjustment drafts to {{erp_system_name}}.

Method

  1. Define OpenAPI-compatible JSON schemas for three distinct tools: timecard log retrieval, partner rate validation against {{billing_rate_structure}}, and billing adjustment submission.
  2. Construct the tool execution dispatcher capable of mapping agent function call requests into executable Python handlers.
  3. Implement argument validation logic to verify that all financial figures use {{currency_code}} and align with {{firm_practice_area}} standards.
  4. Write mathematical comparison routines evaluating recorded consultant hours against {{discrepancy_threshold}}.
  5. Embed an approval routing branch requiring confirmation from {{approval_authority}} when rate overrides exceed policy.
  6. Add comprehensive error handling for ERP network timeouts, schema mismatches, and malformed entity IDs.
  7. Provide dummy test payload invocations displaying function-call routing, execution output, and formatted agent return messages.

Constraints

  • The generated script MUST be syntactically valid Python 3.10+ using type hints and docstrings.
  • MUST NOT hardcode mock API keys or sensitive production credentials.
  • Tool schemas must explicitly mark mandatory arguments with strict type definitions.
  • Error handling MUST return clean structured JSON envelopes rather than raw stack traces.

Output format

1. Function Schemas

JSON schemas for fetch_timecards, validate_rates, and post_adjustment.

2. Implementation Script

Fully commented Python module containing the dispatcher, mock ERP client, and validation rules (70-120 lines).

3. Execution Walkthrough

Step-by-step trace showing an example agent tool call, parameter parsing, and return output.

Self-review

  • Verify that {{discrepancy_threshold}} and {{currency_code}} are explicitly parsed in the validation routine.
  • Ensure all function definitions match OpenAI tool calling conventions.
  • Check that exception paths return JSON error objects.
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

ai-agents
agents-tool-calling
professional-services
function-calling
billing-automation
python-tools