You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: agent.go
    path of file: ./repos/infra/internal/cmd
    
    the code of the file until where you have to start completion: package cmd

import (
	"context"
	"errors"
	"fmt"
	"io/fs"
	"os"
	"os/exec"
	"path/filepath"
	"time"

	"github.com/cenkalti/backoff/v4"
	"github.com/shirou/gopsutil/v3/process"
	"github.com/spf13/cobra"
	"golang.org/x/sync/errgroup"

	"github.com/infrahq/infra/internal"
	"github.com/infrahq/infra/internal/logging"
	"github.com/infrahq/infra/internal/repeat"
)

func newAgentCmd() *cobra.Command {
	return &cobra.Command{
		Use:    "agent",
		Shor
    
func newAgentCmd() *cobra.Command {
	return &cobra.Command{
		Use:    "agent",
		Short:  "Start the Infra agent",
		Long:   "Start the Infra agent that runs to sync Infra state",
		Args:   NoArgs,
		Hidden: true,
		RunE: func(cmd *cobra.Command, _ []string) error {
			infraDir, err := initInfraHomeDir()
			if err != nil {
				return fmt.Errorf("infra home directory: %w", err)
			}
			logging.UseFileLogger(filepath.Join(infraDir, "agent.log"))

			group, ctx := errgroup.WithContext(context.Background())
			group.Go(func() error {
				backOff := &backoff.ExponentialBackOff{
					InitialInterval:     time.Minute,
					MaxInterval:         2 * time.Minute,
					RandomizationFactor: 0.05,
					Multiplier:          1.5,
					// MaxElapsedTime is the duration the infra agent should
					// continue to run without a successful sync. After this time
					// the agent will exit.
					MaxElapsedTime: 5 * time.Minute,
				}
				waiter := repeat.NewWaiter(backOff)
				for {
					if err := syncKubeConfig(ctx); err != nil {
						logging.L.Warn().Err(err).Msg("failed to sync kubeconfig")
					} else {
						waiter.Reset()
					}
					if err := waiter.Wait(ctx); err != nil {
						return err
					}
				}
			})
			// add the next agent task here

			logging.Infof("starting infra agent (%s)", internal.FullVersion())
			err = group.Wait()
			logging.L.Error().Err(err).Msg("infra agent exit")
			return err
		},
	}
}