Entropic 2.14.3
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
58#pragma once
59
60#include <stdbool.h>
61#include <stddef.h>
62#include <stdint.h>
63
64#include <entropic/entropic_config.h>
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
73/* ── Lifecycle ────────────────────────────────────────── */
74
93
137 entropic_handle_t handle,
138 const char* config_json);
139
161 entropic_handle_t handle,
162 const char* config_path);
163
194 entropic_handle_t handle,
195 const char* project_dir);
196
212ENTROPIC_EXPORT void entropic_destroy(entropic_handle_t handle);
213
214/* ── Version ──────────────────────────────────────────── */
215
229ENTROPIC_EXPORT const char* entropic_version(void);
230
249ENTROPIC_EXPORT int entropic_api_version(void);
250
273ENTROPIC_EXPORT int64_t entropic_seconds_since_last_activity(
274 entropic_handle_t handle);
275
276/* ── Memory ───────────────────────────────────────────── */
277
293ENTROPIC_EXPORT void* entropic_alloc(size_t size);
294
308ENTROPIC_EXPORT void entropic_free(void* ptr);
309
310/* ── Execution ────────────────────────────────────────── */
311
346ENTROPIC_EXPORT entropic_error_t entropic_run(
347 entropic_handle_t handle,
348 const char* input,
349 char** result_json);
350
389ENTROPIC_EXPORT entropic_error_t entropic_run_as(
390 entropic_handle_t handle,
391 const char* tier_or_identity,
392 const char* input,
393 char** result_json);
394
437 entropic_handle_t handle,
438 const char** tiers,
439 const char** prompts,
440 size_t n,
441 char** result_json);
442
478 entropic_handle_t handle,
479 const char* input,
480 void (*on_token)(const char* token, size_t len, void* user_data),
481 void* user_data,
482 int* cancel_flag);
483
532 entropic_handle_t handle,
533 const char* messages_json,
534 char** result_json);
535
565 entropic_handle_t handle,
566 const char* messages_json,
567 void (*on_token)(const char* token, size_t len, void* user_data),
568 void* user_data,
569 int* cancel_flag);
570
603 entropic_handle_t handle,
604 void (*observer)(const char* token, size_t len, void* user_data),
605 void* user_data);
606
634 entropic_handle_t handle,
635 void (*observer)(int state, void* user_data),
636 void* user_data);
637
678 entropic_handle_t handle,
679 void (*start_cb)(void* user_data),
680 void (*end_cb)(void* user_data),
681 void* user_data);
682
703
737 entropic_handle_t handle,
738 const char* session_key);
739
740/* ── Mid-generation message queue (v2.1.10, gh#40) ────── */
741
783 entropic_handle_t handle,
784 const char* message);
785
805 entropic_handle_t handle,
806 size_t* count);
807
824 entropic_handle_t handle);
825
852 entropic_handle_t handle,
853 void (*observer)(const char* consumed,
854 size_t remaining,
855 void* user_data),
856 void* user_data);
857
858/* ── Speculative decoding (v2.1.11, gh#36) ─────────────── */
859
893 entropic_handle_t handle,
894 int* compatible,
895 char** diagnostic);
896
897/* ── VRAM-aware tier residency (v2.2.4, gh#57) ────────── */
898
912
934 const char* tier_name,
935 const char* model_path,
936 size_t footprint_bytes,
937 void* user_data);
938
958 entropic_handle_t handle,
960 void* user_data);
961
1010 entropic_handle_t handle,
1011 char** out_json);
1012
1056 entropic_handle_t handle,
1057 const char* tier_name);
1058
1059/* ── Conversation Context (v2.0.1) ───────────────────── */
1060
1078 entropic_handle_t handle);
1079
1104 entropic_handle_t handle,
1105 char** messages_json);
1106
1142 entropic_handle_t handle,
1143 const char* session_key,
1144 const char* input,
1145 char** result_json);
1146
1166 entropic_handle_t handle,
1167 const char* session_key,
1168 const char* tier_or_identity,
1169 const char* input,
1170 char** result_json);
1171
1187 entropic_handle_t handle,
1188 const char* session_key,
1189 const char* input,
1190 void (*on_token)(const char* token, size_t len, void* user_data),
1191 void* user_data,
1192 int* cancel_flag);
1193
1227 entropic_handle_t handle,
1228 const char* session_key,
1229 const char* tier_or_identity,
1230 const char* input,
1231 void (*on_token)(const char* token, size_t len, void* user_data),
1232 void* user_data,
1233 int* cancel_flag);
1234
1250 entropic_handle_t handle,
1251 const char* session_key,
1252 char** messages_json);
1253
1295 entropic_handle_t handle,
1296 const char* session_key,
1297 const char* messages_json);
1298
1310 entropic_handle_t handle,
1311 const char* session_key,
1312 size_t* count);
1313
1328 entropic_handle_t handle,
1329 const char* session_key);
1330
1345 entropic_handle_t handle,
1346 const char* session_key);
1347
1362 entropic_handle_t handle,
1363 char** sessions_json);
1364
1365/* ── Named Workspaces (v2.13.0, gh#166) ───────────────── */
1366
1403 entropic_handle_t handle,
1404 const char* name,
1405 const char* dir);
1406
1434 entropic_handle_t handle,
1435 const char* session_key,
1436 const char* name);
1437
1469 entropic_handle_t handle,
1470 const char* name,
1471 const char* app_context);
1472
1488 entropic_handle_t handle,
1489 size_t* count);
1490
1516 entropic_handle_t handle,
1517 size_t* tokens_used,
1518 size_t* capacity);
1519
1550 entropic_handle_t handle,
1551 const char* tier_name,
1552 const char* path);
1553
1577 entropic_handle_t handle,
1578 const char* tier_name,
1579 const char* path);
1580
1600 entropic_handle_t handle,
1601 char** out);
1602
1603/* ── Delegation Callbacks (v2.1.5, gh#29) ──────────────── */
1604
1614typedef enum {
1615 ENT_DECISION_ACCEPT = 0,
1616 ENT_DECISION_REJECT = 1
1618
1628typedef struct {
1629 const char* delegation_id;
1630 const char* target_tier;
1631 const char* task;
1632 int depth;
1635
1651typedef struct {
1652 const char* delegation_id;
1653 const char* target_tier;
1655 const char* summary;
1656 const char* patch;
1657 size_t patch_len;
1658 const char* const* files_touched;
1661
1676 const ent_delegation_request_t* req, void* user_data);
1677
1701 const ent_delegation_result_t* res, void* user_data);
1702
1751 entropic_handle_t handle,
1752 ent_delegation_start_cb on_start,
1753 ent_delegation_complete_cb on_complete,
1754 void* user_data);
1755
1756/* ── Outside-Root Path Approval (v2.13.0) ─────────────── */
1757
1766typedef enum {
1767 ENT_PATH_ACCESS_READ = 0,
1768 ENT_PATH_ACCESS_WRITE = 1
1770
1783typedef struct {
1784 const char* path;
1785 const char* root;
1786 const char* tool;
1788 const char* session_key;
1790
1808 const ent_path_approval_request_t* req, void* user_data);
1809
1855 entropic_handle_t handle,
1857 void* user_data);
1858
1859/* ── Validation Retry Controls (v2.1.5, gh#30) ───────── */
1860
1874 int attempt_n, void* user_data);
1875
1901 entropic_handle_t handle,
1902 int enabled);
1903
1923 entropic_handle_t handle);
1924
1945 entropic_handle_t handle);
1946
1967 entropic_handle_t handle,
1969 void* user_data);
1970
1971/* ── External MCP Servers (v1.8.7) ───────────────────── */
1972
2006 entropic_handle_t handle,
2007 const char* name,
2008 const char* config_json);
2009
2029 entropic_handle_t handle,
2030 const char* name);
2031
2050ENTROPIC_EXPORT char* entropic_list_mcp_servers(
2051 entropic_handle_t handle);
2052
2053/* ── Storage (v1.8.8) ────────────────────────────────── */
2054
2075 entropic_handle_t handle,
2076 const char* db_path);
2077
2093 entropic_handle_t handle);
2094
2095/* ── Identity (v1.8.9) ───────────────────────────────── */
2096
2118 entropic_handle_t handle,
2119 const char* identity_name);
2120
2144 entropic_handle_t handle,
2145 char** identity_json);
2146
2147/* ── Hooks (v1.9.1) ──────────────────────────────────── */
2148
2174 entropic_handle_t handle,
2175 entropic_hook_point_t hook_point,
2176 entropic_hook_callback_t callback,
2177 void* user_data,
2178 int priority);
2179
2199 entropic_handle_t handle,
2200 entropic_hook_point_t hook_point,
2201 entropic_hook_callback_t callback,
2202 void* user_data);
2203
2204/* ── LoRA Adapters (v1.9.2) ───────────────────────────── */
2205
2226 entropic_handle_t handle,
2227 const char* adapter_name,
2228 const char* adapter_path,
2229 const char* base_model_path,
2230 float scale);
2231
2246 entropic_handle_t handle,
2247 const char* adapter_name);
2248
2266 entropic_handle_t handle,
2267 const char* adapter_name);
2268
2281ENTROPIC_EXPORT int entropic_adapter_state(
2282 entropic_handle_t handle,
2283 const char* adapter_name);
2284
2302ENTROPIC_EXPORT char* entropic_adapter_info(
2303 entropic_handle_t handle,
2304 const char* adapter_name);
2305
2322ENTROPIC_EXPORT char* entropic_adapter_list(entropic_handle_t handle);
2323
2324/* ── Grammar Registry (v1.9.3) ───────────────────────── */
2325
2343 entropic_handle_t handle,
2344 const char* key,
2345 const char* gbnf_content);
2346
2365 entropic_handle_t handle,
2366 const char* key,
2367 const char* path);
2368
2385 entropic_handle_t handle,
2386 const char* key);
2387
2405ENTROPIC_EXPORT char* entropic_grammar_get(
2406 entropic_handle_t handle,
2407 const char* key);
2408
2428ENTROPIC_EXPORT char* entropic_grammar_validate(const char* gbnf_content);
2429
2448ENTROPIC_EXPORT char* entropic_grammar_list(entropic_handle_t handle);
2449
2450/* ── GPU Resource Profiles (v1.9.7) ──────────────────── */
2451
2470 entropic_handle_t handle,
2471 const char* profile_json);
2472
2488 entropic_handle_t handle,
2489 const char* name);
2490
2508ENTROPIC_EXPORT char* entropic_profile_get(
2509 entropic_handle_t handle,
2510 const char* name);
2511
2528ENTROPIC_EXPORT char* entropic_profile_list(entropic_handle_t handle);
2529
2530/* ── Throughput Query (v1.9.7) ───────────────────────── */
2531
2544ENTROPIC_EXPORT double entropic_throughput_tok_per_sec(
2545 entropic_handle_t handle,
2546 const char* model_path);
2547
2559ENTROPIC_EXPORT void entropic_throughput_reset(
2560 entropic_handle_t handle,
2561 const char* model_path);
2562
2563/* ── MCP Authorization (v1.9.4) ──────────────────────── */
2564
2574
2595 entropic_handle_t handle,
2596 const char* identity_name,
2597 const char* pattern,
2599
2617 entropic_handle_t handle,
2618 const char* identity_name,
2619 const char* pattern);
2620
2635ENTROPIC_EXPORT int entropic_check_mcp_key(
2636 entropic_handle_t handle,
2637 const char* identity_name,
2638 const char* tool_name,
2640
2658ENTROPIC_EXPORT char* entropic_list_mcp_keys(
2659 entropic_handle_t handle,
2660 const char* identity_name);
2661
2683 entropic_handle_t handle,
2684 const char* granter,
2685 const char* grantee,
2686 const char* pattern,
2688
2704ENTROPIC_EXPORT char* entropic_serialize_mcp_keys(
2705 entropic_handle_t handle);
2706
2725 entropic_handle_t handle,
2726 const char* json);
2727
2728/* ── Audit (v1.9.5) ──────────────────────────────────────── */
2729
2743 entropic_handle_t handle);
2744
2760 entropic_handle_t handle,
2761 size_t* count);
2762
2788 entropic_handle_t handle,
2789 const char* path,
2790 const char* filter_json,
2791 char** result_json);
2792
2793/* ── Dynamic Identity Management (v1.9.6) ────────────── */
2794
2819 entropic_handle_t handle,
2820 const char* config_json);
2821
2841 entropic_handle_t handle,
2842 const char* name,
2843 const char* config_json);
2844
2863 entropic_handle_t handle,
2864 const char* name);
2865
2883ENTROPIC_EXPORT char* entropic_get_identity_config(
2884 entropic_handle_t handle,
2885 const char* name);
2886
2903ENTROPIC_EXPORT char* entropic_list_identities(
2904 entropic_handle_t handle);
2905
2922 entropic_handle_t handle,
2923 size_t* total,
2924 size_t* dynamic);
2925
2926/* ── Compaction Hooks (v1.9.9) ───────────────────────── */
2927
2956 const char* messages_json,
2957 const char* config_json,
2958 char** out_messages,
2959 char** out_summary,
2960 void* user_data);
2961
2982ENTROPIC_EXPORT entropic_error_t entropic_compact(
2983 entropic_handle_t handle,
2984 const char* identity,
2985 char** result_json);
2986
3011 entropic_handle_t handle,
3012 const char* identity,
3013 entropic_compactor_fn compactor,
3014 void* user_data);
3015
3033 entropic_handle_t handle,
3034 const char* identity);
3035
3055 entropic_handle_t handle,
3056 entropic_compactor_fn* compactor,
3057 void** user_data);
3058
3059/* ── Log-Probability Evaluation (v1.9.10) ────────────── */
3060
3083
3114 entropic_handle_t handle,
3115 const char* model_id,
3116 const int32_t* tokens,
3117 int n_tokens,
3119
3140 entropic_handle_t handle,
3141 const char* model_id,
3142 const int32_t* tokens,
3143 int n_tokens,
3144 float* perplexity);
3145
3158ENTROPIC_EXPORT void entropic_free_logprob_result(
3160
3161/* ── Constitutional Validation (v1.9.8) ──────────────── */
3162
3180 entropic_handle_t handle,
3181 bool enabled);
3182
3199 entropic_handle_t handle,
3200 const char* identity_name,
3201 bool enabled);
3202
3223ENTROPIC_EXPORT char* entropic_validation_last_result(
3224 entropic_handle_t handle);
3225
3226/* ── Vision / Multimodal (v1.9.11) ────────────────────── */
3227
3243ENTROPIC_EXPORT int entropic_model_has_vision(
3244 entropic_handle_t handle,
3245 const char* model_id);
3246
3247/* ── Diagnose / Self-Inspection (v1.9.12) ─────────────── */
3248
3272 entropic_handle_t handle,
3273 char** prompt_out);
3274
3275#ifdef __cplusplus
3276}
3277#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.
ENTROPIC_EXPORT entropic_error_t entropic_session_drop(entropic_handle_t handle, const char *session_key)
Forget a session entirely (gh#144).
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_run_session_as(entropic_handle_t handle, const char *session_key, const char *tier_or_identity, const char *input, char **result_json)
Run a turn on a named session under a named tier (gh#144).
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 entropic_error_t entropic_workspace_create(entropic_handle_t handle, const char *name, const char *dir)
Create a named workspace rooted at a directory (gh#166).
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_run_session_streaming_as(entropic_handle_t handle, const char *session_key, const char *tier_or_identity, const char *input, void(*on_token)(const char *token, size_t len, void *user_data), void *user_data, int *cancel_flag)
Streaming turn on a named session, under a named tier (gh#205).
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:1675
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:1700
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_interrupt_session(entropic_handle_t handle, const char *session_key)
Interrupt the run belonging to ONE session (gh#158, v2.13.0).
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:1614
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 entropic_error_t entropic_session_context_set(entropic_handle_t handle, const char *session_key, const char *messages_json)
Replace one session's conversation (gh#165, v2.13.0).
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 entropic_error_t entropic_session_list(entropic_handle_t handle, char **sessions_json)
List the sessions this handle currently holds (gh#144).
ENTROPIC_EXPORT entropic_error_t entropic_workspace_set_app_context(entropic_handle_t handle, const char *name, const char *app_context)
Give a workspace its own app_context (gh#179).
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:932
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_run_session_streaming(entropic_handle_t handle, const char *session_key, const char *input, void(*on_token)(const char *token, size_t len, void *user_data), void *user_data, int *cancel_flag)
Streaming turn on a named session (gh#144).
ent_decision_t(* ent_path_approval_cb)(const ent_path_approval_request_t *req, void *user_data)
Host decision for one outside-root filesystem access.
Definition entropic.h:1807
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_session_bind_workspace(entropic_handle_t handle, const char *session_key, const char *name)
Bind a session to a workspace (gh#166).
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_set_path_approval_callback(entropic_handle_t handle, ent_path_approval_cb cb, void *user_data)
Register the approver for filesystem access outside the root.
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_EXPORT entropic_error_t entropic_session_context_get(entropic_handle_t handle, const char *session_key, char **messages_json)
Read one session's conversation as a JSON array (gh#144).
entropic_residency_event_t
Reasons fired by entropic_residency_observer_t.
Definition entropic.h:907
@ ENTROPIC_RESIDENCY_EVICTED
Tier model just unloaded to free VRAM.
Definition entropic.h:909
@ ENTROPIC_RESIDENCY_LOADED
Tier model just loaded into VRAM.
Definition entropic.h:908
@ ENTROPIC_RESIDENCY_ACTIVATION_SWAP
Active tier swapped without unload (multi-resident hit)
Definition entropic.h:910
ent_path_access_t
What a filesystem tool is about to do with a path.
Definition entropic.h:1766
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_session_context_clear(entropic_handle_t handle, const char *session_key)
Clear one session's history, leaving other sessions intact (gh#144).
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:2955
ENTROPIC_EXPORT entropic_error_t entropic_run_session(entropic_handle_t handle, const char *session_key, const char *input, char **result_json)
Run a turn on a named session (gh#144).
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:261
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_EXPORT entropic_error_t entropic_session_context_count(entropic_handle_t handle, const char *session_key, size_t *count)
Message count for one session (gh#144).
entropic_mcp_access_level_t
Access level enum for MCP authorization.
Definition entropic.h:2569
@ ENTROPIC_MCP_ACCESS_WRITE
Read + write operations.
Definition entropic.h:2572
@ ENTROPIC_MCP_ACCESS_NONE
No access.
Definition entropic.h:2570
@ ENTROPIC_MCP_ACCESS_READ
Read-only operations.
Definition entropic.h:2571
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:1873
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 entropic_error_t entropic_release_model(entropic_handle_t handle, const char *tier_name)
Release a resident model, keeping everything else on the handle.
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:188
entropic_hook_point_t
Hook points in the engine lifecycle.
Definition hooks.h:39
std::size_t remaining
Unexamined count.
Request describing a delegation that is about to run.
Definition entropic.h:1628
const char * target_tier
Tier name (e.g. "researcher")
Definition entropic.h:1630
const char * delegation_id
Short id ("d1", "d2", "pipeline")
Definition entropic.h:1629
int is_pipeline
1 for pipeline stages, 0 for single
Definition entropic.h:1633
const char * task
Task description text.
Definition entropic.h:1631
int depth
Delegation depth (1 = top-level child)
Definition entropic.h:1632
Result of a finalized delegation, delivered to the consumer.
Definition entropic.h:1651
const char * patch
Unified diff (may be empty string)
Definition entropic.h:1656
const char * delegation_id
Short id (matches request)
Definition entropic.h:1652
size_t patch_len
Byte length of patch (excluding NUL)
Definition entropic.h:1657
const char * target_tier
Tier that executed.
Definition entropic.h:1653
int success
1 if child reached COMPLETE, 0 otherwise
Definition entropic.h:1654
size_t files_touched_len
Count (excluding the NULL terminator)
Definition entropic.h:1659
const char * summary
Final summary text from the child.
Definition entropic.h:1655
const char *const * files_touched
NULL-terminated array of relpaths.
Definition entropic.h:1658
One filesystem access OUTSIDE the project root, awaiting the host's decision.
Definition entropic.h:1783
const char * path
Canonical absolute path outside the root.
Definition entropic.h:1784
const char * session_key
Session running the call ("" = default)
Definition entropic.h:1788
const char * root
Canonical project root it lies outside.
Definition entropic.h:1785
const char * tool
Fully-qualified tool ("filesystem.write_file")
Definition entropic.h:1786
ent_path_access_t access
READ or WRITE.
Definition entropic.h:1787
Engine handle struct — owns all subsystems.
Per-token log-probability result.
Definition entropic.h:3075
float perplexity
exp(-mean(logprobs)) over the sequence.
Definition entropic.h:3078
int32_t * tokens
Input tokens echoed back (N values).
Definition entropic.h:3077
int n_logprobs
Number of logprob values (n_tokens - 1).
Definition entropic.h:3081
int n_tokens
Number of input tokens.
Definition entropic.h:3080
float * logprobs
Per-token log-probabilities (N-1 values).
Definition entropic.h:3076
float total_logprob
Sum of all logprob values.
Definition entropic.h:3079