# Configuring Build Agent Startup Properties

In TeamCity, a build agent contains two processes:

• Agent launcher – a Java process that launches the agent process.

• Agent – the main process for a build agent; runs as a child process for the agent launcher.

Whether you run a build agent via the agent.bat|sh script or as a Windows service, the agent launcher starts first, and then it starts the agent itself. Remember that running an agent via script is the recommended approach but you might want to run it as a service in certain cases; refer to this page for more information.

## Agent Properties

For both processes mentioned above, you can customize the final agent behavior by specifying system properties and variables for the agent to run with.

### Build Agent is Run via Script

Before you run the <Agent_Home>\bin\agent.bat|sh script, set the following environment variables in your OS:

• TEAMCITY_AGENT_MEM_OPTS – set agent memory options (JVM options)

• TEAMCITY_AGENT_OPTS – additional agent JVM options

### Build Agent is Run as Service

In the <Agent_Home>\launcher\conf\wrapper.conf file, add the following lines (one per option):

wrapper.app.parameter.<N>

## Agent Launcher Properties

Only rare cases might require changing agent launcher properties. Before modifying these, make sure your problem cannot be solved by changing the main agent process properties described above.

### Build Agent is Run via Script

Before you run the <Agent_Home>\bin\agent.bat|sh script, set the TEAMCITY_LAUNCHER_OPTS environment variable.

### Build Agent is Run as Service

In the <Agent_Home>\launcher\conf\wrapper.conf file, add the following lines (one per option, the N number should increase):