decide and adecide
Sync and async decision calls, decorators, and DecisionResult fields.
decide
strike.decide(question, options, **kwargs) calls strike-1 synchronously.
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
options | Kind |
|---|---|
| list of strings | choice |
"yes_no" / None | yes_no |
int (e.g. 5) | score with levels 1..n |
Decision instance | uses 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 dictmessages=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).
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.
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
| Field | Meaning |
|---|---|
kind | choice, score, or yes_no |
answer | Chosen option label |
probabilities | Map option → probability (sums to 1) |
confidence | Probability of answer |
prob_source | "native" for strike-1 |
score | Expected score level for score decisions |
model | strike-1 |
provider | strike |
latency_ms | Server-reported latency when present |
tokens | Usage dict when present |
request_id | API request id |
trace_id | Decision span id when tracing recorded the call |
run_id | Host run id when tracing recorded the call |
low_confidence | True when below min_confidence |
yes | Property: answer == "yes" |
Serialize for agents:
payload = result.to_dict()Strike client
For multiple engines or explicit StrikeModel options:
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>.