Tools¶
octomate.tentacles.inkling.capabilities.ask ¶
Ask capability: the deferred ask-the-user tool.
A capability rather than a loose toolset entry so the caller decides per run whether a user exists to ask at all — an interactive run mounts it, an accomplice run simply never sees the tool.
AskCapability
dataclass
¶
Bases: AbstractCapability[None]
Offers ask_questions — the deferred ask-the-user batch.
Source code in octomate/tentacles/inkling/capabilities/ask.py
toolset
class-attribute
instance-attribute
¶
octomate.capabilities.history ¶
History capability: the thread ledger of the person a run answers.
Thread history is what people, bots and agents visibly said — ThreadMessage rows,
including the ones that did not wake this agent. The model ledger is not offered
here: it exists for audit and for rebuilding a conversation's context, not for a
model to read.
The scope is the person, not the thread: a run reads every thread the human it is
answering has spoken in, on any account the registry links to them — this thread,
their direct messages elsewhere, the chat a handoff came from. So the capability is
user-scoped, bound per run by for_profile, and no tool takes a conversation id.
The tools are methods with docstrings, as the gateway's spells are, so a runtime that reaches them some other way than pydantic-ai projects the same contracts.
HISTORY_INSTRUCTION_TEMPLATE
module-attribute
¶
HISTORY_INSTRUCTION_TEMPLATE = "## Searching history\n\nThread history is what people, bots, and agents visibly said — in this thread, and\nin every other thread the person you are answering has spoken in, on any of their\nlinked accounts. Messages that did not wake you are there too.\n\n- `{search_thread_history}` searches all of it for English terms, requiring every\n term and ranking the best lexical matches first. It accepts an optional actor\n kind. Prefer it when the user refers to what was said, here or elsewhere.\n- `{read_thread_history_before}` and `{read_thread_history_after}` page a thread\n around a search hit, or around a `#msg:<id>` handle a brief cited.\n"
HISTORY_TOOLS
module-attribute
¶
HISTORY_TOOLS: tuple[str, ...] = (
"search_thread_history",
"read_thread_history_before",
"read_thread_history_after",
)
HISTORY_INSTRUCTIONS
module-attribute
¶
HistoryCapability
dataclass
¶
Bases: AbstractCapability[Any]
Thread-history tools over the history of the person a run answers.
Mounted user-scoped: the tentacle asks for_profile for the copy bound to
that run's user and mounts that, so no tool has to ask who is asking.
Source code in octomate/capabilities/history.py
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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
toolset
class-attribute
instance-attribute
¶
for_profile
async
¶
This capability bound to one person. Everyone gets one: a visitor's history is the threads their one account has spoken in.
Source code in octomate/capabilities/history.py
anchor
async
¶
The message a paging tool is anchored on, with a refusal spoken as a retry: a handle outside this person's history is not theirs to page.
Source code in octomate/capabilities/history.py
search_thread_history
async
¶
search_thread_history(
query: str,
actor_kind: ChannelActorKind | None = None,
limit: int = 10,
) -> list[ThreadMessage]
Find visible thread messages matching every English term in query,
with related word forms matched by stemming, across every thread the person
you are answering has spoken in — this one, their direct messages, other
chats, on any of their linked accounts. Optionally restrict to an actor kind
such as "human", "agent", "bot", or "system". Best lexical match first,
newest first when scores tie. Use a hit's id to page its local context.
Source code in octomate/capabilities/history.py
read_thread_history_before
async
¶
The visible thread messages immediately preceding message_id in its
thread, oldest first. message_id is a row id or a #msg:<id> handle, as
a search hit or a brief shows it; a message outside this person's history
is refused.
Source code in octomate/capabilities/history.py
read_thread_history_after
async
¶
The visible thread messages immediately following message_id in its
thread, oldest first. message_id is a row id or a #msg:<id> handle, as
a search hit or a brief shows it; a message outside this person's history
is refused.
Source code in octomate/capabilities/history.py
get_toolset ¶
history_instructions ¶
The history instruction, each tool rendered by the caller's own naming.
Source code in octomate/capabilities/history.py
conversation_id ¶
Source code in octomate/capabilities/history.py
thread_id
async
¶
Source code in octomate/capabilities/history.py
octomate.tentacles.inkling.capabilities.tools ¶
Tool-level capabilities: reporting a failed tool call to the model instead of ending the turn.
ToolFailureCapability
dataclass
¶
Bases: AbstractCapability[None]
Report a failed tool to the model instead of ending the turn.
Pydantic AI ends a run when a tool raises anything but its own control-flow signals, so one broken call — a bad argument, a provider that blinked, a spell used out of order — costs the whole answer: the stream stops mid-way, whatever had already been drawn is abandoned, and the person is left with a trace id instead of a reply. The model is the one that can work around a failed call, and the one that can say what went wrong, so it is told.
ToolFailed rather than ModelRetry: a call that failed for reasons the
model did not cause is not a call to make again, and a retry spends a budget
that ends the run when it runs out — which is the same lost turn, one attempt
later. A failure it can read leaves it free to try another way or explain.
Runs stay bounded by Inkling's configured UsageLimits.request_limit, not by
how many times one tool may break.
Source code in octomate/tentacles/inkling/capabilities/tools.py
on_tool_execute_error
async
¶
on_tool_execute_error(
ctx: RunContext[None],
*,
call: ToolCallPart,
tool_def: ToolDefinition,
args: ValidatedToolArgs,
error: Exception,
) -> Never