Launch a Letta server process
(
type: Annotated[ServerChoice, typer.Option(help="Server to run")] = "rest",
port: Annotated[Optional[int], typer.Option(help="Port to run the server on")] = None,
host: Annotated[Optional[str], typer.Option(help="Host to run the server on (default to localhost)")] = None,
debug: Annotated[bool, typer.Option(help="Turn debugging output on")] = False,
ade: Annotated[bool, typer.Option(help="Allows remote access")] = False, # NOTE: deprecated
secure: Annotated[bool, typer.Option(help="Adds simple security access")] = False,
localhttps: Annotated[bool, typer.Option(help="Setup local https")] = False,
)
| 38 | |
| 39 | |
| 40 | def server( |
| 41 | type: Annotated[ServerChoice, typer.Option(help="Server to run")] = "rest", |
| 42 | port: Annotated[Optional[int], typer.Option(help="Port to run the server on")] = None, |
| 43 | host: Annotated[Optional[str], typer.Option(help="Host to run the server on (default to localhost)")] = None, |
| 44 | debug: Annotated[bool, typer.Option(help="Turn debugging output on")] = False, |
| 45 | ade: Annotated[bool, typer.Option(help="Allows remote access")] = False, # NOTE: deprecated |
| 46 | secure: Annotated[bool, typer.Option(help="Adds simple security access")] = False, |
| 47 | localhttps: Annotated[bool, typer.Option(help="Setup local https")] = False, |
| 48 | ): |
| 49 | """Launch a Letta server process""" |
| 50 | if type == ServerChoice.rest_api: |
| 51 | pass |
| 52 | |
| 53 | # if LettaConfig.exists(): |
| 54 | # config = LettaConfig.load() |
| 55 | # MetadataStore(config) |
| 56 | # _ = create_client() # triggers user creation |
| 57 | # else: |
| 58 | # typer.secho(f"No configuration exists. Run letta configure before starting the server.", fg=typer.colors.RED) |
| 59 | # sys.exit(1) |
| 60 | |
| 61 | try: |
| 62 | from letta.server.rest_api.app import start_server |
| 63 | |
| 64 | start_server(port=port, host=host, debug=debug) |
| 65 | |
| 66 | except KeyboardInterrupt: |
| 67 | # Handle CTRL-C |
| 68 | typer.secho("Terminating the server...") |
| 69 | sys.exit(0) |
| 70 | |
| 71 | elif type == ServerChoice.ws_api: |
| 72 | raise NotImplementedError("WS suppport deprecated") |
| 73 | |
| 74 | |
| 75 | def run( |
nothing calls this directly
no test coverage detected