Skip to main content

@decision Decorator

The @decision decorator marks methods as LLM-powered decision points. Decisions are the primary way agents interact with language models.

Basic Usage

from waxell_sdk import agent, decision

@agent(name="classifier")
class Classifier:

@decision
def classify_intent(self, ctx):
"""Classify the user's intent."""
return ctx.llm.classify(
ctx.input.message,
categories=["question", "complaint", "request", "feedback"]
)

Decision Types

Classification

@decision
def classify(self, ctx):
return ctx.llm.classify(
text=ctx.input.text,
categories=["positive", "negative", "neutral"]
)

Generation

@decision
def generate_response(self, ctx):
return ctx.llm.generate(
prompt=f"Respond to: {ctx.input.message}",
max_tokens=500
)

Structured Output

from pydantic import BaseModel

class Analysis(BaseModel):
sentiment: str
confidence: float
topics: list[str]

@decision
def analyze(self, ctx):
return ctx.llm.generate(
prompt=f"Analyze: {ctx.input.text}",
response_model=Analysis
)

Governance

Decisions are subject to governance policies:

  • Token Limits: Maximum tokens per decision
  • Model Restrictions: Allowed models per agent
  • Content Filters: Block sensitive content

Next Steps