docket-runtime API Reference
docket-runtime is the embeddable, policy-gated tool runtime shipped from the same source as
the docket CLI (see packages/docket-runtime).
It is a library a host application embeds, not a second CLI or a hosted service — see
DOCKET.md for the embedding model this
facade exists to support.
Only the names in docket_runtime.__all__ are the supported public surface; everything else
(including the docket_runtime._internal tree a wheel build generates from docket's own
core/edges modules) is private and may change without notice.
docket_runtime
The stable, embeddable Docket runtime facade.
Only the names exported here are public. The implementation remains private so embedding applications keep one supported path to Docket's policy and tool dispatch chokepoint.
Runtime
dataclass
One embedding-owned registry that always dispatches through Docket's gate.
approval_stub is intentionally a test/host seam, not a second driver:
it answers a token created by the existing approval store, then the normal
dispatch path continues to audit and execute (or deny) the call.
Source code in packages/docket-runtime/src/docket_runtime/__init__.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
Execution limits and results
docket_runtime._execution
Bounded execution state for external runtime adapters.
ExecutionLimits
dataclass
Measured token and admitted tool-call limits for one execution.
Source code in packages/docket-runtime/src/docket_runtime/_execution.py
19 20 21 22 23 24 25 26 27 28 29 30 | |
ExecutionResult
dataclass
The single immutable terminal result of a governed execution.
Source code in packages/docket-runtime/src/docket_runtime/_execution.py
33 34 35 36 37 38 39 40 41 42 43 | |
GovernedExecution
Bind reported responses to bounded, sequential tool dispatches.
Source code in packages/docket-runtime/src/docket_runtime/_execution.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
dispatch(call)
Dispatch the next exact admitted call through the runtime facade.
Source code in packages/docket-runtime/src/docket_runtime/_execution.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
finish(summary)
Finish successfully once all admitted calls have been dispatched.
Source code in packages/docket-runtime/src/docket_runtime/_execution.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
record_response(usage, tool_calls)
Accumulate measured usage and admit one complete ordered call batch.
Source code in packages/docket-runtime/src/docket_runtime/_execution.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |