LettaAPI.Api.Runs (letta_api v1.0.0)

API calls for all endpoints tagged Runs.

Summary

Functions

Delete Run Delete a run by its run_id.

List Active Runs List all active runs.

List Run Messages Get messages associated with a run with filtering options. Args: run_id: ID of the run before: A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. after: A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. limit: Maximum number of messages to return order: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. role: Filter by role (user/assistant/system/tool) return_message_object: Whether to return Message objects or LettaMessage objects user_id: ID of the user making the request Returns: A list of messages associated with the run. Default is List[LettaMessage].

List Run Steps Get messages associated with a run with filtering options. Args: run_id: ID of the run before: A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. after: A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. limit: Maximum number of steps to return order: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Returns: A list of steps associated with the run.

List Runs List all runs.

Retrieve Run Get the status of a run.

Retrieve Run Usage Get usage statistics for a run.

Functions

delete_run(connection, run_id, opts \\ [])

@spec delete_run(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, LettaAPI.Model.Run.t()}
  | {:ok, LettaAPI.Model.HttpValidationError.t()}
  | {:error, Tesla.Env.t()}

Delete Run Delete a run by its run_id.

Parameters

  • connection (LettaAPI.Connection): Connection to server
  • run_id (String.t):
  • opts (keyword): Optional parameters
    • :user_id (String.t):

Returns

  • {:ok, LettaAPI.Model.Run.t} on success
  • {:error, Tesla.Env.t} on failure

list_active_runs(connection, opts \\ [])

@spec list_active_runs(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, [LettaAPI.Model.Run.t()]}
  | {:ok, LettaAPI.Model.HttpValidationError.t()}
  | {:error, Tesla.Env.t()}

List Active Runs List all active runs.

Parameters

  • connection (LettaAPI.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :agent_ids ([String.t]): The unique identifier of the agent associated with the run.
    • :user_id (String.t):

Returns

  • {:ok, [%Run{}, ...]} on success
  • {:error, Tesla.Env.t} on failure

list_run_messages(connection, run_id, opts \\ [])

@spec list_run_messages(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, LettaAPI.Model.HttpValidationError.t()}
  | {:ok, [LettaAPI.Model.LettaMessageUnion.t()]}
  | {:error, Tesla.Env.t()}

List Run Messages Get messages associated with a run with filtering options. Args: run_id: ID of the run before: A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. after: A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. limit: Maximum number of messages to return order: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. role: Filter by role (user/assistant/system/tool) return_message_object: Whether to return Message objects or LettaMessage objects user_id: ID of the user making the request Returns: A list of messages associated with the run. Default is List[LettaMessage].

Parameters

  • connection (LettaAPI.Connection): Connection to server
  • run_id (String.t):
  • opts (keyword): Optional parameters
    • :before (String.t): Cursor for pagination
    • :after (String.t): Cursor for pagination
    • :limit (integer()): Maximum number of messages to return
    • :order (String.t): Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
    • :role (MessageRole): Filter by role
    • :user_id (String.t):

Returns

  • {:ok, [%LettaMessageUnion{}, ...]} on success
  • {:error, Tesla.Env.t} on failure

list_run_steps(connection, run_id, opts \\ [])

@spec list_run_steps(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, [LettaAPI.Model.Step.t()]}
  | {:ok, LettaAPI.Model.HttpValidationError.t()}
  | {:error, Tesla.Env.t()}

List Run Steps Get messages associated with a run with filtering options. Args: run_id: ID of the run before: A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. after: A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. limit: Maximum number of steps to return order: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. Returns: A list of steps associated with the run.

Parameters

  • connection (LettaAPI.Connection): Connection to server
  • run_id (String.t):
  • opts (keyword): Optional parameters
    • :before (String.t): Cursor for pagination
    • :after (String.t): Cursor for pagination
    • :limit (integer()): Maximum number of messages to return
    • :order (String.t): Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
    • :user_id (String.t):

Returns

  • {:ok, [%Step{}, ...]} on success
  • {:error, Tesla.Env.t} on failure

list_runs(connection, opts \\ [])

@spec list_runs(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, [LettaAPI.Model.Run.t()]}
  | {:ok, LettaAPI.Model.HttpValidationError.t()}
  | {:error, Tesla.Env.t()}

List Runs List all runs.

Parameters

  • connection (LettaAPI.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :agent_ids ([String.t]): The unique identifier of the agent associated with the run.
    • :user_id (String.t):

Returns

  • {:ok, [%Run{}, ...]} on success
  • {:error, Tesla.Env.t} on failure

retrieve_run(connection, run_id, opts \\ [])

@spec retrieve_run(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, LettaAPI.Model.Run.t()}
  | {:ok, LettaAPI.Model.HttpValidationError.t()}
  | {:error, Tesla.Env.t()}

Retrieve Run Get the status of a run.

Parameters

  • connection (LettaAPI.Connection): Connection to server
  • run_id (String.t):
  • opts (keyword): Optional parameters
    • :user_id (String.t):

Returns

  • {:ok, LettaAPI.Model.Run.t} on success
  • {:error, Tesla.Env.t} on failure

retrieve_run_usage(connection, run_id, opts \\ [])

@spec retrieve_run_usage(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, LettaAPI.Model.UsageStatistics.t()}
  | {:ok, LettaAPI.Model.HttpValidationError.t()}
  | {:error, Tesla.Env.t()}

Retrieve Run Usage Get usage statistics for a run.

Parameters

  • connection (LettaAPI.Connection): Connection to server
  • run_id (String.t):
  • opts (keyword): Optional parameters
    • :user_id (String.t):

Returns

  • {:ok, LettaAPI.Model.UsageStatistics.t} on success
  • {:error, Tesla.Env.t} on failure