Skip to main content

Module api

Module api 

Source
Expand description

Top-level FFI API functions exported as extern "C".

Each function clears the thread-local error before executing and returns an NemoFlowStatus. On failure, call [nemo_flow_last_error] to retrieve the error message.

Re-exports§

pub use crate::types::nemo_flow_openinference_subscriber_free;
pub use crate::types::nemo_flow_otel_subscriber_free;

Structs§

FfiStream
Opaque stream handle for consuming LLM streaming responses chunk by chunk. Use nemo_flow_stream_next to poll and nemo_flow_stream_free to release.

Functions§

nemo_flow_active_plugin_report_json
Return the last successfully configured plugin report as JSON.
nemo_flow_anthropic_messages_codec_new
Create a new Anthropic Messages API codec handle.
nemo_flow_atif_exporter_clear
Clears all collected events from the exporter.
nemo_flow_atif_exporter_create
Creates a new ATIF exporter.
nemo_flow_atif_exporter_deregister
Deregisters the exporter subscriber.
nemo_flow_atif_exporter_export
Exports collected events as an ATIF trajectory JSON string.
nemo_flow_atif_exporter_register
Registers the exporter as an event subscriber.
nemo_flow_atof_exporter_create
Creates a new filesystem-backed ATOF JSONL exporter.
nemo_flow_atof_exporter_deregister
Deregisters the ATOF exporter subscriber.
nemo_flow_atof_exporter_force_flush
Flushes the ATOF exporter output file.
nemo_flow_atof_exporter_path
Returns the ATOF exporter output path as a string.
nemo_flow_atof_exporter_register
Registers the ATOF exporter as an event subscriber.
nemo_flow_atof_exporter_shutdown
Shuts down the ATOF exporter by flushing output.
nemo_flow_clear_plugin_configuration
Clear the active global plugin configuration.
nemo_flow_deregister_llm_conditional_execution_guardrail
Deregister an LLM conditional execution guardrail by name.
nemo_flow_deregister_llm_execution_intercept
Deregister an LLM execution intercept by name.
nemo_flow_deregister_llm_request_intercept
Deregister an LLM request intercept by name.
nemo_flow_deregister_llm_sanitize_request_guardrail
Deregister an LLM request sanitization guardrail by name.
nemo_flow_deregister_llm_sanitize_response_guardrail
Deregister an LLM response sanitization guardrail by name.
nemo_flow_deregister_llm_stream_execution_intercept
Deregister an LLM streaming execution intercept by name.
nemo_flow_deregister_plugin
Deregister a plugin by kind.
nemo_flow_deregister_subscriber
Deregister an event subscriber by name.
nemo_flow_deregister_tool_conditional_execution_guardrail
Deregister a tool conditional execution guardrail by name.
nemo_flow_deregister_tool_execution_intercept
Deregister a tool execution intercept by name.
nemo_flow_deregister_tool_request_intercept
Deregister a tool request intercept by name.
nemo_flow_deregister_tool_sanitize_request_guardrail
Deregister a tool request sanitization guardrail by name.
nemo_flow_deregister_tool_sanitize_response_guardrail
Deregister a tool response sanitization guardrail by name.
nemo_flow_event
Emit a named lifecycle event.
nemo_flow_get_handle
Retrieve the current scope handle from the thread-local scope stack.
nemo_flow_initialize_plugins
Initialize the active global plugin components and return the resulting diagnostics report.
nemo_flow_list_plugin_kinds_json
Return the registered plugin kinds as JSON.
nemo_flow_llm_call
Begin a manual LLM call lifecycle span.
nemo_flow_llm_call_end
End a manual LLM call lifecycle span.
nemo_flow_llm_call_execute
Execute an LLM call end-to-end: run conditional-execution guardrails (on raw request), then request intercepts, sanitize-request guardrails, execution intercepts, the callback, and sanitize-response guardrails. On rejection, only a standalone Mark event is emitted (no Start/End pair) and GuardrailRejected is returned. Blocks the calling thread until completion.
nemo_flow_llm_conditional_execution
Run the registered LLM conditional execution guardrail chain.
nemo_flow_llm_request_intercepts
Run the registered LLM request intercept chain on the given request.
nemo_flow_llm_stream_call_execute
Execute a streaming LLM call end-to-end. Conditional-execution guardrails run first on the raw request. Returns a stream handle that can be polled with nemo_flow_stream_next. Blocks until the stream is set up.
nemo_flow_observability_component_spec_json
Wrap an observability config JSON object as a top-level plugin component.
nemo_flow_observability_default_config_json
Return the default observability plugin config as JSON.
nemo_flow_observability_plugin_kind
Return the built-in observability plugin kind.
nemo_flow_openai_chat_codec_new
Create a new OpenAI Chat Completions codec handle.
nemo_flow_openai_responses_codec_new
Create a new OpenAI Responses API codec handle.
nemo_flow_openinference_subscriber_create
Creates a new OpenInference subscriber.
nemo_flow_openinference_subscriber_deregister
Deregisters the OpenInference subscriber by name.
nemo_flow_openinference_subscriber_force_flush
Forces a flush of finished spans through the exporter.
nemo_flow_openinference_subscriber_register
Registers the OpenInference subscriber as an event subscriber.
nemo_flow_openinference_subscriber_shutdown
Shuts down the underlying tracer provider.
nemo_flow_otel_subscriber_create
Creates a new OpenTelemetry subscriber.
nemo_flow_otel_subscriber_deregister
Deregisters the OpenTelemetry subscriber by name.
nemo_flow_otel_subscriber_force_flush
Forces a flush of finished spans through the exporter.
nemo_flow_otel_subscriber_register
Registers the OpenTelemetry subscriber as an event subscriber.
nemo_flow_otel_subscriber_shutdown
Shuts down the underlying tracer provider.
nemo_flow_plugin_context_register_llm_conditional_execution_guardrail
Register an LLM conditional-execution guardrail into the plugin registration context.
nemo_flow_plugin_context_register_llm_execution_intercept
Register an LLM execution intercept into the plugin registration context.
nemo_flow_plugin_context_register_llm_request_intercept
Register an LLM request intercept into the plugin registration context.
nemo_flow_plugin_context_register_llm_sanitize_request_guardrail
Register an LLM sanitize-request guardrail into the plugin registration context.
nemo_flow_plugin_context_register_llm_sanitize_response_guardrail
Register an LLM sanitize-response guardrail into the plugin registration context.
nemo_flow_plugin_context_register_llm_stream_execution_intercept
Register an LLM stream execution intercept into the plugin registration context.
nemo_flow_plugin_context_register_subscriber
Register an event subscriber into the plugin registration context.
nemo_flow_plugin_context_register_tool_conditional_execution_guardrail
Register a tool conditional-execution guardrail into the plugin registration context.
nemo_flow_plugin_context_register_tool_execution_intercept
Register a tool execution intercept into the plugin registration context.
nemo_flow_plugin_context_register_tool_request_intercept
Register a tool request intercept into the plugin registration context.
nemo_flow_plugin_context_register_tool_sanitize_request_guardrail
Register a tool sanitize-request guardrail into the plugin registration context.
nemo_flow_plugin_context_register_tool_sanitize_response_guardrail
Register a tool sanitize-response guardrail into the plugin registration context.
nemo_flow_pop_scope
Pop a scope from the scope stack by its handle.
nemo_flow_push_scope
Push a new scope onto the scope stack.
nemo_flow_register_llm_conditional_execution_guardrail
Register an LLM conditional execution guardrail. The callback decides whether an LLM call should proceed.
nemo_flow_register_llm_execution_intercept
Register an LLM execution intercept following the middleware chain pattern. The callback receives (request, next_fn, next_ctx) — call next_fn(request, next_ctx) to invoke the next intercept or the original LLM call, or skip calling it to short-circuit.
nemo_flow_register_llm_request_intercept
Register an LLM request intercept. The callback can transform the LlmRequest before it reaches the LLM provider.
nemo_flow_register_llm_sanitize_request_guardrail
Register an LLM request sanitization guardrail. The callback can modify or replace the LLM request before it is sent.
nemo_flow_register_llm_sanitize_response_guardrail
Register an LLM response sanitization guardrail. The callback can inspect and modify the LLM response after it is received.
nemo_flow_register_llm_stream_execution_intercept
Register an LLM streaming execution intercept following the middleware chain pattern. The callback receives (request, next_fn, next_ctx) — call next_fn(request, next_ctx) to invoke the next intercept or the original streaming LLM call, or skip calling it to short-circuit.
nemo_flow_register_plugin
Register a plugin backed by foreign callbacks.
nemo_flow_register_subscriber
Register an event subscriber. The callback is invoked for every lifecycle event emitted by the runtime.
nemo_flow_register_tool_conditional_execution_guardrail
Register a tool conditional execution guardrail. The callback decides whether a tool call should proceed. Returns an error message to reject, or null to allow.
nemo_flow_register_tool_execution_intercept
Register a tool execution intercept following the middleware chain pattern. The callback receives (args, next_fn, next_ctx) — call next_fn(args, next_ctx) to invoke the next intercept or the original tool function, or skip calling it to short-circuit.
nemo_flow_register_tool_request_intercept
Register a tool request intercept. The callback can transform tool arguments before execution. Runs after request guardrails in the middleware pipeline.
nemo_flow_register_tool_sanitize_request_guardrail
Register a tool request sanitization guardrail. The callback can inspect and modify tool arguments before the tool executes.
nemo_flow_register_tool_sanitize_response_guardrail
Register a tool response sanitization guardrail. The callback can inspect and modify tool results after the tool executes.
nemo_flow_scope_deregister_llm_conditional_execution_guardrail
Deregister a scope-local LLM conditional execution guardrail by name.
nemo_flow_scope_deregister_llm_execution_intercept
Deregister a scope-local LLM execution intercept by name.
nemo_flow_scope_deregister_llm_request_intercept
Deregister a scope-local LLM request intercept by name.
nemo_flow_scope_deregister_llm_sanitize_request_guardrail
Deregister a scope-local LLM request sanitization guardrail by name.
nemo_flow_scope_deregister_llm_sanitize_response_guardrail
Deregister a scope-local LLM response sanitization guardrail by name.
nemo_flow_scope_deregister_llm_stream_execution_intercept
Deregister a scope-local LLM streaming execution intercept by name.
nemo_flow_scope_deregister_subscriber
Deregister a scope-local event subscriber by name.
nemo_flow_scope_deregister_tool_conditional_execution_guardrail
Deregister a scope-local tool conditional execution guardrail by name.
nemo_flow_scope_deregister_tool_execution_intercept
Deregister a scope-local tool execution intercept by name.
nemo_flow_scope_deregister_tool_request_intercept
Deregister a scope-local tool request intercept by name.
nemo_flow_scope_deregister_tool_sanitize_request_guardrail
Deregister a scope-local tool request sanitization guardrail by name.
nemo_flow_scope_deregister_tool_sanitize_response_guardrail
Deregister a scope-local tool response sanitization guardrail by name.
nemo_flow_scope_register_llm_conditional_execution_guardrail
Register a scope-local LLM conditional execution guardrail.
nemo_flow_scope_register_llm_execution_intercept
Register a scope-local LLM execution intercept following the middleware chain pattern.
nemo_flow_scope_register_llm_request_intercept
Register a scope-local LLM request intercept.
nemo_flow_scope_register_llm_sanitize_request_guardrail
Register a scope-local LLM request sanitization guardrail.
nemo_flow_scope_register_llm_sanitize_response_guardrail
Register a scope-local LLM response sanitization guardrail.
nemo_flow_scope_register_llm_stream_execution_intercept
Register a scope-local LLM streaming execution intercept following the middleware chain pattern.
nemo_flow_scope_register_subscriber
Register a scope-local event subscriber.
nemo_flow_scope_register_tool_conditional_execution_guardrail
Register a scope-local tool conditional execution guardrail.
nemo_flow_scope_register_tool_execution_intercept
Register a scope-local tool execution intercept following the middleware chain pattern.
nemo_flow_scope_register_tool_request_intercept
Register a scope-local tool request intercept.
nemo_flow_scope_register_tool_sanitize_request_guardrail
Register a scope-local tool request sanitization guardrail.
nemo_flow_scope_register_tool_sanitize_response_guardrail
Register a scope-local tool response sanitization guardrail.
nemo_flow_scope_stack_active
Returns whether the current execution context has an explicitly-initialized scope stack.
nemo_flow_scope_stack_capture_thread
Capture the current thread-local scope stack binding.
nemo_flow_scope_stack_create
Create a new isolated scope stack with its own root scope.
nemo_flow_scope_stack_restore_thread
Restore and free a captured thread-local scope stack binding.
nemo_flow_scope_stack_set_thread
Bind an isolated scope stack to the current OS thread.
nemo_flow_stream_free
Free a stream handle and release its resources.
nemo_flow_stream_next
Poll the next chunk from a streaming LLM response. Blocks until a chunk is available.
nemo_flow_tool_call
Begin a manual tool call lifecycle span.
nemo_flow_tool_call_end
End a manual tool call lifecycle span.
nemo_flow_tool_call_execute
Execute a tool call end-to-end: run conditional-execution guardrails (on raw args), then request intercepts, sanitize-request guardrails, execution intercepts, the callback, and sanitize-response guardrails. On rejection, only a standalone Mark event is emitted (no Start/End pair) and GuardrailRejected is returned. Blocks the calling thread until completion.
nemo_flow_tool_conditional_execution
Run the registered tool conditional execution guardrail chain.
nemo_flow_tool_request_intercepts
Run the registered tool request intercept chain on the given arguments.
nemo_flow_validate_plugin_config
Validate a generic plugin config document and return the diagnostics report as JSON.