class_docstr: Handles CRUD operations at the database level for Agents
class_docstr_tok: ["Handles","CRUD","operations","at","the","database","level","for","Agents"]
docstr: Gets an agent by id.
  
  Parameters:
      id (int): The id of the agent
      project_name (str): The name of the containing project - must exist
  
  Returns:
      agent (db.Agents): The database agent object
docstr_tok: ["Gets","an","agent","by","id",".","Parameters",":","id","(","int",")",":","The","id","of","the","agent","project_name","(","str",")",":","The","name","of","the","containing","project","-","must","exist","Returns",":","agent","(","db.Agents",")",":","The","database","agent","object"]
code: def get_agent_by_id(
      self, id: int, project_name: str = "mindsdb"
  ) -> db.Agents:
      """
      Gets an agent by id.
  
      Parameters:
          id (int): The id of the agent
          project_name (str): The name of the containing project - must exist
  
      Returns:
          agent (db.Agents): The database agent object
      """
  
      project = self.project_controller.get(name=project_name)
      agent = db.Agents.query.filter(
          db.Agents.id == id,
          db.Agents.project_id == project.id,
          db.Agents.company_id == ctx.company_id,
      ).first()
      return agent
  
file_path: mindsdb/mindsdb/interfaces/agents/agents_controller.py
imports: from typing import Dict, List
  from mindsdb.interfaces.model.functions import PredictorRecordNotFound
  from mindsdb.interfaces.storage.db import Predictor
  from mindsdb.interfaces.model.model_controller import ModelController
  from mindsdb.interfaces.skills.skills_controller import SkillsController
  from mindsdb.interfaces.storage import db
  from mindsdb.interfaces.database.projects import ProjectController
  from mindsdb.utilities.context import context
  from mindsdb.utilities.config import Config
  from sqlalchemy.orm.attributes import flag_modified
label_desc: Use image node_id 3 for calling the AgentsController obj's underlying member method code with example usage: obj.get_agent_by_id(id, project_name) and returns: agent