Your app should call lookup_order. It prints a sentence instead. You can see the wrong output. You still need to find where the tool call went missing.
I built AI Bridge to stop at that exact point. Point your app’s Chat Completions client at a local endpoint and AI Bridge holds the next request. You or a coding agent can open the actual payload, inspect the tools, and send back the completion you want the app to handle.
In this walkthrough we’ll return one known-good lookup_order call and use it to locate the failure. The local demo runs without a provider API key.
Source and quickstart on GitHub
The test: inspect the outgoing request and send back one valid tool call. If the app still fails, you have a fixed response to trace through the parser and dispatcher.
1. Start a local endpoint
Use Python 3.10 or newer on a Unix-like system. Run this in the first terminal.
git clone https://github.com/skywayapsny/ai-bridge.git
cd ai-bridge
python3 -m venv .venv
. .venv/bin/activate
python -m pip install .
AI_BRIDGE_MODELS=debug ai-bridge --host 127.0.0.1 --port 8777
2. Send one request with a tool schema
This curl call stands in for the app. It waits for you to answer from another terminal.
curl -sS http://127.0.0.1:8777/v1/chat/completions \
-H 'Content-Type: application/json' -d @- <<'JSON'
{
"model": "debug",
"messages": [{"role": "user", "content": "Where is order A123?"}],
"tools": [{
"type": "function",
"function": {
"name": "lookup_order",
"parameters": {
"type": "object",
"properties": {"order_id": {"type": "string"}},
"required": ["order_id"]
}
}
}]
}
JSON
3. Inspect the request and answer it
Open another terminal in the repository directory. Claim the request and read its tools field. A claim includes a lease token, which the CLI can read from a claim file. The token ties the reply to the caller holding the lease.
. .venv/bin/activate
claim_dir=$(mktemp -d)
trap 'rm -f "$claim_dir/claim.json"; rmdir "$claim_dir"' EXIT
claim_file="$claim_dir/claim.json"
ai-bridge-agent --client-id local-debug claim \
--model debug --wait 10 --out "$claim_file"
request_id=$(python -c 'import json, sys; print(json.load(open(sys.argv[1]))["request"]["id"])' "$claim_file")
python -c 'import json, sys; print(json.dumps(json.load(open(sys.argv[1]))["request"]["tools"], indent=2))' "$claim_file"
ai-bridge-agent respond "$request_id" --claim-file "$claim_file" \
--tool lookup_order --args '{"order_id":"A123"}'
Look for these fields in choices[0] of the response.
{
"finish_reason": "tool_calls",
"message": {
"tool_calls": [{
"function": {
"name": "lookup_order",
"arguments": "{\"order_id\":\"A123\"}"
}
}]
}
}
The caller parses function.arguments as JSON before it dispatches the tool.
Find the layer that failed
Point a development instance of your app at http://127.0.0.1:8777/v1 and set its model to debug. Run the failing workflow, claim the real request, and check three points.
| Observation | Next place to inspect |
|---|---|
lookup_order is absent from the claimed request |
Tool registration and the code that builds the model request |
| The controlled tool call reaches the client, but the application never sees a parsed call | SDK response handling or the app’s response parser |
| The parsed call is present, but the order lookup never runs | Tool routing, argument validation, and dispatcher logs |
If this run succeeds, you have a response shape that the app handles. Compare it with the failing response from the upstream model. Look at the tool name, arguments and any differences between the app’s streaming and non-streaming paths before changing the prompt.
Give the same reproduction to your coding agent
Give the agent the bridge URL, the debug model tag and access to the relevant workspace. Ask it to claim the live request, return the fixed reply and show the first place where the call disappears. That gives it a specific request to trace through your app’s code and logs. Agent protocol
If you try this on your app, start with one failing request and one tool. Save the response that reproduces the issue as a test fixture once you find the bug.
I’m the author of AI Bridge. An AI agent drafted this article and generated the cover.
Top comments (0)