Entropic 2.9.4
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
42#pragma once
43
44#include <stdbool.h>
45#include <stddef.h>
46#include <stdint.h>
47
48#include <entropic/entropic_config.h>
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57/* ── Lifecycle ────────────────────────────────────────── */
58
74
98 entropic_handle_t handle,
99 const char* config_json);
100
119 entropic_handle_t handle,
120 const char* config_path);
121
148 entropic_handle_t handle,
149 const char* project_dir);
150
163ENTROPIC_EXPORT void entropic_destroy(entropic_handle_t handle);
164
165/* ── Version ──────────────────────────────────────────── */
166
178ENTROPIC_EXPORT const char* entropic_version(void);
179
196ENTROPIC_EXPORT int entropic_api_version(void);
197
218ENTROPIC_EXPORT int64_t entropic_seconds_since_last_activity(
219 entropic_handle_t handle);
220
221/* ── Memory ───────────────────────────────────────────── */
222
236ENTROPIC_EXPORT void* entropic_alloc(size_t size);
237
249ENTROPIC_EXPORT void entropic_free(void* ptr);
250
251/* ── Execution ────────────────────────────────────────── */
252
276ENTROPIC_EXPORT entropic_error_t entropic_run(
277 entropic_handle_t handle,
278 const char* input,
279 char** result_json);
280
308ENTROPIC_EXPORT entropic_error_t entropic_run_as(
309 entropic_handle_t handle,
310 const char* tier_or_identity,
311 const char* input,
312 char** result_json);
313
345 entropic_handle_t handle,
346 const char** tiers,
347 const char** prompts,
348 size_t n,
349 char** result_json);
350
376 entropic_handle_t handle,
377 const char* input,
378 void (*on_token)(const char* token, size_t len, void* user_data),
379 void* user_data,
380 int* cancel_flag);
381
419 entropic_handle_t handle,
420 const char* messages_json,
421 char** result_json);
422
442 entropic_handle_t handle,
443 const char* messages_json,
444 void (*on_token)(const char* token, size_t len, void* user_data),
445 void* user_data,
446 int* cancel_flag);
447
478 entropic_handle_t handle,
479 void (*observer)(const char* token, size_t len, void* user_data),
480 void* user_data);
481
503 entropic_handle_t handle,
504 void (*observer)(int state, void* user_data),
505 void* user_data);
506
544 entropic_handle_t handle,
545 void (*start_cb)(void* user_data),
546 void (*end_cb)(void* user_data),
547 void* user_data);
548
566
567/* ── Mid-generation message queue (v2.1.10, gh#40) ────── */
568
608 entropic_handle_t handle,
609 const char* message);
610
628 entropic_handle_t handle,
629 size_t* count);
630
645 entropic_handle_t handle);
646
671 entropic_handle_t handle,
672 void (*observer)(const char* consumed,
673 size_t remaining,
674 void* user_data),
675 void* user_data);
676
677/* ── Speculative decoding (v2.1.11, gh#36) ─────────────── */
678
709 entropic_handle_t handle,
710 int* compatible,
711 char** diagnostic);
712
713/* ── VRAM-aware tier residency (v2.2.4, gh#57) ────────── */
714
728
750 const char* tier_name,
751 const char* model_path,
752 size_t footprint_bytes,
753 void* user_data);
754
771 entropic_handle_t handle,
773 void* user_data);
774
820 entropic_handle_t handle,
821 char** out_json);
822
823/* ── Conversation Context (v2.0.1) ───────────────────── */
824
840 entropic_handle_t handle);
841
863 entropic_handle_t handle,
864 char** messages_json);
865
879 entropic_handle_t handle,
880 size_t* count);
881
905 entropic_handle_t handle,
906 size_t* tokens_used,
907 size_t* capacity);
908
937 entropic_handle_t handle,
938 const char* tier_name,
939 const char* path);
940
962 entropic_handle_t handle,
963 const char* tier_name,
964 const char* path);
965
983 entropic_handle_t handle,
984 char** out);
985
986/* ── Delegation Callbacks (v2.1.5, gh#29) ──────────────── */
987
997typedef enum {
998 ENT_DECISION_ACCEPT = 0,
999 ENT_DECISION_REJECT = 1
1001
1011typedef struct {
1012 const char* delegation_id;
1013 const char* target_tier;
1014 const char* task;
1015 int depth;
1018
1034typedef struct {
1035 const char* delegation_id;
1036 const char* target_tier;
1038 const char* summary;
1039 const char* patch;
1040 size_t patch_len;
1041 const char* const* files_touched;
1044
1059 const ent_delegation_request_t* req, void* user_data);
1060
1084 const ent_delegation_result_t* res, void* user_data);
1085
1111 entropic_handle_t handle,
1112 ent_delegation_start_cb on_start,
1113 ent_delegation_complete_cb on_complete,
1114 void* user_data);
1115
1116/* ── Validation Retry Controls (v2.1.5, gh#30) ───────── */
1117
1131 int attempt_n, void* user_data);
1132
1156 entropic_handle_t handle,
1157 int enabled);
1158
1176 entropic_handle_t handle);
1177
1196 entropic_handle_t handle);
1197
1215 entropic_handle_t handle,
1217 void* user_data);
1218
1219/* ── External MCP Servers (v1.8.7) ───────────────────── */
1220
1242 entropic_handle_t handle,
1243 const char* name,
1244 const char* config_json);
1245
1263 entropic_handle_t handle,
1264 const char* name);
1265
1281ENTROPIC_EXPORT char* entropic_list_mcp_servers(
1282 entropic_handle_t handle);
1283
1284/* ── Storage (v1.8.8) ────────────────────────────────── */
1285
1304 entropic_handle_t handle,
1305 const char* db_path);
1306
1320 entropic_handle_t handle);
1321
1322/* ── Identity (v1.8.9) ───────────────────────────────── */
1323
1343 entropic_handle_t handle,
1344 const char* identity_name);
1345
1366 entropic_handle_t handle,
1367 char** identity_json);
1368
1369/* ── Hooks (v1.9.1) ──────────────────────────────────── */
1370
1394 entropic_handle_t handle,
1395 entropic_hook_point_t hook_point,
1396 entropic_hook_callback_t callback,
1397 void* user_data,
1398 int priority);
1399
1417 entropic_handle_t handle,
1418 entropic_hook_point_t hook_point,
1419 entropic_hook_callback_t callback,
1420 void* user_data);
1421
1422/* ── LoRA Adapters (v1.9.2) ───────────────────────────── */
1423
1442 entropic_handle_t handle,
1443 const char* adapter_name,
1444 const char* adapter_path,
1445 const char* base_model_path,
1446 float scale);
1447
1460 entropic_handle_t handle,
1461 const char* adapter_name);
1462
1478 entropic_handle_t handle,
1479 const char* adapter_name);
1480
1491ENTROPIC_EXPORT int entropic_adapter_state(
1492 entropic_handle_t handle,
1493 const char* adapter_name);
1494
1509ENTROPIC_EXPORT char* entropic_adapter_info(
1510 entropic_handle_t handle,
1511 const char* adapter_name);
1512
1526ENTROPIC_EXPORT char* entropic_adapter_list(entropic_handle_t handle);
1527
1528/* ── Grammar Registry (v1.9.3) ───────────────────────── */
1529
1545 entropic_handle_t handle,
1546 const char* key,
1547 const char* gbnf_content);
1548
1565 entropic_handle_t handle,
1566 const char* key,
1567 const char* path);
1568
1583 entropic_handle_t handle,
1584 const char* key);
1585
1600ENTROPIC_EXPORT char* entropic_grammar_get(
1601 entropic_handle_t handle,
1602 const char* key);
1603
1620ENTROPIC_EXPORT char* entropic_grammar_validate(const char* gbnf_content);
1621
1637ENTROPIC_EXPORT char* entropic_grammar_list(entropic_handle_t handle);
1638
1639/* ── GPU Resource Profiles (v1.9.7) ──────────────────── */
1640
1657 entropic_handle_t handle,
1658 const char* profile_json);
1659
1673 entropic_handle_t handle,
1674 const char* name);
1675
1690ENTROPIC_EXPORT char* entropic_profile_get(
1691 entropic_handle_t handle,
1692 const char* name);
1693
1707ENTROPIC_EXPORT char* entropic_profile_list(entropic_handle_t handle);
1708
1709/* ── Throughput Query (v1.9.7) ───────────────────────── */
1710
1721ENTROPIC_EXPORT double entropic_throughput_tok_per_sec(
1722 entropic_handle_t handle,
1723 const char* model_path);
1724
1734ENTROPIC_EXPORT void entropic_throughput_reset(
1735 entropic_handle_t handle,
1736 const char* model_path);
1737
1738/* ── MCP Authorization (v1.9.4) ──────────────────────── */
1739
1749
1768 entropic_handle_t handle,
1769 const char* identity_name,
1770 const char* pattern,
1772
1788 entropic_handle_t handle,
1789 const char* identity_name,
1790 const char* pattern);
1791
1804ENTROPIC_EXPORT int entropic_check_mcp_key(
1805 entropic_handle_t handle,
1806 const char* identity_name,
1807 const char* tool_name,
1809
1824ENTROPIC_EXPORT char* entropic_list_mcp_keys(
1825 entropic_handle_t handle,
1826 const char* identity_name);
1827
1847 entropic_handle_t handle,
1848 const char* granter,
1849 const char* grantee,
1850 const char* pattern,
1852
1865ENTROPIC_EXPORT char* entropic_serialize_mcp_keys(
1866 entropic_handle_t handle);
1867
1884 entropic_handle_t handle,
1885 const char* json);
1886
1887/* ── Audit (v1.9.5) ──────────────────────────────────────── */
1888
1900 entropic_handle_t handle);
1901
1915 entropic_handle_t handle,
1916 size_t* count);
1917
1940 entropic_handle_t handle,
1941 const char* path,
1942 const char* filter_json,
1943 char** result_json);
1944
1945/* ── Dynamic Identity Management (v1.9.6) ────────────── */
1946
1969 entropic_handle_t handle,
1970 const char* config_json);
1971
1989 entropic_handle_t handle,
1990 const char* name,
1991 const char* config_json);
1992
2009 entropic_handle_t handle,
2010 const char* name);
2011
2026ENTROPIC_EXPORT char* entropic_get_identity_config(
2027 entropic_handle_t handle,
2028 const char* name);
2029
2043ENTROPIC_EXPORT char* entropic_list_identities(
2044 entropic_handle_t handle);
2045
2060 entropic_handle_t handle,
2061 size_t* total,
2062 size_t* dynamic);
2063
2064/* ── Compaction Hooks (v1.9.9) ───────────────────────── */
2065
2094 const char* messages_json,
2095 const char* config_json,
2096 char** out_messages,
2097 char** out_summary,
2098 void* user_data);
2099
2117ENTROPIC_EXPORT entropic_error_t entropic_compact(
2118 entropic_handle_t handle,
2119 const char* identity,
2120 char** result_json);
2121
2144 entropic_handle_t handle,
2145 const char* identity,
2146 entropic_compactor_fn compactor,
2147 void* user_data);
2148
2164 entropic_handle_t handle,
2165 const char* identity);
2166
2184 entropic_handle_t handle,
2185 entropic_compactor_fn* compactor,
2186 void** user_data);
2187
2188/* ── Log-Probability Evaluation (v1.9.10) ────────────── */
2189
2212
2240 entropic_handle_t handle,
2241 const char* model_id,
2242 const int32_t* tokens,
2243 int n_tokens,
2245
2264 entropic_handle_t handle,
2265 const char* model_id,
2266 const int32_t* tokens,
2267 int n_tokens,
2268 float* perplexity);
2269
2280ENTROPIC_EXPORT void entropic_free_logprob_result(
2282
2283/* ── Constitutional Validation (v1.9.8) ──────────────── */
2284
2300 entropic_handle_t handle,
2301 bool enabled);
2302
2317 entropic_handle_t handle,
2318 const char* identity_name,
2319 bool enabled);
2320
2338ENTROPIC_EXPORT char* entropic_validation_last_result(
2339 entropic_handle_t handle);
2340
2341/* ── Vision / Multimodal (v1.9.11) ────────────────────── */
2342
2356ENTROPIC_EXPORT int entropic_model_has_vision(
2357 entropic_handle_t handle,
2358 const char* model_id);
2359
2360/* ── Diagnose / Self-Inspection (v1.9.12) ─────────────── */
2361
2383 entropic_handle_t handle,
2384 char** prompt_out);
2385
2386#ifdef __cplusplus
2387}
2388#endif
ENTROPIC_EXPORT entropic_error_t entropic_profile_register(entropic_handle_t handle, const char *profile_json)
Register a custom GPU resource profile.
ENTROPIC_EXPORT entropic_error_t entropic_context_usage(entropic_handle_t handle, size_t *tokens_used, size_t *capacity)
Read current context-window pressure for the active tier.
ENTROPIC_EXPORT entropic_error_t entropic_run_messages_streaming(entropic_handle_t handle, const char *messages_json, void(*on_token)(const char *token, size_t len, void *user_data), void *user_data, int *cancel_flag)
Streaming variant of entropic_run_messages (gh#37).
ENTROPIC_EXPORT entropic_error_t entropic_set_attempt_boundary_cb(entropic_handle_t handle, ent_validation_attempt_boundary_cb cb, void *user_data)
Register an attempt-boundary callback for the validator.
struct entropic_logprob_result entropic_logprob_result_t
Per-token log-probability result.
ENTROPIC_EXPORT entropic_error_t entropic_grammar_register_file(entropic_handle_t handle, const char *key, const char *path)
Register a grammar from a file path.
ENTROPIC_EXPORT entropic_error_t entropic_register_compactor(entropic_handle_t handle, const char *identity, entropic_compactor_fn compactor, void *user_data)
Register a custom compactor for an identity.
ENTROPIC_EXPORT char * entropic_grammar_validate(const char *gbnf_content)
Validate a GBNF grammar string without registering.
ENTROPIC_EXPORT entropic_error_t entropic_deserialize_mcp_keys(entropic_handle_t handle, const char *json)
Deserialize all identity key sets from JSON.
ENTROPIC_EXPORT int64_t entropic_seconds_since_last_activity(entropic_handle_t handle)
Seconds since the engine last serviced a run (gh#35, v2.3.0).
ENTROPIC_EXPORT void * entropic_alloc(size_t size)
Allocate memory using the engine's allocator.
ENTROPIC_EXPORT char * entropic_grammar_list(entropic_handle_t handle)
List all registered grammars as JSON array.
ENTROPIC_EXPORT entropic_error_t entropic_load_identity(entropic_handle_t handle, const char *identity_name)
Load an identity by name from the configuration.
ENTROPIC_EXPORT entropic_error_t entropic_state_load(entropic_handle_t handle, const char *tier_name, const char *path)
Restore a tier's KV-cache state from a file (gh#23 MVP item 13).
ENTROPIC_EXPORT entropic_error_t entropic_run_batch(entropic_handle_t handle, const char **tiers, const char **prompts, size_t n, char **result_json)
Same-prefix batch run on a shared resident model (gh#98).
ENTROPIC_EXPORT entropic_error_t entropic_validation_accept_last(entropic_handle_t handle)
Finalize the last attempt as the turn's response.
ENTROPIC_EXPORT entropic_error_t entropic_set_state_observer(entropic_handle_t handle, void(*observer)(int state, void *user_data), void *user_data)
Register an engine state-change observer.
ENTROPIC_EXPORT entropic_error_t entropic_context_count(entropic_handle_t handle, size_t *count)
Get the number of messages in the conversation.
ENTROPIC_EXPORT entropic_error_t entropic_configure_dir(entropic_handle_t handle, const char *project_dir)
Configure engine using layered config resolution.
ENTROPIC_EXPORT entropic_error_t entropic_get_default_compactor(entropic_handle_t handle, entropic_compactor_fn *compactor, void **user_data)
Get the built-in default compactor function pointer.
ENTROPIC_EXPORT entropic_error_t entropic_register_mcp_server(entropic_handle_t handle, const char *name, const char *config_json)
Register an external MCP server at runtime.
ENTROPIC_EXPORT entropic_error_t entropic_storage_open(entropic_handle_t handle, const char *db_path)
Open or create a SQLite storage backend.
ent_decision_t(* ent_delegation_start_cb)(const ent_delegation_request_t *req, void *user_data)
Callback fired before a delegation runs.
Definition entropic.h:1058
ent_decision_t(* ent_delegation_complete_cb)(const ent_delegation_result_t *res, void *user_data)
Callback fired after a delegation produces a patch.
Definition entropic.h:1083
ENTROPIC_EXPORT char * entropic_grammar_get(entropic_handle_t handle, const char *key)
Get grammar content by key.
ENTROPIC_EXPORT entropic_error_t entropic_residency_snapshot(entropic_handle_t handle, char **out_json)
Snapshot of the engine's current VRAM residency set.
ENTROPIC_EXPORT entropic_error_t entropic_validation_resume_retry(entropic_handle_t handle)
Opt the engine into running the constitutional revision pass.
ENTROPIC_EXPORT int entropic_api_version(void)
Get the C API version number.
ENTROPIC_EXPORT entropic_error_t entropic_adapter_swap(entropic_handle_t handle, const char *adapter_name)
Swap the active LoRA adapter.
ENTROPIC_EXPORT entropic_error_t entropic_audit_flush(entropic_handle_t handle)
Flush the audit logger to disk immediately.
ENTROPIC_EXPORT entropic_error_t entropic_set_stream_observer(entropic_handle_t handle, void(*observer)(const char *token, size_t len, void *user_data), void *user_data)
Set a global stream observer callback.
ENTROPIC_EXPORT char * entropic_adapter_info(entropic_handle_t handle, const char *adapter_name)
Get adapter info as JSON.
ENTROPIC_EXPORT entropic_error_t entropic_context_clear(entropic_handle_t handle)
Clear conversation history, starting a new session.
ENTROPIC_EXPORT entropic_error_t entropic_adapter_load(entropic_handle_t handle, const char *adapter_name, const char *adapter_path, const char *base_model_path, float scale)
Load a LoRA adapter into RAM.
ENTROPIC_EXPORT entropic_error_t entropic_profile_deregister(entropic_handle_t handle, const char *name)
Remove a GPU resource profile.
ENTROPIC_EXPORT entropic_error_t entropic_get_logprobs(entropic_handle_t handle, const char *model_id, const int32_t *tokens, int n_tokens, entropic_logprob_result_t *result)
Evaluate per-token log-probabilities for a token sequence.
ENTROPIC_EXPORT entropic_error_t entropic_update_identity(entropic_handle_t handle, const char *name, const char *config_json)
Update a dynamic identity.
ent_decision_t
Consumer decision returned from delegation callbacks.
Definition entropic.h:997
ENTROPIC_EXPORT entropic_error_t entropic_configure(entropic_handle_t handle, const char *config_json)
Configure the engine from a JSON config string.
ENTROPIC_EXPORT entropic_error_t entropic_validation_set_auto_retry(entropic_handle_t handle, int enabled)
Toggle automatic constitutional revision after rejection.
ENTROPIC_EXPORT entropic_error_t entropic_identity_count(entropic_handle_t handle, size_t *total, size_t *dynamic)
Get identity count.
ENTROPIC_EXPORT entropic_error_t entropic_compute_perplexity(entropic_handle_t handle, const char *model_id, const int32_t *tokens, int n_tokens, float *perplexity)
Compute perplexity for a token sequence.
ENTROPIC_EXPORT void entropic_destroy(entropic_handle_t handle)
Destroy an engine instance and free all resources.
ENTROPIC_EXPORT void entropic_throughput_reset(entropic_handle_t handle, const char *model_path)
Reset throughput tracking data for a model.
ENTROPIC_EXPORT entropic_error_t entropic_run(entropic_handle_t handle, const char *input, char **result_json)
Synchronous agentic loop.
ENTROPIC_EXPORT entropic_error_t entropic_grammar_register(entropic_handle_t handle, const char *key, const char *gbnf_content)
Register a grammar by key from a GBNF content string.
ENTROPIC_EXPORT entropic_error_t entropic_queue_user_message(entropic_handle_t handle, const char *message)
Queue a user message to be injected at the next top-level turn boundary.
ENTROPIC_EXPORT char * entropic_list_identities(entropic_handle_t handle)
List all identity names as JSON array.
ENTROPIC_EXPORT int entropic_check_mcp_key(entropic_handle_t handle, const char *identity_name, const char *tool_name, entropic_mcp_access_level_t level)
Check if a tool call is authorized for an identity.
ENTROPIC_EXPORT entropic_error_t entropic_state_save(entropic_handle_t handle, const char *tier_name, const char *path)
Save a tier's KV-cache state to a file (gh#23 MVP item 13).
ENTROPIC_EXPORT char * entropic_profile_get(entropic_handle_t handle, const char *name)
Get a profile by name as JSON.
ENTROPIC_EXPORT entropic_error_t entropic_deregister_compactor(entropic_handle_t handle, const char *identity)
Deregister a custom compactor for an identity.
ENTROPIC_EXPORT entropic_error_t entropic_grant_mcp_key(entropic_handle_t handle, const char *identity_name, const char *pattern, entropic_mcp_access_level_t level)
Grant an MCP tool key to an identity.
ENTROPIC_EXPORT char * entropic_profile_list(entropic_handle_t handle)
List all registered profiles as JSON array.
void(* entropic_residency_observer_t)(entropic_residency_event_t event, const char *tier_name, const char *model_path, size_t footprint_bytes, void *user_data)
Residency observer callback.
Definition entropic.h:748
ENTROPIC_EXPORT entropic_error_t entropic_create_identity(entropic_handle_t handle, const char *config_json)
Create a dynamic identity.
ENTROPIC_EXPORT entropic_error_t entropic_destroy_identity(entropic_handle_t handle, const char *name)
Destroy a dynamic identity.
ENTROPIC_EXPORT entropic_error_t entropic_audit_read(entropic_handle_t handle, const char *path, const char *filter_json, char **result_json)
Read audit log entries from a JSONL file.
ENTROPIC_EXPORT int entropic_adapter_state(entropic_handle_t handle, const char *adapter_name)
Query adapter state.
ENTROPIC_EXPORT entropic_error_t entropic_set_critique_callbacks(entropic_handle_t handle, void(*start_cb)(void *user_data), void(*end_cb)(void *user_data), void *user_data)
Register start/end callbacks for constitutional critique generation (gh#50, v2.1.12).
ENTROPIC_EXPORT entropic_error_t entropic_get_diagnostic_prompt(entropic_handle_t handle, char **prompt_out)
Get the diagnostic prompt text for /diagnose command.
ENTROPIC_EXPORT entropic_error_t entropic_audit_count(entropic_handle_t handle, size_t *count)
Get the number of audit log entries recorded this session.
ENTROPIC_EXPORT entropic_error_t entropic_speculative_compat(entropic_handle_t handle, int *compatible, char **diagnostic)
Query whether the configured target/draft pair is compatible for speculative decoding.
ENTROPIC_EXPORT entropic_error_t entropic_metrics_json(entropic_handle_t handle, char **out)
Get loop metrics from the most recent run as JSON.
ENTROPIC_EXPORT entropic_error_t entropic_validation_set_identity(entropic_handle_t handle, const char *identity_name, bool enabled)
Set per-identity validation override.
ENTROPIC_EXPORT int entropic_model_has_vision(entropic_handle_t handle, const char *model_id)
Check if a model has vision capability.
ENTROPIC_EXPORT entropic_error_t entropic_user_message_queue_depth(entropic_handle_t handle, size_t *count)
Query the current depth of the mid-gen user-message queue.
ENTROPIC_EXPORT entropic_error_t entropic_revoke_mcp_key(entropic_handle_t handle, const char *identity_name, const char *pattern)
Revoke an MCP tool key from an identity.
ENTROPIC_EXPORT char * entropic_serialize_mcp_keys(entropic_handle_t handle)
Serialize all identity key sets to JSON.
ENTROPIC_EXPORT char * entropic_get_identity_config(entropic_handle_t handle, const char *name)
Get identity configuration as JSON by name.
entropic_residency_event_t
Reasons fired by entropic_residency_observer_t.
Definition entropic.h:723
@ ENTROPIC_RESIDENCY_EVICTED
Tier model just unloaded to free VRAM.
Definition entropic.h:725
@ ENTROPIC_RESIDENCY_LOADED
Tier model just loaded into VRAM.
Definition entropic.h:724
@ ENTROPIC_RESIDENCY_ACTIVATION_SWAP
Active tier swapped without unload (multi-resident hit)
Definition entropic.h:726
ENTROPIC_EXPORT const char * entropic_version(void)
Get the library version string.
ENTROPIC_EXPORT char * entropic_validation_last_result(entropic_handle_t handle)
Get the last validation result as JSON.
ENTROPIC_EXPORT entropic_error_t entropic_interrupt(entropic_handle_t handle)
Interrupt a running generation.
ENTROPIC_EXPORT entropic_error_t entropic_deregister_hook(entropic_handle_t handle, entropic_hook_point_t hook_point, entropic_hook_callback_t callback, void *user_data)
Deregister a previously registered hook callback.
ENTROPIC_EXPORT char * entropic_list_mcp_servers(entropic_handle_t handle)
List all MCP servers with status information.
ENTROPIC_EXPORT void entropic_free(void *ptr)
Free memory allocated by the engine or entropic_alloc().
ENTROPIC_EXPORT entropic_error_t entropic_run_as(entropic_handle_t handle, const char *tier_or_identity, const char *input, char **result_json)
Single-turn agentic run under a named tier (gh#99).
int(* entropic_compactor_fn)(const char *messages_json, const char *config_json, char **out_messages, char **out_summary, void *user_data)
Compactor function type.
Definition entropic.h:2093
ENTROPIC_EXPORT entropic_error_t entropic_set_delegation_callbacks(entropic_handle_t handle, ent_delegation_start_cb on_start, ent_delegation_complete_cb on_complete, void *user_data)
Register start/complete callbacks for delegations.
ENTROPIC_EXPORT char * entropic_list_mcp_keys(entropic_handle_t handle, const char *identity_name)
List all MCP keys for an identity as JSON.
ENTROPIC_EXPORT entropic_error_t entropic_grammar_deregister(entropic_handle_t handle, const char *key)
Remove a grammar from the registry.
ENTROPIC_EXPORT entropic_error_t entropic_grant_mcp_key_from(entropic_handle_t handle, const char *granter, const char *grantee, const char *pattern, entropic_mcp_access_level_t level)
Grant a key from one identity to another.
ENTROPIC_EXPORT entropic_error_t entropic_adapter_unload(entropic_handle_t handle, const char *adapter_name)
Unload a LoRA adapter.
ENTROPIC_EXPORT entropic_error_t entropic_clear_user_message_queue(entropic_handle_t handle)
Drop all queued user messages.
ENTROPIC_EXPORT void entropic_free_logprob_result(entropic_logprob_result_t *result)
Free internal arrays of a logprob result.
ENTROPIC_EXPORT entropic_error_t entropic_set_queue_observer(entropic_handle_t handle, void(*observer)(const char *consumed, size_t remaining, void *user_data), void *user_data)
Register an observer for queue-consumption events.
ENTROPIC_EXPORT entropic_error_t entropic_get_identity(entropic_handle_t handle, char **identity_json)
Get the current active identity as a JSON string.
ENTROPIC_EXPORT entropic_error_t entropic_run_messages(entropic_handle_t handle, const char *messages_json, char **result_json)
Multimodal-aware agentic run with messages-array input (gh#37).
ENTROPIC_EXPORT entropic_error_t entropic_validation_set_enabled(entropic_handle_t handle, bool enabled)
Enable or disable constitutional validation.
ENTROPIC_EXPORT entropic_error_t entropic_context_get(entropic_handle_t handle, char **messages_json)
Get the current conversation history as a JSON array.
ENTROPIC_EXPORT entropic_error_t entropic_compact(entropic_handle_t handle, const char *identity, char **result_json)
Trigger compaction on the current context.
ENTROPIC_EXPORT entropic_error_t entropic_create(entropic_handle_t *handle)
Create a new engine instance.
Definition entropic.cpp:241
ENTROPIC_EXPORT entropic_error_t entropic_register_hook(entropic_handle_t handle, entropic_hook_point_t hook_point, entropic_hook_callback_t callback, void *user_data, int priority)
Register a callback for an engine hook point.
ENTROPIC_EXPORT double entropic_throughput_tok_per_sec(entropic_handle_t handle, const char *model_path)
Get current throughput estimate for a model.
entropic_mcp_access_level_t
Access level enum for MCP authorization.
Definition entropic.h:1744
@ ENTROPIC_MCP_ACCESS_WRITE
Read + write operations.
Definition entropic.h:1747
@ ENTROPIC_MCP_ACCESS_NONE
No access.
Definition entropic.h:1745
@ ENTROPIC_MCP_ACCESS_READ
Read-only operations.
Definition entropic.h:1746
ENTROPIC_EXPORT entropic_error_t entropic_set_residency_observer(entropic_handle_t handle, entropic_residency_observer_t observer, void *user_data)
Register a residency observer on a handle.
ENTROPIC_EXPORT entropic_error_t entropic_run_streaming(entropic_handle_t handle, const char *input, void(*on_token)(const char *token, size_t len, void *user_data), void *user_data, int *cancel_flag)
Streaming agentic loop with token callback.
void(* ent_validation_attempt_boundary_cb)(int attempt_n, void *user_data)
Stream-side callback fired between constitutional revision passes.
Definition entropic.h:1130
ENTROPIC_EXPORT entropic_error_t entropic_configure_from_file(entropic_handle_t handle, const char *config_path)
Configure engine from a YAML or JSON config file.
ENTROPIC_EXPORT char * entropic_adapter_list(entropic_handle_t handle)
List all adapters as JSON array.
ENTROPIC_EXPORT entropic_error_t entropic_storage_close(entropic_handle_t handle)
Close the storage backend and flush pending writes.
ENTROPIC_EXPORT entropic_error_t entropic_deregister_mcp_server(entropic_handle_t handle, const char *name)
Deregister an external MCP server.
Symbol visibility macro for all exported symbols.
Error types for cross-.so error reporting.
entropic_error_t
Error codes returned by all C API functions.
Definition error.h:35
Hook point enum and callback types for engine lifecycle hooks.
int(* entropic_hook_callback_t)(entropic_hook_point_t hook_point, const char *context_json, char **modified_json, void *user_data)
Hook callback function type.
Definition hooks.h:134
entropic_hook_point_t
Hook points in the engine lifecycle.
Definition hooks.h:34
Request describing a delegation that is about to run.
Definition entropic.h:1011
const char * target_tier
Tier name (e.g. "researcher")
Definition entropic.h:1013
const char * delegation_id
Short id ("d1", "d2", "pipeline")
Definition entropic.h:1012
int is_pipeline
1 for pipeline stages, 0 for single
Definition entropic.h:1016
const char * task
Task description text.
Definition entropic.h:1014
int depth
Delegation depth (1 = top-level child)
Definition entropic.h:1015
Result of a finalized delegation, delivered to the consumer.
Definition entropic.h:1034
const char * patch
Unified diff (may be empty string)
Definition entropic.h:1039
const char * delegation_id
Short id (matches request)
Definition entropic.h:1035
size_t patch_len
Byte length of patch (excluding NUL)
Definition entropic.h:1040
const char * target_tier
Tier that executed.
Definition entropic.h:1036
int success
1 if child reached COMPLETE, 0 otherwise
Definition entropic.h:1037
size_t files_touched_len
Count (excluding the NULL terminator)
Definition entropic.h:1042
const char * summary
Final summary text from the child.
Definition entropic.h:1038
const char *const * files_touched
NULL-terminated array of relpaths.
Definition entropic.h:1041
Engine handle struct — owns all subsystems.
Per-token log-probability result.
Definition entropic.h:2204
float perplexity
exp(-mean(logprobs)) over the sequence.
Definition entropic.h:2207
int32_t * tokens
Input tokens echoed back (N values).
Definition entropic.h:2206
int n_logprobs
Number of logprob values (n_tokens - 1).
Definition entropic.h:2210
int n_tokens
Number of input tokens.
Definition entropic.h:2209
float * logprobs
Per-token log-probabilities (N-1 values).
Definition entropic.h:2205
float total_logprob
Sum of all logprob values.
Definition entropic.h:2208