Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description: "Product updates and release notes for HUD SDK and Platform."
- **`hud sync env`** — sync local environment configs with collision detection (replaces `hud link`).
- **`hud eval` accepts Python files** — run evaluations directly from `.py` files and directories containing `Task` objects.
- **Chat class** — manage multi-turn agent conversations from a single SDK abstraction.
- **GPT-5 support** — `ResponseAgent` defaults to `gpt-5`, with ToolSearch tool support.
- **GPT-5 support** — auto-response classification defaults to `gpt-5`, with ToolSearch tool support.
- **Citations** — citation support for Claude, Gemini, and OpenAI responses in chat and agent traces.

### Platform
Expand Down
7 changes: 2 additions & 5 deletions docs/reference/agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Abstract base class for all MCP-enabled agents. Handles the agent loop, MCP clie
|-----------|------|-------------|---------|
| `mcp_client` | `AgentMCPClient` | MCP client for server connections | `None` |
| `auto_trace` | `bool` | Enable automatic tracing spans | `True` |
| `auto_respond` | `bool` | Use ResponseAgent to decide when to stop/continue | `False` |
| `auto_respond` | `bool` | Use response automation to decide when to stop/continue | `False` |
| `verbose` | `bool` | Verbose console logs for development | `False` |

**Base Config** (shared by all agents):
Expand All @@ -63,9 +63,6 @@ async def run(ctx: EvalContext, max_steps: int = 10) -> Trace:

async def call_tools(tool_call: MCPToolCall | list[MCPToolCall]) -> list[MCPToolResult]:
"""Execute tool calls through MCP client."""

def get_available_tools() -> list[types.Tool]:
"""Get filtered list of available tools."""
```

## Pre-built Agents
Expand Down Expand Up @@ -251,7 +248,7 @@ result = await agent.run(task, max_steps=20)

### Auto-Respond Mode

When `auto_respond=True`, the agent uses a ResponseAgent to decide whether to continue or stop after each model response:
When `auto_respond=True`, the agent uses response automation to decide whether to continue or stop after each model response:

```python
agent = ClaudeAgent.create(
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/cli/eval.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ hud eval [SOURCE] [AGENT] [OPTIONS]
</ParamField>

<ParamField path="--auto-respond" type="boolean">
Use ResponseAgent to decide when to stop/continue. Default: True for `--full`.
Use response automation to decide when to stop/continue. Default: True for `--full`.
</ParamField>

### Taskset Association
Expand Down
6 changes: 2 additions & 4 deletions docs/reference/types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ print(result.reward, result.done)
| `trace` | `list[TraceStep]` | Execution trace steps |
| `messages` | `list[Any]` | Final conversation state |

## InferenceResult
## AgentResponse

Returned by agent `get_response()` methods. Represents the result of a single LLM inference call.

```python
from hud.types import InferenceResult
from hud.types import AgentResponse
```

| Field | Type | Description |
Expand All @@ -129,8 +129,6 @@ from hud.types import InferenceResult
| `info` | `dict[str, Any]` | Provider-specific metadata |
| `isError` | `bool` | Error flag |

> **Note:** `AgentResponse` is available as a backwards-compatible alias for `InferenceResult`.

## AgentType

Enum of supported agent types.
Expand Down
84 changes: 2 additions & 82 deletions hud/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -1,95 +1,15 @@
from __future__ import annotations

import sys
from types import ModuleType
from typing import Any

from .base import CategorizedTools, MCPAgent
from .base import MCPAgent
from .claude import ClaudeAgent
from .gateway import create_agent
from .openai import OpenAIAgent
from .openai_compatible import OpenAIChatAgent

__all__ = [
"CategorizedTools",
"ClaudeAgent",
"MCPAgent",
"OpenAIAgent",
"OpenAIChatAgent",
"create_agent",
]


def _install_openai_chat_compat_module() -> None:
module_name = f"{__name__}.openai_chat"
if module_name in sys.modules:
return

module: Any = ModuleType(module_name, "Compatibility module for OpenAIChatAgent.")
module.OpenAIChatAgent = OpenAIChatAgent
module.__all__ = ["OpenAIChatAgent"]
sys.modules[module_name] = module


_install_openai_chat_compat_module()


def create_agent(model: str, **kwargs: Any) -> MCPAgent:
"""Create an agent for a gateway model.

This routes ALL requests through the HUD gateway. For direct API access
(using your own API keys), use the agent classes directly.

Args:
model: Model name (e.g., "gpt-5.4", "claude-sonnet-4-6").
**kwargs: Additional params passed to agent.create().

Returns:
Configured MCPAgent instance with gateway routing.

Example:
```python
# Gateway routing (recommended)
agent = create_agent("gpt-5.4")
agent = create_agent("claude-sonnet-4-6", temperature=0.7)

# Direct API access (use agent classes)
from hud.agents.claude import ClaudeAgent

agent = ClaudeAgent.create(model="claude-sonnet-4-6")
```
"""
from hud.agents.gateway import build_gateway_client
from hud.agents.resolver import resolve_cls

# Resolve class and gateway info
agent_cls, gateway_info = resolve_cls(model)

# Get model name from gateway info or use input
model_id = model
if gateway_info:
model_id = gateway_info.get("model_name") or model

# Determine provider: from gateway info, or infer from agent class
if gateway_info:
provider = gateway_info["provider"]["name"]
else:
provider = "openai"
if agent_cls.__name__ == "ClaudeAgent":
provider = "anthropic"
elif agent_cls.__name__ == "GeminiAgent":
provider = "gemini"

client = build_gateway_client(provider)

# Set up kwargs
kwargs.setdefault("model", model_id)

# Use correct client key based on agent type
if agent_cls == OpenAIChatAgent:
kwargs.setdefault("openai_client", client)
else:
# Claude and other agents use model_client and validate_api_key
kwargs.setdefault("model_client", client)
kwargs.setdefault("validate_api_key", False)

return agent_cls.create(**kwargs)
Loading
Loading