Agent architecture, installing and authorizing agents, agent pools, requirements and compatibility matching, the buildAgent.properties file, parallel builds, and troubleshooting disconnected or incompatible agents
The free TeamCity Professional license includes 3 build agents. A "build agent" in license terms means a running agent — you can install more but only 3 can run builds simultaneously. Additional agents require a Professional or Enterprise license add-on.
# Download the agent ZIP from your TeamCity server
wget http://YOUR_TC_SERVER:8111/update/buildAgent.zip
# Extract
unzip buildAgent.zip -d /opt/buildagent-2
# Configure
cat > /opt/buildagent-2/conf/buildAgent.properties << 'EOF'
serverUrl=http://YOUR_TC_SERVER:8111
name=Agent-Linux-02
workDir=../work
tempDir=../temp
systemDir=../system
EOF
# Create service user and set permissions
useradd -m tcagent
chown -R tcagent:tcagent /opt/buildagent-2
# Start
sudo -u tcagent /opt/buildagent-2/bin/agent.sh start
# After unzipping buildAgent.zip, install as Windows service
# Edit conf/buildAgent.properties first, then:
C:\buildagent\bin\service.install.bat
# Start the service
net start "TeamCity Build Agent 2"
# Each agent needs its own directory with unique name and ports
# Agent 1: /opt/buildagent-1 name=Agent-1 ownPort=9090
# Agent 2: /opt/buildagent-2 name=Agent-2 ownPort=9091
# Both point to the same serverUrl
# buildAgent.properties for Agent 2
serverUrl=http://TC_SERVER:8111
name=Agent-Linux-02
ownPort=9091
Each agent must have a unique name in buildAgent.properties. If two agents have the same name, the second one will fail to connect. Default name is the hostname — change it explicitly when running multiple agents on the same machine.
Every agent must be authorized by a TeamCity administrator before it can run builds. This is a security measure — it prevents arbitrary machines from claiming to be build agents.
For automated agent provisioning (CI/CD of your CI/CD), you can pre-authorize an agent by setting a token:
# In buildAgent.properties
authorizationToken=TOKEN_FROM_SERVER
# Get tokens via REST API
GET /app/rest/agents?locator=authorized:false
# Then POST to /app/rest/agents/id:<agentId> with authorized:true
Agent pools group agents logically and then associate projects with specific pools. This ensures that e.g. production deployments only run on hardened agents, or that Java builds run on agents with JDK installed.
| Pool | Agents | Projects |
|---|---|---|
| Default Pool | General-purpose agents | All projects (unless specifically assigned) |
| Linux JDK 11 | Agent-Linux-01, Agent-Linux-02 | Backend Services (Java) |
| Windows .NET | Agent-Win-01 | Frontend (.NET) |
| Deploy Agents | Agent-Deploy-01 | Infrastructure/Deploy projects only |
Projects assigned to a specific pool can ONLY run on agents in that pool. The Default Pool is the fallback — any project not explicitly assigned to a pool can run on Default Pool agents. Use pools to enforce that sensitive deployment builds only run on hardened agents.
Agent requirements are constraints that a build configuration places on the agent that runs it. TeamCity only assigns a build to an agent that satisfies all its requirements.
Agents automatically report these properties:
| Property | Example value |
|---|---|
teamcity.agent.os.name | Linux |
teamcity.agent.os.version | 5.15.0-91-generic |
teamcity.agent.jvm.version | 1.8.0_352 |
teamcity.agent.work.dir | /opt/buildagent/work |
DotNetFramework4.6_x64 | exists (if .NET is installed) |
java.home | /usr/lib/jvm/java-11-openjdk |
maven.home | /usr/share/maven (if Maven found) |
docker.version | 24.0.6 (if Docker installed) |
In the build configuration: Agent Requirements → Add new requirement.
| Condition | Property | Value | Effect |
|---|---|---|---|
| exists | docker.version | — | Only run on agents with Docker installed |
| equals | teamcity.agent.os.name | Windows | Windows-only build |
| starts with | teamcity.agent.jvm.version | 11 | Requires Java 11 |
| more than | teamcity.agent.work.dir.freeSpaceMb | 10000 | At least 10 GB free |
# conf/buildAgent.properties — full annotated reference
# REQUIRED
serverUrl=http://192.168.1.100:8111 # TeamCity server URL
# IDENTITY
name=Agent-Linux-01 # Must be unique per server
authorizationToken= # Set by server after first auth
# DIRECTORIES (relative to agent root, or absolute)
workDir=../work # Source code checkout goes here
tempDir=../temp # Temp files during builds
systemDir=../system # Agent system data (caches, etc.)
# NETWORKING
ownPort=9090 # Agent listens on this port for server
# JAVA
# Uncomment to use specific JDK for the agent process itself
# JAVA_HOME=/usr/lib/jvm/java-11-openjdk
# CUSTOM PROPERTIES (reported to server, usable in agent requirements)
env.DOCKER_AVAILABLE=true
env.GRADLE_VERSION=7.6
system.maven.home=/usr/share/maven
When a build is triggered, it enters the build queue. TeamCity assigns it to the first available compatible agent. With N agents, N builds run concurrently.
Manually-triggered builds from a specific user can be given priority over VCS-triggered builds. Set this in Administration → Server Administration → Build Queue.
In the build configuration General Settings, set a priority (1 = lowest, 10 = highest) to ensure critical builds (e.g., main branch) get agents before lower-priority builds (e.g., feature branches).
A good rule of thumb: if builds are routinely waiting more than 2–3 minutes in the queue, add an agent. The TeamCity UI shows average queue wait times in Agents → Statistics. Each agent can run one build at a time — for concurrent builds, you need concurrent agents.
When you upgrade the TeamCity server, agents automatically receive the updated agent distribution the next time they connect. The process:
This happens automatically — no manual intervention needed. Agents do NOT need to be upgraded separately.
| Status | Cause | Fix |
|---|---|---|
| Unauthorized | New agent not yet approved | Go to Agents → Unauthorized → Authorize |
| Disconnected | Agent process stopped, network issue, server unreachable from agent | Check agent process; check network; check agent log |
| Idle but builds queue | Agent requirements mismatch; agent in wrong pool | Check Compatibility tab on the agent — shows which configs are incompatible and why |
| "Version mismatch" | Agent was not auto-upgraded (download failed) | Manually run agent.sh upgrade or re-download from server |
| Build fails immediately | Working directory permissions, missing tools | Check agent log; ensure build tools are in PATH for the agent user |
| Agent keeps restarting | Out of disk space, JVM crash, port conflict | Check logs/teamcity-agent.log; check disk; check port 9090 |
Go to Agents → All Agents → <Agent> → Compatible Configurations. This shows every build configuration and whether the agent is compatible. Red entries show the specific unsatisfied requirements — the fastest way to diagnose why a build isn't being assigned to an agent.