Aller au contenu principal
Bêta non calibrée
StrikeStrike

Anthropic decision tool

Messages API tool_use blocks for strike_decision.

Tool definition

Python
import strikeflow as strike

tool = strike.strike_decision_tool()
definition = tool.anthropic()
assert definition["name"] == "strike_decision"

Add definition to the tools array of messages.create alongside your Anthropic model.

Handle tool_use

When Claude returns a tool_use block, convert it to a tool_result block:

Python
import json
import strikeflow as strike

tool = strike.strike_decision_tool()
history = [{"role": "user", "content": "Customer wants a refund for a duplicate charge."}]

block = {
    "type": "tool_use",
    "id": "toolu_01",
    "name": "strike_decision",
    "input": {
        "question": "Which team should handle this?",
        "kind": "choice",
        "options": ["billing", "tech", "sales"],
        "context": "Duplicate charge on invoice 4411.",
    },
}

tool_result = tool.handle_anthropic_tool_use(block, messages=history, run_id="msg-1")
message = {"role": "user", "content": [tool_result]}
out = json.loads(tool_result["content"])
print(out["answer"], out.get("confidence"))

If strike-1 fails, the handler sets "is_error": True on the tool result when the payload contains "error".

Anthropic decision tool: Strike docs