Skip to main content
Core types used throughout the HUD SDK.

Task

Created by calling an Environment. Holds configuration for running an evaluation.
from hud import Environment

env = Environment("my-env")
task = env("scenario_name", arg1="value")  # Returns Task
FieldTypeDescription
envEnvironment | dict | NoneSource environment
scenariostr | NoneScenario name to run
argsdict[str, Any]Script arguments
trace_idstr | NoneTrace identifier
job_idstr | NoneParent job ID
group_idstr | NoneGroup ID for parallel runs
indexintIndex in parallel execution
variantsdict[str, Any] | NoneVariant assignment

EvalContext

Returned by hud.eval(). Extends Environment with evaluation tracking.
async with hud.eval(task) as ctx:
    print(ctx.prompt)      # Task prompt
    print(ctx.variants)    # Current variant
    ctx.reward = 1.0       # Set reward
PropertyTypeDescription
trace_idstrUnique trace identifier
eval_namestrEvaluation name
promptstr | NoneTask prompt
variantsdict[str, Any]Current variant assignment
rewardfloat | NoneEvaluation reward
answerstr | NoneSubmitted answer
errorBaseException | NoneError if failed
resultslist[EvalContext]Results from parallel runs
headersdict[str, str]Trace headers

MCPToolCall

Represents a tool call to execute.
from hud.types import MCPToolCall

call = MCPToolCall(
    name="navigate",
    arguments={"url": "https://example.com"}
)
FieldTypeDescription
idstrUnique identifier (auto-generated)
namestrTool name
argumentsdict[str, Any]Tool arguments

MCPToolResult

Result from executing a tool call.
from hud.types import MCPToolResult

result = MCPToolResult(
    content=[TextContent(text="Success", type="text")],
    isError=False
)
FieldTypeDescription
contentlist[ContentBlock]Result content blocks
structuredContentdict | NoneStructured result data
isErrorboolWhether the call failed

Trace

Returned by agent.run(). Contains the result of an agent execution.
from hud.types import Trace

result = await agent.run(task, max_steps=20)
print(result.reward, result.done)
FieldTypeDescription
rewardfloatEvaluation score (0.0-1.0)
doneboolWhether execution completed
contentstr | NoneFinal response content
isErrorboolWhether an error occurred
infodict[str, Any]Additional metadata
tracelist[TraceStep]Execution trace steps
messageslist[Any]Final conversation state

AgentResponse

Returned by agent get_response() methods.
from hud.types import AgentResponse
FieldTypeDescription
tool_callslist[MCPToolCall]Tools to execute
doneboolWhether agent should stop
contentstr | NoneResponse text
reasoningstr | NoneModel reasoning/thinking
infodict[str, Any]Provider-specific metadata
isErrorboolError flag

AgentType

Enum of supported agent types.
from hud.types import AgentType

agent_cls = AgentType.CLAUDE.cls
agent = agent_cls.create()
ValueAgent Class
AgentType.CLAUDEClaudeAgent
AgentType.OPENAIOpenAIAgent
AgentType.OPERATOROperatorAgent
AgentType.GEMINIGeminiAgent
AgentType.OPENAI_COMPATIBLEOpenAIChatAgent

ContentBlock

MCP content types (from mcp.types):
from mcp.types import TextContent, ImageContent

# Text
TextContent(text="Hello", type="text")

# Image
ImageContent(data="base64...", mimeType="image/png", type="image")

EvaluationResult

Returned by evaluation tools.
from hud.tools.types import EvaluationResult

result = EvaluationResult(
    reward=0.8,
    done=True,
    content="Task completed",
    info={"score": 80}
)
FieldTypeDescription
rewardfloatScore (0.0-1.0)
doneboolTask complete
contentstr | NoneDetails
infodictMetadata

See Also