Saltar al contenido principal
Resumen

Esta página está en inglés.

Anthropic decision tool

Call strike-1 from an Anthropic tool_use handler with strike-ai.

strike-ai does not ship an Anthropic tool schema helper. Prefer the MCP server when your host supports MCP. From a Messages API tool_use handler, call Client.decide and return a tool_result block.

Python
import json
from strike_ai import Client

client = Client()

def handle_tool_use(block: dict) -> dict:
    args = block["input"]
    kind = args["kind"]
    question = args["question"]
    options = args.get("options")
    context = args.get("context") or ""
    if kind == "yes_no":
        q = {"type": "noul", "instructions": question}
    elif kind == "score":
        q = {"type": "score", "instructions": question, "criteria": list(options or [])}
    else:
        q = {
            "type": "choice",
            "instructions": question,
            "criteria": {str(o): None for o in (options or [])},
        }
    answer = client.decide(context or question, {"answer": q})["answers"]["answer"]
    return {
        "type": "tool_result",
        "tool_use_id": block["id"],
        "content": json.dumps(answer),
    }

Add a tool definition with name strike_decision (or your own name) and the same argument fields as on the MCP page.

Strike AI | Anthropic decision tool