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

decide and adecide

Sync and async decision calls, decorators, and DecisionResult fields.

decide

strike.decide(question, options, **kwargs) calls strike-1 synchronously.

Python
import strikeflow as strike

result = strike.decide(
    "Which team should handle this?",
    ["billing", "tech", "sales"],
    messages=[{"role": "user", "content": "Refund the duplicate charge on my card."}],
    run_id="ticket-4411",
    host="my-service",
)
print(result.answer, result.probabilities, result.confidence, result.trace_id)

Options argument

optionsKind
list of stringschoice
"yes_no" / Noneyes_no
int (e.g. 5)score with levels 1..n
Decision instanceuses that kind and option list

Force a kind with kind="score" or kind="yes_no" when needed.

Context sources

The model sees a single string state on the wire. The SDK builds it from:

  • context= string or JSON-serializable dict
  • messages= chat history (OpenAI dicts, Anthropic blocks, LangChain messages, or plain strings)
  • state= extra key/value map merged into context

Inside with strike.agent_context(messages=..., state=..., run_id=...):, omitted kwargs are filled automatically.

adecide

Use await strike.adecide(...) in async agents (same parameters as decide).

Python
import asyncio
import strikeflow as strike

async def main():
    result = await strike.adecide(
        "Escalate to a human?",
        "yes_no",
        context="Customer threatens to churn after repeated outages.",
    )
    print(result.answer)

asyncio.run(main())

decides decorator

Build context in your function; the decorator calls strike-1 with that return value.

Python
import strikeflow as strike

@strike.decides("Should we escalate?", "yes_no", min_confidence=0.8)
def escalation_context(ticket):
    return {"ticket_id": ticket["id"], "summary": ticket["summary"]}

result = escalation_context({"id": "t-1", "summary": "Angry customer"}, messages=[...], run_id="run-9")

Passthrough kwargs: messages, state, run_id (when not in the wrapped function signature).

DecisionResult

FieldMeaning
kindchoice, score, or yes_no
answerChosen option label
probabilitiesMap option → probability (sums to 1)
confidenceProbability of answer
prob_source"native" for strike-1
scoreExpected score level for score decisions
modelstrike-1
providerstrike
latency_msServer-reported latency when present
tokensUsage dict when present
request_idAPI request id
trace_idDecision span id when tracing recorded the call
run_idHost run id when tracing recorded the call
low_confidenceTrue when below min_confidence
yesProperty: answer == "yes"

Serialize for agents:

Python
payload = result.to_dict()

Strike client

For multiple engines or explicit StrikeModel options:

Python
import strikeflow as strike

engine = strike.Strike(model=strike.StrikeModel(model="strike-1", debias=False))
result = engine.decide("Pick one", ["a", "b"], context="demo")

HTTP endpoint used: POST {STRIKE_API_URL}/v1/systemone with Authorization: Bearer <STRIKE_API_KEY>.

decide and adecide: Strike docs