If the agent is created by "System", it is accessible to all users.
If the agent is public and the user belongs to the same organization, it is accessible.
If the user is a member of the agent's project or is a superuser, access is granted.
Otherwise, a 403 Forbidden response is returned.
A JSON response with the serialized agent data if the agent is found and access is authorized.
A 403 error if the user does not have the required permissions.
A 404 error if the agent is not found.
A 500 error for unexpected server issues.