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
7 changes: 7 additions & 0 deletions internal/common/task_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ func AugmentArgsForTask(task *types.Task, args []string, opts TaskAugmentOptions
args = append(args, "--no-computer-use")
}
}

// Pass harness setting if explicitly configured.
if task.AgentConfigSnapshot.Harness != nil && task.AgentConfigSnapshot.Harness.Type != nil {
if harness := strings.TrimSpace(*task.AgentConfigSnapshot.Harness.Type); harness != "" {
args = append(args, "--harness", harness)
}
}
}

if task.AgentConfigSnapshot != nil && task.AgentConfigSnapshot.EnvironmentID != nil {
Expand Down
20 changes: 20 additions & 0 deletions internal/common/task_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,26 @@ func TestAugmentArgsForTask_IdleOnCompletePrecedence(t *testing.T) {
opts: TaskAugmentOptions{IdleOnComplete: "20m"},
expected: []string{"agent", "run", "--idle-on-complete", "20m"},
},
{
name: "adds --harness when harness type is set",
task: &types.Task{
AgentConfigSnapshot: &types.AmbientAgentConfig{
Harness: &types.Harness{Type: strPtr("claude")},
},
},
opts: TaskAugmentOptions{},
expected: []string{"agent", "run", "--harness", "claude", "--idle-on-complete"},
},
{
name: "skips --harness when harness type is nil",
task: &types.Task{
AgentConfigSnapshot: &types.AmbientAgentConfig{
Harness: &types.Harness{},
},
},
opts: TaskAugmentOptions{},
expected: []string{"agent", "run", "--idle-on-complete"},
},
{
name: "still appends other config-derived args before idle timeout",
task: &types.Task{
Expand Down
17 changes: 16 additions & 1 deletion internal/types/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,20 @@ type TaskDefinition struct {
Prompt string `json:"prompt"`
}

// AmbientAgentConfig represents the agent configuration
// Harness defines a third-party harness to run a cloud agent with.
type Harness struct {
// Type is the name of the harness, e.g. "claude".
Type *string `json:"type,omitempty"`
}

// HarnessAuthSecrets holds authentication secrets for third-party harnesses.
// Only the secret for the harness specified gets injected into the environment.
type HarnessAuthSecrets struct {
// ClaudeAuthSecretName is the name of a managed secret for Claude Code harness authentication.
ClaudeAuthSecretName *string `json:"claude_auth_secret_name,omitempty"`
}

// AmbientAgentConfig represents the agent configuration.
type AmbientAgentConfig struct {
EnvironmentID *string `json:"environment_id,omitempty"`
BasePrompt *string `json:"base_prompt,omitempty"`
Expand All @@ -75,6 +88,8 @@ type AmbientAgentConfig struct {
MCPServers map[string]json.RawMessage `json:"mcp_servers,omitempty"`
ComputerUseEnabled *bool `json:"computer_use_enabled,omitempty"`
IdleTimeoutMinutes *int `json:"idle_timeout_minutes,omitempty"`
Harness *Harness `json:"harness,omitempty"`
HarnessAuthSecrets *HarnessAuthSecrets `json:"harness_auth_secrets,omitempty"`
}

// Task represents an ambient agent job.
Expand Down
Loading