Update agent.cpp