MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / create_agent

Method create_agent

methods/letta/server/server.py:695–737  ·  view source on GitHub ↗
(
        self,
        request: CreateAgent,
        actor: User,
        # interface
        interface: Union[AgentInterface, None] = None,
    )

Source from the content-addressed store, hash-verified

693
694 @trace_method
695 def create_agent(
696 self,
697 request: CreateAgent,
698 actor: User,
699 # interface
700 interface: Union[AgentInterface, None] = None,
701 ) -> AgentState:
702 if request.llm_config is None:
703 if request.model is None:
704 raise ValueError("Must specify either model or llm_config in request")
705 config_params = {
706 "handle": request.model,
707 "context_window_limit": request.context_window_limit,
708 "max_tokens": request.max_tokens,
709 "max_reasoning_tokens": request.max_reasoning_tokens,
710 "enable_reasoner": request.enable_reasoner,
711 }
712 log_event(name="start get_cached_llm_config", attributes=config_params)
713 request.llm_config = self.get_cached_llm_config(**config_params)
714 log_event(name="end get_cached_llm_config", attributes=config_params)
715
716 if request.embedding_config is None:
717 if request.embedding is None:
718 raise ValueError("Must specify either embedding or embedding_config in request")
719 embedding_config_params = {
720 "handle": request.embedding,
721 "embedding_chunk_size": request.embedding_chunk_size or constants.DEFAULT_EMBEDDING_CHUNK_SIZE,
722 }
723 log_event(name="start get_cached_embedding_config", attributes=embedding_config_params)
724 request.embedding_config = self.get_cached_embedding_config(**embedding_config_params)
725 log_event(name="end get_cached_embedding_config", attributes=embedding_config_params)
726
727 log_event(name="start create_agent db")
728 main_agent = self.agent_manager.create_agent(
729 agent_create=request,
730 actor=actor,
731 )
732 log_event(name="end create_agent db")
733
734 if request.enable_sleeptime:
735 main_agent = self.create_sleeptime_agent(main_agent=main_agent, actor=actor)
736
737 return main_agent
738
739 def update_agent(
740 self,

Callers

nothing calls this directly

Calls 5

get_cached_llm_configMethod · 0.95
log_eventFunction · 0.90
create_agentMethod · 0.45

Tested by

no test coverage detected