Skip to main content

Overview

The BaseAgent abstract class defines the interface that all Harbor agents must implement. Extend this class to create custom agents that can be evaluated using Harbor’s framework. Import: from harbor.agents.base import BaseAgent

Class Attributes

bool
default:"False"
Whether the agent supports Harbor’s Agent Trajectory Interchange Format (ATIF). Set to True in subclasses that can produce trajectory data.
Path
required
Directory where agent logs should be written.
str | None
The model identifier in format provider/model-name (e.g., anthropic/claude-opus-4-1).
logging.Logger
Logger instance for the agent.
list[MCPServerConfig]
MCP (Model Context Protocol) servers available to the agent from task configuration.
str | None
Path to the skills directory in the environment.

Constructor

Path
required
Path where logs should be written.
str | None
Model identifier. If it contains /, it’s split into provider and model name.
logging.Logger | None
Optional logger. If not provided, uses the global Harbor logger.
list[MCPServerConfig] | None
MCP servers from task config to register with the agent.
str | None
Skills directory path in the environment.

Abstract Methods

These methods must be implemented by all subclasses.

name

Returns the name of the agent (e.g., "claude-code", "openhands").
str
required
The agent’s identifier name.

version

Returns the version of the agent implementation.
str | None
required
Version string or None if version is unknown.

setup

Run commands to setup the agent and its tools in the environment. This is called before the agent runs. Use this method to:
  • Install agent dependencies
  • Register MCP servers from self.mcp_servers
  • Copy skills from self.skills_dir to the agent’s expected location
  • Configure the agent
BaseEnvironment
required
The environment in which to setup the agent.

run

Executes the agent in the environment to complete the given task.
str
required
The natural language task instruction for the agent.
BaseEnvironment
required
The environment in which to complete the task.
AgentContext
required
Context object to populate with execution results (tokens, cost, trajectories, metadata). Should be populated during execution to preserve data even on timeout.

Instance Methods

to_agent_info

Converts the agent to an AgentInfo object for result tracking.
AgentInfo
Information about the agent including name, version, and model details.

import_path

Returns the import path of the agent class.
str
Formatted as 'some.module.path:AgentClass'.

Example Implementation