Entropic 2.3.8
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
306 entropic_handle_t handle,
307 const char* input,
308 void (*on_token)(const char* token, size_t len, void* user_data),
309 void* user_data,
310 int* cancel_flag);
311
349 entropic_handle_t handle,
350 const char* messages_json,
351 char** result_json);
352
372 entropic_handle_t handle,
373 const char* messages_json,
374 void (*on_token)(const char* token, size_t len, void* user_data),
375 void* user_data,
376 int* cancel_flag);
377
408 entropic_handle_t handle,
409 void (*observer)(const char* token, size_t len, void* user_data),
410 void* user_data);
411
433 entropic_handle_t handle,
434 void (*observer)(int state, void* user_data),
435 void* user_data);
436
474 entropic_handle_t handle,
475 void (*start_cb)(void* user_data),
476 void (*end_cb)(void* user_data),
477 void* user_data);
478
496
497/* ── Mid-generation message queue (v2.1.10, gh#40) ────── */
498
538 entropic_handle_t handle,
539 const char* message);
540
558 entropic_handle_t handle,
559 size_t* count);
560
575 entropic_handle_t handle);
576
601 entropic_handle_t handle,
602 void (*observer)(const char* consumed,
603 size_t remaining,
604 void* user_data),
605 void* user_data);
606
607/* ── Speculative decoding (v2.1.11, gh#36) ─────────────── */
608
639 entropic_handle_t handle,
640 int* compatible,
641 char** diagnostic);
642
643/* ── VRAM-aware tier residency (v2.2.4, gh#57) ────────── */
644
658
680 const char* tier_name,
681 const char* model_path,
682 size_t footprint_bytes,
683 void* user_data);
684
701 entropic_handle_t handle,
703 void* user_data);
704
750 entropic_handle_t handle,
751 char** out_json);
752
753/* ── Conversation Context (v2.0.1) ───────────────────── */
754
770 entropic_handle_t handle);
771
793 entropic_handle_t handle,
794 char** messages_json);
795
809 entropic_handle_t handle,
810 size_t* count);
811
835 entropic_handle_t handle,
836 size_t* tokens_used,
837 size_t* capacity);
838
856 entropic_handle_t handle,
857 char** out);
858
859/* ── Delegation Callbacks (v2.1.5, gh#29) ──────────────── */
860
870typedef enum {
871 ENT_DECISION_ACCEPT = 0,
872 ENT_DECISION_REJECT = 1
874
884typedef struct {
885 const char* delegation_id;
886 const char* target_tier;
887 const char* task;
888 int depth;
891
907typedef struct {
908 const char* delegation_id;
909 const char* target_tier;
911 const char* summary;
912 const char* patch;
913 size_t patch_len;
914 const char* const* files_touched;
917
932 const ent_delegation_request_t* req, void* user_data);
933
957 const ent_delegation_result_t* res, void* user_data);
958
984 entropic_handle_t handle,
986 ent_delegation_complete_cb on_complete,
987 void* user_data);
988
989/* ── Validation Retry Controls (v2.1.5, gh#30) ───────── */
990
1004 int attempt_n, void* user_data);
1005
1029 entropic_handle_t handle,
1030 int enabled);
1031
1049 entropic_handle_t handle);
1050
1069 entropic_handle_t handle);
1070
1088 entropic_handle_t handle,
1090 void* user_data);
1091
1092/* ── External MCP Servers (v1.8.7) ───────────────────── */
1093
1115 entropic_handle_t handle,
1116 const char* name,
1117 const char* config_json);
1118
1136 entropic_handle_t handle,
1137 const char* name);
1138
1154ENTROPIC_EXPORT char* entropic_list_mcp_servers(
1155 entropic_handle_t handle);
1156
1157/* ── Storage (v1.8.8) ────────────────────────────────── */
1158
1177 entropic_handle_t handle,
1178 const char* db_path);
1179
1193 entropic_handle_t handle);
1194
1195/* ── Identity (v1.8.9) ───────────────────────────────── */
1196
1216 entropic_handle_t handle,
1217 const char* identity_name);
1218
1239 entropic_handle_t handle,
1240 char** identity_json);
1241
1242/* ── Hooks (v1.9.1) ──────────────────────────────────── */
1243
1267 entropic_handle_t handle,
1268 entropic_hook_point_t hook_point,
1269 entropic_hook_callback_t callback,
1270 void* user_data,
1271 int priority);
1272
1290 entropic_handle_t handle,
1291 entropic_hook_point_t hook_point,
1292 entropic_hook_callback_t callback,
1293 void* user_data);
1294
1295/* ── LoRA Adapters (v1.9.2) ───────────────────────────── */
1296
1315 entropic_handle_t handle,
1316 const char* adapter_name,
1317 const char* adapter_path,
1318 const char* base_model_path,
1319 float scale);
1320
1333 entropic_handle_t handle,
1334 const char* adapter_name);
1335
1351 entropic_handle_t handle,
1352 const char* adapter_name);
1353
1364ENTROPIC_EXPORT int entropic_adapter_state(
1365 entropic_handle_t handle,
1366 const char* adapter_name);
1367
1382ENTROPIC_EXPORT char* entropic_adapter_info(
1383 entropic_handle_t handle,
1384 const char* adapter_name);
1385
1399ENTROPIC_EXPORT char* entropic_adapter_list(entropic_handle_t handle);
1400
1401/* ── Grammar Registry (v1.9.3) ───────────────────────── */
1402
1418 entropic_handle_t handle,
1419 const char* key,
1420 const char* gbnf_content);
1421
1438 entropic_handle_t handle,
1439 const char* key,
1440 const char* path);
1441
1456 entropic_handle_t handle,
1457 const char* key);
1458
1473ENTROPIC_EXPORT char* entropic_grammar_get(
1474 entropic_handle_t handle,
1475 const char* key);
1476
1493ENTROPIC_EXPORT char* entropic_grammar_validate(const char* gbnf_content);
1494
1510ENTROPIC_EXPORT char* entropic_grammar_list(entropic_handle_t handle);
1511
1512/* ── GPU Resource Profiles (v1.9.7) ──────────────────── */
1513
1530 entropic_handle_t handle,
1531 const char* profile_json);
1532
1546 entropic_handle_t handle,
1547 const char* name);
1548
1563ENTROPIC_EXPORT char* entropic_profile_get(
1564 entropic_handle_t handle,
1565 const char* name);
1566
1580ENTROPIC_EXPORT char* entropic_profile_list(entropic_handle_t handle);
1581
1582/* ── Throughput Query (v1.9.7) ───────────────────────── */
1583
1594ENTROPIC_EXPORT double entropic_throughput_tok_per_sec(
1595 entropic_handle_t handle,
1596 const char* model_path);
1597
1607ENTROPIC_EXPORT void entropic_throughput_reset(
1608 entropic_handle_t handle,
1609 const char* model_path);
1610
1611/* ── MCP Authorization (v1.9.4) ──────────────────────── */
1612
1622
1641 entropic_handle_t handle,
1642 const char* identity_name,
1643 const char* pattern,
1645
1661 entropic_handle_t handle,
1662 const char* identity_name,
1663 const char* pattern);
1664
1677ENTROPIC_EXPORT int entropic_check_mcp_key(
1678 entropic_handle_t handle,
1679 const char* identity_name,
1680 const char* tool_name,
1682
1697ENTROPIC_EXPORT char* entropic_list_mcp_keys(
1698 entropic_handle_t handle,
1699 const char* identity_name);
1700
1720 entropic_handle_t handle,
1721 const char* granter,
1722 const char* grantee,
1723 const char* pattern,
1725
1738ENTROPIC_EXPORT char* entropic_serialize_mcp_keys(
1739 entropic_handle_t handle);
1740
1757 entropic_handle_t handle,
1758 const char* json);
1759
1760/* ── Audit (v1.9.5) ──────────────────────────────────────── */
1761
1773 entropic_handle_t handle);
1774
1788 entropic_handle_t handle,
1789 size_t* count);
1790
1813 entropic_handle_t handle,
1814 const char* path,
1815 const char* filter_json,
1816 char** result_json);
1817
1818/* ── Dynamic Identity Management (v1.9.6) ────────────── */
1819
1842 entropic_handle_t handle,
1843 const char* config_json);
1844
1862 entropic_handle_t handle,
1863 const char* name,
1864 const char* config_json);
1865
1882 entropic_handle_t handle,
1883 const char* name);
1884
1899ENTROPIC_EXPORT char* entropic_get_identity_config(
1900 entropic_handle_t handle,
1901 const char* name);
1902
1916ENTROPIC_EXPORT char* entropic_list_identities(
1917 entropic_handle_t handle);
1918
1933 entropic_handle_t handle,
1934 size_t* total,
1935 size_t* dynamic);
1936
1937/* ── Compaction Hooks (v1.9.9) ───────────────────────── */
1938
1967 const char* messages_json,
1968 const char* config_json,
1969 char** out_messages,
1970 char** out_summary,
1971 void* user_data);
1972
1990ENTROPIC_EXPORT entropic_error_t entropic_compact(
1991 entropic_handle_t handle,
1992 const char* identity,
1993 char** result_json);
1994
2017 entropic_handle_t handle,
2018 const char* identity,
2019 entropic_compactor_fn compactor,
2020 void* user_data);
2021
2037 entropic_handle_t handle,
2038 const char* identity);
2039
2057 entropic_handle_t handle,
2058 entropic_compactor_fn* compactor,
2059 void** user_data);
2060
2061/* ── Log-Probability Evaluation (v1.9.10) ────────────── */
2062
2085
2113 entropic_handle_t handle,
2114 const char* model_id,
2115 const int32_t* tokens,
2116 int n_tokens,
2118
2137 entropic_handle_t handle,
2138 const char* model_id,
2139 const int32_t* tokens,
2140 int n_tokens,
2141 float* perplexity);
2142
2153ENTROPIC_EXPORT void entropic_free_logprob_result(
2155
2156/* ── Constitutional Validation (v1.9.8) ──────────────── */
2157
2173 entropic_handle_t handle,
2174 bool enabled);
2175
2190 entropic_handle_t handle,
2191 const char* identity_name,
2192 bool enabled);
2193
2211ENTROPIC_EXPORT char* entropic_validation_last_result(
2212 entropic_handle_t handle);
2213
2214/* ── Vision / Multimodal (v1.9.11) ────────────────────── */
2215
2229ENTROPIC_EXPORT int entropic_model_has_vision(
2230 entropic_handle_t handle,
2231 const char* model_id);
2232
2233/* ── Diagnose / Self-Inspection (v1.9.12) ─────────────── */
2234
2256 entropic_handle_t handle,
2257 char** prompt_out);
2258
2259#ifdef __cplusplus
2260}
2261#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_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:931
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:956
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:870
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 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:678
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:653
@ ENTROPIC_RESIDENCY_EVICTED
Tier model just unloaded to free VRAM.
Definition entropic.h:655
@ ENTROPIC_RESIDENCY_LOADED
Tier model just loaded into VRAM.
Definition entropic.h:654
@ ENTROPIC_RESIDENCY_ACTIVATION_SWAP
Active tier swapped without unload (multi-resident hit)
Definition entropic.h:656
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().
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:1966
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:181
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:1617
@ ENTROPIC_MCP_ACCESS_WRITE
Read + write operations.
Definition entropic.h:1620
@ ENTROPIC_MCP_ACCESS_NONE
No access.
Definition entropic.h:1618
@ ENTROPIC_MCP_ACCESS_READ
Read-only operations.
Definition entropic.h:1619
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:1003
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:884
const char * target_tier
Tier name (e.g. "researcher")
Definition entropic.h:886
const char * delegation_id
Short id ("d1", "d2", "pipeline")
Definition entropic.h:885
int is_pipeline
1 for pipeline stages, 0 for single
Definition entropic.h:889
const char * task
Task description text.
Definition entropic.h:887
int depth
Delegation depth (1 = top-level child)
Definition entropic.h:888
Result of a finalized delegation, delivered to the consumer.
Definition entropic.h:907
const char * patch
Unified diff (may be empty string)
Definition entropic.h:912
const char * delegation_id
Short id (matches request)
Definition entropic.h:908
size_t patch_len
Byte length of patch (excluding NUL)
Definition entropic.h:913
const char * target_tier
Tier that executed.
Definition entropic.h:909
int success
1 if child reached COMPLETE, 0 otherwise
Definition entropic.h:910
size_t files_touched_len
Count (excluding the NULL terminator)
Definition entropic.h:915
const char * summary
Final summary text from the child.
Definition entropic.h:911
const char *const * files_touched
NULL-terminated array of relpaths.
Definition entropic.h:914
Engine handle struct — owns all subsystems.
Per-token log-probability result.
Definition entropic.h:2077
float perplexity
exp(-mean(logprobs)) over the sequence.
Definition entropic.h:2080
int32_t * tokens
Input tokens echoed back (N values).
Definition entropic.h:2079
int n_logprobs
Number of logprob values (n_tokens - 1).
Definition entropic.h:2083
int n_tokens
Number of input tokens.
Definition entropic.h:2082
float * logprobs
Per-token log-probabilities (N-1 values).
Definition entropic.h:2078
float total_logprob
Sum of all logprob values.
Definition entropic.h:2081