You are viewing the documentation of TeamCity 10.x and 2017.x, which is not the most recently released version of TeamCity.
View this page in TeamCity 2018.1 documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

Skip to end of metadata
Go to start of metadata


TeamCity is hiring! Learn about the available vacancies on the JetBrains site. Read about working in the TeamCity team.

On the agent side agent is represented by jetbrains.buildServer.agent.BuildAgent interface. BuildAgent is available as a Spring bean and can be obtained by autowiring.

Build agent configuration can be read from the jetbrains.buildServer.agent.BuildAgentConfiguration, it can be obtained from the BuildAgent#getConfiguration() method.

Agent side events

There is jetbrains.buildServer.agent.AgentLifeCycleListener interface and corresponding adapter class jetbrains.buildServer.agent.AgentLifeCycleAdapter which can be used to receive notifications about agent side events, like starting of the build, build finishing and so on. Your listener must be registered in the jetbrains.buildServer.util.EventDispatcher. This service is also defined in the Spring context.


Each build on the agent is represented by jetbrains.buildServer.agent.AgentRunningBuild interface. You can obtain instance of AgentRunningBuild by listening for buildStarted(AgentRunningBuild) event in AgentLifeCycleListener.

Logging to build log

Messages to build log can be sent only when a build is running. Internally agent sends messages to server by packing them into the jetbrains.buildServer.messages.BuildMessage1 structures. However instead of creating BuildMessage1 structures it is better and easier to use corresponding methods in jetbrains.buildServer.agent.BuildProgressLogger which can be obtained from the AgentRunningBuild.

If you want to construct your own messages you can use static methods of jetbrains.buildServer.messages.DefaultMessagesInfo class for that.

  • No labels