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

Function run

methods/letta/cli/cli.py:75–329  ·  view source on GitHub ↗

Start chatting with an Letta agent Example usage: `letta run --agent myagent --data-source mydata --persona mypersona --human myhuman --model gpt-3.5-turbo` :param persona: Specify persona :param agent: Specify agent name (will load existing state if the agent exists, or create a new o

(
    persona: Annotated[Optional[str], typer.Option(help="Specify persona")] = None,
    agent: Annotated[Optional[str], typer.Option(help="Specify agent name")] = None,
    human: Annotated[Optional[str], typer.Option(help="Specify human")] = None,
    system: Annotated[Optional[str], typer.Option(help="Specify system prompt (raw text)")] = None,
    system_file: Annotated[Optional[str], typer.Option(help="Specify raw text file containing system prompt")] = None,
    # model flags
    model: Annotated[Optional[str], typer.Option(help="Specify the LLM model")] = None,
    model_wrapper: Annotated[Optional[str], typer.Option(help="Specify the LLM model wrapper")] = None,
    model_endpoint: Annotated[Optional[str], typer.Option(help="Specify the LLM model endpoint")] = None,
    model_endpoint_type: Annotated[Optional[str], typer.Option(help="Specify the LLM model endpoint type")] = None,
    context_window: Annotated[
        Optional[int], typer.Option(help="The context window of the LLM you are using (e.g. 8k for most Mistral 7B variants)")
    ] = None,
    core_memory_limit: Annotated[
        Optional[int], typer.Option(help="The character limit to each core-memory section (human/persona).")
    ] = CORE_MEMORY_BLOCK_CHAR_LIMIT,
    # other
    first: Annotated[bool, typer.Option(help="Use --first to send the first message in the sequence")] = False,
    strip_ui: Annotated[bool, typer.Option(help="Remove all the bells and whistles in CLI output (helpful for testing)")] = False,
    debug: Annotated[bool, typer.Option(help="Use --debug to enable debugging output")] = False,
    no_verify: Annotated[bool, typer.Option(help="Bypass message verification")] = False,
    yes: Annotated[bool, typer.Option("-y", help="Skip confirmation prompt and use defaults")] = False,
    # streaming
    stream: Annotated[bool, typer.Option(help="Enables message streaming in the CLI (if the backend supports it)")] = False,
    # whether or not to put the inner thoughts inside the function args
    no_content: Annotated[
        OptionState, typer.Option(help="Set to 'yes' for LLM APIs that omit the `content` field during tool calling")
    ] = OptionState.DEFAULT,
)

Source from the content-addressed store, hash-verified

73
74
75def run(
76 persona: Annotated[Optional[str], typer.Option(help="Specify persona")] = None,
77 agent: Annotated[Optional[str], typer.Option(help="Specify agent name")] = None,
78 human: Annotated[Optional[str], typer.Option(help="Specify human")] = None,
79 system: Annotated[Optional[str], typer.Option(help="Specify system prompt (raw text)")] = None,
80 system_file: Annotated[Optional[str], typer.Option(help="Specify raw text file containing system prompt")] = None,
81 # model flags
82 model: Annotated[Optional[str], typer.Option(help="Specify the LLM model")] = None,
83 model_wrapper: Annotated[Optional[str], typer.Option(help="Specify the LLM model wrapper")] = None,
84 model_endpoint: Annotated[Optional[str], typer.Option(help="Specify the LLM model endpoint")] = None,
85 model_endpoint_type: Annotated[Optional[str], typer.Option(help="Specify the LLM model endpoint type")] = None,
86 context_window: Annotated[
87 Optional[int], typer.Option(help="The context window of the LLM you are using (e.g. 8k for most Mistral 7B variants)")
88 ] = None,
89 core_memory_limit: Annotated[
90 Optional[int], typer.Option(help="The character limit to each core-memory section (human/persona).")
91 ] = CORE_MEMORY_BLOCK_CHAR_LIMIT,
92 # other
93 first: Annotated[bool, typer.Option(help="Use --first to send the first message in the sequence")] = False,
94 strip_ui: Annotated[bool, typer.Option(help="Remove all the bells and whistles in CLI output (helpful for testing)")] = False,
95 debug: Annotated[bool, typer.Option(help="Use --debug to enable debugging output")] = False,
96 no_verify: Annotated[bool, typer.Option(help="Bypass message verification")] = False,
97 yes: Annotated[bool, typer.Option("-y", help="Skip confirmation prompt and use defaults")] = False,
98 # streaming
99 stream: Annotated[bool, typer.Option(help="Enables message streaming in the CLI (if the backend supports it)")] = False,
100 # whether or not to put the inner thoughts inside the function args
101 no_content: Annotated[
102 OptionState, typer.Option(help="Set to 'yes' for LLM APIs that omit the `content` field during tool calling")
103 ] = OptionState.DEFAULT,
104):
105 """Start chatting with an Letta agent
106
107 Example usage: `letta run --agent myagent --data-source mydata --persona mypersona --human myhuman --model gpt-3.5-turbo`
108
109 :param persona: Specify persona
110 :param agent: Specify agent name (will load existing state if the agent exists, or create a new one with that name)
111 :param human: Specify human
112 :param model: Specify the LLM model
113
114 """
115
116 # setup logger
117 # TODO: remove Utils Debug after global logging is complete.
118 utils.DEBUG = debug
119 # TODO: add logging command line options for runtime log level
120
121 from letta.server.server import logger as server_logger
122
123 if debug:
124 logger.setLevel(logging.DEBUG)
125 server_logger.setLevel(logging.DEBUG)
126 else:
127 logger.setLevel(logging.CRITICAL)
128 server_logger.setLevel(logging.CRITICAL)
129
130 # load config file
131 config = LettaConfig.load()
132

Calls 15

create_clientFunction · 0.90
printdFunction · 0.90
AgentClass · 0.90
ChatMemoryClass · 0.90
save_agentFunction · 0.90
run_agent_loopFunction · 0.90
selectMethod · 0.80
loadMethod · 0.45
list_agentsMethod · 0.45
get_agent_idMethod · 0.45
get_agentMethod · 0.45
update_agentMethod · 0.45

Tested by

no test coverage detected