Entropic 2.11.1
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
45#pragma once
46
47#include <stdbool.h>
48#include <stddef.h>
49#include <stdint.h>
50
51#include <entropic/entropic_config.h>
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60/* ── Lifecycle ────────────────────────────────────────── */
61
80
107 entropic_handle_t handle,
108 const char* config_json);
109
131 entropic_handle_t handle,
132 const char* config_path);
133
164 entropic_handle_t handle,
165 const char* project_dir);
166
182ENTROPIC_EXPORT void entropic_destroy(entropic_handle_t handle);
183
184/* ── Version ──────────────────────────────────────────── */
185
199ENTROPIC_EXPORT const char* entropic_version(void);
200
219ENTROPIC_EXPORT int entropic_api_version(void);
220
243ENTROPIC_EXPORT int64_t entropic_seconds_since_last_activity(
244 entropic_handle_t handle);
245
246/* ── Memory ───────────────────────────────────────────── */
247
263ENTROPIC_EXPORT void* entropic_alloc(size_t size);
264
278ENTROPIC_EXPORT void entropic_free(void* ptr);
279
280/* ── Execution ────────────────────────────────────────── */
281
309ENTROPIC_EXPORT entropic_error_t entropic_run(
310 entropic_handle_t handle,
311 const char* input,
312 char** result_json);
313
345ENTROPIC_EXPORT entropic_error_t entropic_run_as(
346 entropic_handle_t handle,
347 const char* tier_or_identity,
348 const char* input,
349 char** result_json);
350
386 entropic_handle_t handle,
387 const char** tiers,
388 const char** prompts,
389 size_t n,
390 char** result_json);
391
420 entropic_handle_t handle,
421 const char* input,
422 void (*on_token)(const char* token, size_t len, void* user_data),
423 void* user_data,
424 int* cancel_flag);
425
467 entropic_handle_t handle,
468 const char* messages_json,
469 char** result_json);
470
493 entropic_handle_t handle,
494 const char* messages_json,
495 void (*on_token)(const char* token, size_t len, void* user_data),
496 void* user_data,
497 int* cancel_flag);
498
531 entropic_handle_t handle,
532 void (*observer)(const char* token, size_t len, void* user_data),
533 void* user_data);
534
559 entropic_handle_t handle,
560 void (*observer)(int state, void* user_data),
561 void* user_data);
562
603 entropic_handle_t handle,
604 void (*start_cb)(void* user_data),
605 void (*end_cb)(void* user_data),
606 void* user_data);
607
628
629/* ── Mid-generation message queue (v2.1.10, gh#40) ────── */
630
672 entropic_handle_t handle,
673 const char* message);
674
694 entropic_handle_t handle,
695 size_t* count);
696
713 entropic_handle_t handle);
714
741 entropic_handle_t handle,
742 void (*observer)(const char* consumed,
743 size_t remaining,
744 void* user_data),
745 void* user_data);
746
747/* ── Speculative decoding (v2.1.11, gh#36) ─────────────── */
748
782 entropic_handle_t handle,
783 int* compatible,
784 char** diagnostic);
785
786/* ── VRAM-aware tier residency (v2.2.4, gh#57) ────────── */
787
801
823 const char* tier_name,
824 const char* model_path,
825 size_t footprint_bytes,
826 void* user_data);
827
847 entropic_handle_t handle,
849 void* user_data);
850
899 entropic_handle_t handle,
900 char** out_json);
901
902/* ── Conversation Context (v2.0.1) ───────────────────── */
903
921 entropic_handle_t handle);
922
947 entropic_handle_t handle,
948 char** messages_json);
949
965 entropic_handle_t handle,
966 size_t* count);
967
993 entropic_handle_t handle,
994 size_t* tokens_used,
995 size_t* capacity);
996
1027 entropic_handle_t handle,
1028 const char* tier_name,
1029 const char* path);
1030
1054 entropic_handle_t handle,
1055 const char* tier_name,
1056 const char* path);
1057
1077 entropic_handle_t handle,
1078 char** out);
1079
1080/* ── Delegation Callbacks (v2.1.5, gh#29) ──────────────── */
1081
1091typedef enum {
1092 ENT_DECISION_ACCEPT = 0,
1093 ENT_DECISION_REJECT = 1
1095
1105typedef struct {
1106 const char* delegation_id;
1107 const char* target_tier;
1108 const char* task;
1109 int depth;
1112
1128typedef struct {
1129 const char* delegation_id;
1130 const char* target_tier;
1132 const char* summary;
1133 const char* patch;
1134 size_t patch_len;
1135 const char* const* files_touched;
1138
1153 const ent_delegation_request_t* req, void* user_data);
1154
1178 const ent_delegation_result_t* res, void* user_data);
1179
1208 entropic_handle_t handle,
1209 ent_delegation_start_cb on_start,
1210 ent_delegation_complete_cb on_complete,
1211 void* user_data);
1212
1213/* ── Validation Retry Controls (v2.1.5, gh#30) ───────── */
1214
1228 int attempt_n, void* user_data);
1229
1255 entropic_handle_t handle,
1256 int enabled);
1257
1277 entropic_handle_t handle);
1278
1299 entropic_handle_t handle);
1300
1321 entropic_handle_t handle,
1323 void* user_data);
1324
1325/* ── External MCP Servers (v1.8.7) ───────────────────── */
1326
1350 entropic_handle_t handle,
1351 const char* name,
1352 const char* config_json);
1353
1373 entropic_handle_t handle,
1374 const char* name);
1375
1394ENTROPIC_EXPORT char* entropic_list_mcp_servers(
1395 entropic_handle_t handle);
1396
1397/* ── Storage (v1.8.8) ────────────────────────────────── */
1398
1419 entropic_handle_t handle,
1420 const char* db_path);
1421
1437 entropic_handle_t handle);
1438
1439/* ── Identity (v1.8.9) ───────────────────────────────── */
1440
1462 entropic_handle_t handle,
1463 const char* identity_name);
1464
1488 entropic_handle_t handle,
1489 char** identity_json);
1490
1491/* ── Hooks (v1.9.1) ──────────────────────────────────── */
1492
1518 entropic_handle_t handle,
1519 entropic_hook_point_t hook_point,
1520 entropic_hook_callback_t callback,
1521 void* user_data,
1522 int priority);
1523
1543 entropic_handle_t handle,
1544 entropic_hook_point_t hook_point,
1545 entropic_hook_callback_t callback,
1546 void* user_data);
1547
1548/* ── LoRA Adapters (v1.9.2) ───────────────────────────── */
1549
1570 entropic_handle_t handle,
1571 const char* adapter_name,
1572 const char* adapter_path,
1573 const char* base_model_path,
1574 float scale);
1575
1590 entropic_handle_t handle,
1591 const char* adapter_name);
1592
1610 entropic_handle_t handle,
1611 const char* adapter_name);
1612
1625ENTROPIC_EXPORT int entropic_adapter_state(
1626 entropic_handle_t handle,
1627 const char* adapter_name);
1628
1646ENTROPIC_EXPORT char* entropic_adapter_info(
1647 entropic_handle_t handle,
1648 const char* adapter_name);
1649
1666ENTROPIC_EXPORT char* entropic_adapter_list(entropic_handle_t handle);
1667
1668/* ── Grammar Registry (v1.9.3) ───────────────────────── */
1669
1687 entropic_handle_t handle,
1688 const char* key,
1689 const char* gbnf_content);
1690
1709 entropic_handle_t handle,
1710 const char* key,
1711 const char* path);
1712
1729 entropic_handle_t handle,
1730 const char* key);
1731
1749ENTROPIC_EXPORT char* entropic_grammar_get(
1750 entropic_handle_t handle,
1751 const char* key);
1752
1772ENTROPIC_EXPORT char* entropic_grammar_validate(const char* gbnf_content);
1773
1792ENTROPIC_EXPORT char* entropic_grammar_list(entropic_handle_t handle);
1793
1794/* ── GPU Resource Profiles (v1.9.7) ──────────────────── */
1795
1814 entropic_handle_t handle,
1815 const char* profile_json);
1816
1832 entropic_handle_t handle,
1833 const char* name);
1834
1852ENTROPIC_EXPORT char* entropic_profile_get(
1853 entropic_handle_t handle,
1854 const char* name);
1855
1872ENTROPIC_EXPORT char* entropic_profile_list(entropic_handle_t handle);
1873
1874/* ── Throughput Query (v1.9.7) ───────────────────────── */
1875
1888ENTROPIC_EXPORT double entropic_throughput_tok_per_sec(
1889 entropic_handle_t handle,
1890 const char* model_path);
1891
1903ENTROPIC_EXPORT void entropic_throughput_reset(
1904 entropic_handle_t handle,
1905 const char* model_path);
1906
1907/* ── MCP Authorization (v1.9.4) ──────────────────────── */
1908
1918
1939 entropic_handle_t handle,
1940 const char* identity_name,
1941 const char* pattern,
1943
1961 entropic_handle_t handle,
1962 const char* identity_name,
1963 const char* pattern);
1964
1979ENTROPIC_EXPORT int entropic_check_mcp_key(
1980 entropic_handle_t handle,
1981 const char* identity_name,
1982 const char* tool_name,
1984
2002ENTROPIC_EXPORT char* entropic_list_mcp_keys(
2003 entropic_handle_t handle,
2004 const char* identity_name);
2005
2027 entropic_handle_t handle,
2028 const char* granter,
2029 const char* grantee,
2030 const char* pattern,
2032
2048ENTROPIC_EXPORT char* entropic_serialize_mcp_keys(
2049 entropic_handle_t handle);
2050
2069 entropic_handle_t handle,
2070 const char* json);
2071
2072/* ── Audit (v1.9.5) ──────────────────────────────────────── */
2073
2087 entropic_handle_t handle);
2088
2104 entropic_handle_t handle,
2105 size_t* count);
2106
2132 entropic_handle_t handle,
2133 const char* path,
2134 const char* filter_json,
2135 char** result_json);
2136
2137/* ── Dynamic Identity Management (v1.9.6) ────────────── */
2138
2163 entropic_handle_t handle,
2164 const char* config_json);
2165
2185 entropic_handle_t handle,
2186 const char* name,
2187 const char* config_json);
2188
2207 entropic_handle_t handle,
2208 const char* name);
2209
2227ENTROPIC_EXPORT char* entropic_get_identity_config(
2228 entropic_handle_t handle,
2229 const char* name);
2230
2247ENTROPIC_EXPORT char* entropic_list_identities(
2248 entropic_handle_t handle);
2249
2266 entropic_handle_t handle,
2267 size_t* total,
2268 size_t* dynamic);
2269
2270/* ── Compaction Hooks (v1.9.9) ───────────────────────── */
2271
2300 const char* messages_json,
2301 const char* config_json,
2302 char** out_messages,
2303 char** out_summary,
2304 void* user_data);
2305
2326ENTROPIC_EXPORT entropic_error_t entropic_compact(
2327 entropic_handle_t handle,
2328 const char* identity,
2329 char** result_json);
2330
2355 entropic_handle_t handle,
2356 const char* identity,
2357 entropic_compactor_fn compactor,
2358 void* user_data);
2359
2377 entropic_handle_t handle,
2378 const char* identity);
2379
2399 entropic_handle_t handle,
2400 entropic_compactor_fn* compactor,
2401 void** user_data);
2402
2403/* ── Log-Probability Evaluation (v1.9.10) ────────────── */
2404
2427
2458 entropic_handle_t handle,
2459 const char* model_id,
2460 const int32_t* tokens,
2461 int n_tokens,
2463
2484 entropic_handle_t handle,
2485 const char* model_id,
2486 const int32_t* tokens,
2487 int n_tokens,
2488 float* perplexity);
2489
2502ENTROPIC_EXPORT void entropic_free_logprob_result(
2504
2505/* ── Constitutional Validation (v1.9.8) ──────────────── */
2506
2524 entropic_handle_t handle,
2525 bool enabled);
2526
2543 entropic_handle_t handle,
2544 const char* identity_name,
2545 bool enabled);
2546
2567ENTROPIC_EXPORT char* entropic_validation_last_result(
2568 entropic_handle_t handle);
2569
2570/* ── Vision / Multimodal (v1.9.11) ────────────────────── */
2571
2587ENTROPIC_EXPORT int entropic_model_has_vision(
2588 entropic_handle_t handle,
2589 const char* model_id);
2590
2591/* ── Diagnose / Self-Inspection (v1.9.12) ─────────────── */
2592
2616 entropic_handle_t handle,
2617 char** prompt_out);
2618
2619#ifdef __cplusplus
2620}
2621#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:1152
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:1177
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:1091
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:821
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:796
@ ENTROPIC_RESIDENCY_EVICTED
Tier model just unloaded to free VRAM.
Definition entropic.h:798
@ ENTROPIC_RESIDENCY_LOADED
Tier model just loaded into VRAM.
Definition entropic.h:797
@ ENTROPIC_RESIDENCY_ACTIVATION_SWAP
Active tier swapped without unload (multi-resident hit)
Definition entropic.h:799
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:2299
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:248
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:1913
@ ENTROPIC_MCP_ACCESS_WRITE
Read + write operations.
Definition entropic.h:1916
@ ENTROPIC_MCP_ACCESS_NONE
No access.
Definition entropic.h:1914
@ ENTROPIC_MCP_ACCESS_READ
Read-only operations.
Definition entropic.h:1915
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:1227
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:37
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:139
entropic_hook_point_t
Hook points in the engine lifecycle.
Definition hooks.h:39
Request describing a delegation that is about to run.
Definition entropic.h:1105
const char * target_tier
Tier name (e.g. "researcher")
Definition entropic.h:1107
const char * delegation_id
Short id ("d1", "d2", "pipeline")
Definition entropic.h:1106
int is_pipeline
1 for pipeline stages, 0 for single
Definition entropic.h:1110
const char * task
Task description text.
Definition entropic.h:1108
int depth
Delegation depth (1 = top-level child)
Definition entropic.h:1109
Result of a finalized delegation, delivered to the consumer.
Definition entropic.h:1128
const char * patch
Unified diff (may be empty string)
Definition entropic.h:1133
const char * delegation_id
Short id (matches request)
Definition entropic.h:1129
size_t patch_len
Byte length of patch (excluding NUL)
Definition entropic.h:1134
const char * target_tier
Tier that executed.
Definition entropic.h:1130
int success
1 if child reached COMPLETE, 0 otherwise
Definition entropic.h:1131
size_t files_touched_len
Count (excluding the NULL terminator)
Definition entropic.h:1136
const char * summary
Final summary text from the child.
Definition entropic.h:1132
const char *const * files_touched
NULL-terminated array of relpaths.
Definition entropic.h:1135
Engine handle struct — owns all subsystems.
Per-token log-probability result.
Definition entropic.h:2419
float perplexity
exp(-mean(logprobs)) over the sequence.
Definition entropic.h:2422
int32_t * tokens
Input tokens echoed back (N values).
Definition entropic.h:2421
int n_logprobs
Number of logprob values (n_tokens - 1).
Definition entropic.h:2425
int n_tokens
Number of input tokens.
Definition entropic.h:2424
float * logprobs
Per-token log-probabilities (N-1 values).
Definition entropic.h:2420
float total_logprob
Sum of all logprob values.
Definition entropic.h:2423