lunary API Reference

Classes

ClassDescription
EventQueueA class that represents a queue of events.
ConsumerA class that consumes events from the EventQueue.
UserContextManagerA context manager for setting and resetting user context.

Methods

MethodDescription
track_event(event_type: str, event_name: str, run_id: uuid, parent_run_id: uuid, name: str, input: Any, output: Any, error: Any, token_usage: Any, user_id: str, user_props: Any, tags: Any, extra: Any) -> NoneTracks an event with the given parameters.
handle_internal_error(e: Exception) -> NoneHandles internal errors.
wrap(fn: Callable, type: str, name: str, user_id: str, user_props: Any, tags: Any, input_parser: Callable, output_parser: Callable) -> CallableWraps a function with monitoring capabilities.
monitor(object: OpenAIUtils) -> NoneMonitors an instance of OpenAIUtils.
identify(user_id: str, user_props: Any) -> UserContextManagerIdentifies a user and sets the user context.

Decorators

DecoratorDescription
agent(name: str, user_id: str, user_props: Any, tags: Any) -> CallableA decorator for marking a function as an agent.
tool(name: str, user_id: str, user_props: Any, tags: Any) -> CallableA decorator for marking a function as a tool.

Context Variables

VariableDescription
user_ctxA context variable for storing the user ID.
user_props_ctxA context variable for storing user properties.

Questions? We're here to help.