Base¶
octomate.tentacles.base ¶
The tentacle base class and the console log formatting that tints each tentacle's lines.
LEVEL_STYLES
module-attribute
¶
LEVEL_STYLES: dict[int, Style] = {
logging.DEBUG: Style(dim=True),
logging.INFO: Style(color="green"),
logging.WARNING: Style(color="yellow"),
logging.ERROR: Style(color="red"),
logging.CRITICAL: Style(color="red", bold=True),
}
Tentacle
dataclass
¶
Base for external integrations managed by the Octomate host.
A tentacle is a lifecycle component, not a message dispatcher. Channel tentacles receive platform events and call Octomate.awake; agent tentacles expose pydantic-ai-style run methods.
A tentacle is an async context manager: the host enters it to start the
tentacle's long-lived resources and exits it to tear them down. The base
implementation is a no-op; subclasses override __aenter__/__aexit__.
Source code in octomate/tentacles/base.py
log_color
class-attribute
instance-attribute
¶
log_names
property
¶
Logger-name prefixes whose records belong to this tentacle — its own module tree by default. Channels with a chatty SDK extend this to claim the SDK's loggers too, so those lines share the tentacle's color.
routers ¶
FastAPI routers the host mounts when this tentacle is connected — empty by default. A tentacle that exposes an HTTP surface (e.g. an inbound hook endpoint) overrides this. Mounting happens at connect time, off the tentacle's async lifecycle: the routes are owned by the Octomate app, not the tentacle.
Source code in octomate/tentacles/base.py
TentacleLogFormatter ¶
Bases: Formatter
Renders LEVEL timestamp [logger] message — the level tinted by
severity and the [logger] header tinted with the color the host dispatched
to the owning tentacle. colorize is off for non-TTY streams so redirected
logs stay plain. Lives with the tentacle base since it renders tentacle
identity; the host resolves each logger to its tentacle via log_tag.
Source code in octomate/tentacles/base.py
formatMessage ¶
Source code in octomate/tentacles/base.py
TentacleLogHandler ¶
Bases: RichHandler
Preserve tentacle ANSI colors while Rich renders each exception once.
Source code in octomate/tentacles/base.py
octomate.tentacles.agent ¶
The agent tentacle base: pydantic-ai-style run entrypoints, subagent runs, and the session bookkeeping every runtime shares.
AgentTentacle ¶
Bases: Tentacle[AgentOutputT, AgentDepsT], ABC
Base class for Octomate agents wrapping pydantic-ai run entrypoints.
Source code in octomate/tentacles/agent.py
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 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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |
description
class-attribute
instance-attribute
¶
claims
class-attribute
instance-attribute
¶
driven_sessions
cached
property
¶
Live runs holding each external runtime session on this agent.
native_sessions
cached
property
¶
Accepted native transcript streams currently attached to this agent.
run_tasks
cached
property
¶
Collectors registered by agent harnesses that opt into observe_run.
Created on first access. Participating harnesses drain these tasks during shutdown; other harnesses do not need this registry.
routes
cached
property
¶
Every served model, using discovered or configured routing metadata.
default_model
cached
property
¶
Configured first model, replaced by discovery with the harness's default.
permission_modes
class-attribute
instance-attribute
¶
default_permission_mode
property
¶
The posture this agent's conversations run under when they declare none — its configured default, in its own vocabulary.
A row's NULL is not "no posture", it is "nothing said here"; this is what decides instead, and it is what the console reports for such a row rather than showing a blank. None only for an agent that answers to no posture at all.
supports_session_fork
property
¶
Whether this harness implements independent runtime session creation.
observe_run
async
¶
observe_run(
events: AsyncGenerator[
ReactStreamEvent[RunOutputDataT], None
],
) -> AsyncGenerator[ReactStreamEvent[RunOutputDataT], None]
Collect a run to completion even when its observer closes or cancels.
Agent harnesses opt in by wrapping their event generators with this
method and draining run_tasks during shutdown. Inheriting it alone
does not change a harness's lifecycle.
Joining before leaving keeps the caller's gateway and other enclosing resources available to the agent until its final notifications are recorded.
Source code in octomate/tentacles/agent.py
driving
async
¶
Count a driven runtime session or an accepted native stream.
Driven runs hold the count through cleanup, including interruption or cancellation. Native streams hold it from their accepted handshake through stream cleanup.
Source code in octomate/tentacles/agent.py
build_routes ¶
resolve_model ¶
Resolve a default, exact model or unambiguous provider-less name.
Source code in octomate/tentacles/agent.py
served_model ¶
The catalog entry a stored model name means: the entry itself, or, for a name saved without its provider, the one entry it can be. None when this agent serves no such model.
Source code in octomate/tentacles/agent.py
check_permission_mode ¶
Reject selections absent from this tentacle's current catalog.
Source code in octomate/tentacles/agent.py
check_effort ¶
Reject a level the route for model does not claim.
Source code in octomate/tentacles/agent.py
resolve_effort
async
¶
resolve_effort(
conversation: Conversation,
*,
model: AgentRouteModelName | None,
effort: str | None = None,
) -> str | None
Validate the run's override or stored effort against its selected model.
With no explicit model, use the conversation's last reported model, then the harness's catalog default for a conversation that has not run yet.
Source code in octomate/tentacles/agent.py
set_permission_mode
async
¶
Validate and save a selection, updating a live runtime when supported.
None restores the configured default. Native update failures propagate before the selection is saved. Runtimes without live updates read the saved selection on their next run; existing approvals remain separate.
Source code in octomate/tentacles/agent.py
apply_permission_mode
async
¶
Update an active native runtime when it supports permission changes.
The default leaves in-flight work alone. Codex applies both permission axes at the next turn start; Inkling reads storage at each deferral.
Source code in octomate/tentacles/agent.py
discover_models
async
¶
Refresh models and claims once the harness connection is ready.
Harnesses call this during entry and install results with set_model_catalog. Agents with config-supplied catalogs keep their existing models and claims.
Source code in octomate/tentacles/agent.py
discover_commands
async
¶
discover_commands(
context: CommandContext,
*,
refresh: bool = False,
prefix: str = "",
) -> CommandCatalog
Read this agent's cached catalog for an already authorized context.
Callers resolve and authorize context before every lookup, including cache
hits. Prefix matching filters a copy by command name; it does not imply
argument-value completion. Runtime adapters implement probe_commands.
Source code in octomate/tentacles/agent.py
probe_commands
async
¶
Read runtime entries in the supplied user/session/workspace context.
Discovery must not send a model prompt or create a visible turn. If a runtime needs a session before it can discover entries, report unavailable and explain that prerequisite; do not silently create one. Adapters with no discovery API retain this explicit unsupported result.
Source code in octomate/tentacles/agent.py
execute_command
async
¶
execute_command(
context: CommandContext,
invocation: CommandInvocation,
*,
deferred_suspender: DeferredSuspender | None = None,
capabilities: Sequence[AgentCapability[AgentDepsT]]
| None = None,
) -> AsyncGenerator[
CommandOutcome | ReactStreamEvent[AgentOutputT], None
]
Invoke a revalidated runtime entry without passing through chat triage.
Direct controls yield one CommandOutcome without invoking run. Entries
that run the agent yield the same events as run_stream_events, ending
with an AgentRunResultEvent. Consuming this generator drives one native
invocation; closing it must release that invocation's resources. The
caller must close it even when abandoning the stream and hold the
conversation's active-turn guard through cleanup. Forward the suspender
and capabilities for agent runs; direct controls do not consume them.
Resolve the opaque invocation id using this tentacle's current catalog. Execution behavior belongs to the invocation, not a fixed descriptor tag: a command may return a control result or run the agent depending on input. If its descriptor permits execution without a conversation, it must yield only a direct outcome in that context, without creating a session or run.
Preserve invocation arguments verbatim. Never turn an unsupported or unknown invocation into a normal model prompt. Authorization, current catalog validation and delivery deduplication belong to the host caller; these adapter hooks do not establish any of them.
Source code in octomate/tentacles/agent.py
set_model_catalog ¶
user_capabilities
async
¶
Build capabilities whose credentials belong to this run's user.
resumed_prompt ¶
What a resumed run opens with, for a runtime that takes no tool result back: what the graph resolved the deferral with, spoken as its next prompt — the sentence of a deferral the graph performed itself, or a person's answers and verdicts on a batch they came back to.
Source code in octomate/tentacles/agent.py
fork
async
¶
fork(
source: Conversation,
destination: ThreadKey,
*,
sender: UserProfile,
model: AgentRouteModelName | None = None,
) -> Thread
Fork owned native or driven history onto an independent surface.
Native imports use fork_transcript. Driven forks use fork_session and
copy the history, settings and project workspace, retaining the source
session. The caller opens the destination and holds the runtime's turn
guard while forking a driven conversation.
Source code in octomate/tentacles/agent.py
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | |
validate_fork
async
¶
Refuse unusable native history before a destination is created, including a session last run on a model this agent does not serve.
Source code in octomate/tentacles/agent.py
read_fork_transcript
async
¶
An owner's uploaded native history up to its latest whole turn, and that turn — what a fork of it carries.
Source code in octomate/tentacles/agent.py
fork_transcript
async
¶
fork_transcript(
source: Conversation,
target: Conversation,
*,
owner_id: UUID7,
cwd: Path,
) -> Conversation
Import an owner's native history into the empty target, as a session
this runtime resumes in cwd.
Source code in octomate/tentacles/agent.py
fork_session
async
¶
Fork the runtime session, or stop if this agent cannot fork safely.
Source code in octomate/tentacles/agent.py
relocate
async
¶
Relocate the runtime session behind conversation to cwd, where its next
run resumes. The graph's call, made once a teleport has settled where the
agent lands; the tentacle only knows how to move one.
Nothing to move for a runtime that resumes a session from anywhere. Claude files one under the directory it ran in, and every teleport changes that directory — a new thread's workspace, or the project's — so a driven Claude session needs this on each. A native session's transcript is on its own machine, so a native teleport has nothing here to move: bringing it over is a rebuild from the ledger, still to come, and this is where it lands.
Source code in octomate/tentacles/agent.py
run_project
async
¶
The project a run in this thread is in, or None when it is in none.
The thread is where a project is bound, and every conversation belongs to
one, so this is the whole of "which project is this run in" — asked of the
thread each run rather than copied onto the conversation. Reading the
thread is what this adds; judging what it names is the registry's, and is
ProjectManager.of.
Source code in octomate/tentacles/agent.py
run
abstractmethod
async
¶
run(
user_prompt: str | Sequence[UserContent] | None = None,
*,
conversation_address: ChannelAddress,
thread_id: UUID7 | None = None,
source_thread_address: ChannelAddress | None = None,
source_thread_message_ids: Sequence[UUID7]
| None = None,
run_name: str | None = None,
output_type: None = None,
deferred_tool_results: DeferredToolResults
| None = None,
deferred_suspender: DeferredSuspender | None = None,
model: Model | KnownModelName | str | None = None,
effort: str | None = None,
conversation_id: UUID7 | None = None,
interactive: bool = True,
instructions: AgentInstructions[AgentDepsT] = None,
deps: AgentDepsT = None,
model_settings: AgentModelSettings[AgentDepsT]
| None = None,
usage_limits: UsageLimits | None = None,
usage: RunUsage | None = None,
metadata: AgentMetadata[AgentDepsT] | None = None,
output_retries: int | None = None,
infer_name: bool = True,
toolsets: Sequence[AbstractToolset[AgentDepsT]]
| None = None,
builtin_tools: Sequence[AgentNativeTool[AgentDepsT]]
| None = None,
event_stream_handler: EventStreamHandler[AgentDepsT]
| None = None,
capabilities: Sequence[AgentCapability[AgentDepsT]]
| None = None,
spec: AgentSpecInput | None = None,
) -> AgentRunResult[AgentOutputT]
run(
user_prompt: str | Sequence[UserContent] | None = None,
*,
conversation_address: ChannelAddress,
thread_id: UUID7 | None = None,
source_thread_address: ChannelAddress | None = None,
source_thread_message_ids: Sequence[UUID7]
| None = None,
run_name: str | None = None,
output_type: OutputSpec[RunOutputDataT],
deferred_tool_results: DeferredToolResults
| None = None,
deferred_suspender: DeferredSuspender | None = None,
model: Model | KnownModelName | str | None = None,
effort: str | None = None,
conversation_id: UUID7 | None = None,
interactive: bool = True,
instructions: AgentInstructions[AgentDepsT] = None,
deps: AgentDepsT = None,
model_settings: AgentModelSettings[AgentDepsT]
| None = None,
usage_limits: UsageLimits | None = None,
usage: RunUsage | None = None,
metadata: AgentMetadata[AgentDepsT] | None = None,
output_retries: int | None = None,
infer_name: bool = True,
toolsets: Sequence[AbstractToolset[AgentDepsT]]
| None = None,
builtin_tools: Sequence[AgentNativeTool[AgentDepsT]]
| None = None,
event_stream_handler: EventStreamHandler[AgentDepsT]
| None = None,
capabilities: Sequence[AgentCapability[AgentDepsT]]
| None = None,
spec: AgentSpecInput | None = None,
) -> AgentRunResult[RunOutputDataT]
run(
user_prompt: str | Sequence[UserContent] | None = None,
*,
conversation_address: ChannelAddress,
thread_id: UUID7 | None = None,
source_thread_address: ChannelAddress | None = None,
source_thread_message_ids: Sequence[UUID7]
| None = None,
run_name: str | None = None,
output_type: OutputSpec[RunOutputDataT] | None = None,
deferred_tool_results: DeferredToolResults
| None = None,
deferred_suspender: DeferredSuspender | None = None,
model: Model | KnownModelName | str | None = None,
effort: str | None = None,
conversation_id: UUID7 | None = None,
interactive: bool = True,
instructions: AgentInstructions[AgentDepsT] = None,
deps: AgentDepsT = None,
model_settings: AgentModelSettings[AgentDepsT]
| None = None,
usage_limits: UsageLimits | None = None,
usage: RunUsage | None = None,
metadata: AgentMetadata[AgentDepsT] | None = None,
output_retries: int | None = None,
infer_name: bool = True,
toolsets: Sequence[AbstractToolset[AgentDepsT]]
| None = None,
builtin_tools: Sequence[AgentNativeTool[AgentDepsT]]
| None = None,
event_stream_handler: EventStreamHandler[AgentDepsT]
| None = None,
capabilities: Sequence[AgentCapability[AgentDepsT]]
| None = None,
spec: AgentSpecInput | None = None,
) -> AgentRunResult[AgentOutputT | RunOutputDataT]
Run the agent for an Octomate conversation.
Source code in octomate/tentacles/agent.py
subagent_run
async
¶
subagent_run(
user_prompt: str,
*,
conversation_address: ChannelAddress,
thread_id: UUID7,
conversation_id: UUID7,
run_name: str | None = None,
model: Model | KnownModelName | str | None = None,
effort: str | None = None,
instructions: str | None = None,
capabilities: Sequence[AgentCapability[None]]
| None = None,
) -> AgentRunResult[AgentOutputT]
Run as a subagent: the subagent contract in one place, apart from
run()'s general surface.
A subagent run is addressed at a pre-ensured conversation its spawner
owns (conversation_id is required, not optional), and it is fully
non-interactive — every human interaction declines at once. What
capabilities mounts is the runtime's to decide: inkling adds the
spawner's set to its own, claude reads it only for a GatewayCapability,
and codex ignores it. The spawner passes its framing as instructions
and stamps the run tree after the report returns.
Source code in octomate/tentacles/agent.py
run_stream_events
abstractmethod
¶
run_stream_events(
user_prompt: str | Sequence[UserContent] | None = None,
*,
conversation_address: ChannelAddress,
thread_id: UUID7 | None = None,
source_thread_address: ChannelAddress | None = None,
source_thread_message_ids: Sequence[UUID7]
| None = None,
run_name: str | None = None,
output_type: None = None,
deferred_tool_results: DeferredToolResults
| None = None,
deferred_suspender: DeferredSuspender | None = None,
model: Model | KnownModelName | str | None = None,
effort: str | None = None,
conversation_id: UUID7 | None = None,
interactive: bool = True,
instructions: AgentInstructions[AgentDepsT] = None,
deps: AgentDepsT = None,
model_settings: AgentModelSettings[AgentDepsT]
| None = None,
usage_limits: UsageLimits | None = None,
usage: RunUsage | None = None,
metadata: AgentMetadata[AgentDepsT] | None = None,
output_retries: int | None = None,
infer_name: bool = True,
toolsets: Sequence[AbstractToolset[AgentDepsT]]
| None = None,
builtin_tools: Sequence[AgentNativeTool[AgentDepsT]]
| None = None,
capabilities: Sequence[AgentCapability[AgentDepsT]]
| None = None,
spec: AgentSpecInput | None = None,
) -> ReactEventStream[AgentOutputT]
run_stream_events(
user_prompt: str | Sequence[UserContent] | None = None,
*,
conversation_address: ChannelAddress,
thread_id: UUID7 | None = None,
source_thread_address: ChannelAddress | None = None,
source_thread_message_ids: Sequence[UUID7]
| None = None,
run_name: str | None = None,
output_type: OutputSpec[RunOutputDataT],
deferred_tool_results: DeferredToolResults
| None = None,
deferred_suspender: DeferredSuspender | None = None,
model: Model | KnownModelName | str | None = None,
effort: str | None = None,
conversation_id: UUID7 | None = None,
interactive: bool = True,
instructions: AgentInstructions[AgentDepsT] = None,
deps: AgentDepsT = None,
model_settings: AgentModelSettings[AgentDepsT]
| None = None,
usage_limits: UsageLimits | None = None,
usage: RunUsage | None = None,
metadata: AgentMetadata[AgentDepsT] | None = None,
output_retries: int | None = None,
infer_name: bool = True,
toolsets: Sequence[AbstractToolset[AgentDepsT]]
| None = None,
builtin_tools: Sequence[AgentNativeTool[AgentDepsT]]
| None = None,
capabilities: Sequence[AgentCapability[AgentDepsT]]
| None = None,
spec: AgentSpecInput | None = None,
) -> ReactEventStream[RunOutputDataT]
run_stream_events(
user_prompt: str | Sequence[UserContent] | None = None,
*,
conversation_address: ChannelAddress,
thread_id: UUID7 | None = None,
source_thread_address: ChannelAddress | None = None,
source_thread_message_ids: Sequence[UUID7]
| None = None,
run_name: str | None = None,
output_type: OutputSpec[RunOutputDataT] | None = None,
deferred_tool_results: DeferredToolResults
| None = None,
deferred_suspender: DeferredSuspender | None = None,
model: Model | KnownModelName | str | None = None,
effort: str | None = None,
conversation_id: UUID7 | None = None,
interactive: bool = True,
instructions: AgentInstructions[AgentDepsT] = None,
deps: AgentDepsT = None,
model_settings: AgentModelSettings[AgentDepsT]
| None = None,
usage_limits: UsageLimits | None = None,
usage: RunUsage | None = None,
metadata: AgentMetadata[AgentDepsT] | None = None,
output_retries: int | None = None,
infer_name: bool = True,
toolsets: Sequence[AbstractToolset[AgentDepsT]]
| None = None,
builtin_tools: Sequence[AgentNativeTool[AgentDepsT]]
| None = None,
capabilities: Sequence[AgentCapability[AgentDepsT]]
| None = None,
spec: AgentSpecInput | None = None,
) -> ReactEventStream[AgentOutputT | RunOutputDataT]
Stream raw agent events for an Octomate conversation.
Source code in octomate/tentacles/agent.py
octomate.tentacles.channel ¶
Shared channel primitives.
Type variables: - RawT: native inbound platform payload accepted by a channel and its chromo. - MessageT: native outbound platform message payload built and sent by an ink.
ChannelSurfaces
dataclass
¶
Which places this channel can open, as opposed to how it routes them.
thread_strategy says how an inbound threaded message is routed; these say what
the platform can be asked to create. They are separate because a channel can want
thread routing without having threads: the dev UI declares flat_thread to skip
triage and can open nothing.
Declared per channel class rather than probed — a spell has to know before it runs, and asking the platform every turn would spend a round-trip to answer a constant.
Source code in octomate/tentacles/channel.py
DownloadedImage
dataclass
¶
An inbound image an ink fetched from the platform: its bytes and file name, with the content type and source URL when known.
Source code in octomate/tentacles/channel.py
Chromo ¶
Bases: ABC
Two-way translation between platform-native wire data and core schemas.
sip converts inbound payloads to a MessageEvent; outbound_markdown
converts an outbound markdown reply to platform-native message payloads.
Translation only — the actual send/receive is the ink's job.
Source code in octomate/tentacles/channel.py
sip
abstractmethod
async
¶
outbound_markdown
abstractmethod
¶
outbound_segments
async
¶
Encode output segments as platform-native outbound message payloads. The
default flattens them to a single markdown body via their str form;
channels with native transport override to ship media inline or to encode a
mention token a user actually gets pinged by.
Source code in octomate/tentacles/channel.py
Ink ¶
Bases: ABC
Base class for platform API clients (transport only).
An ink is an async context manager: the owning tentacle enters it as part
of its own lifecycle. The base implementation holds no resources; inks
whose platform calls can share a pooled connection override
__aenter__/__aexit__ to open and close it.
Source code in octomate/tentacles/channel.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
inspect
abstractmethod
async
¶
get_user_profile
abstractmethod
async
¶
get_group_name
async
¶
upload_media
abstractmethod
async
¶
download_image
abstractmethod
async
¶
send_message
abstractmethod
async
¶
send_message(
chat_id: str,
chat_type: str,
messages: list[MessageT],
*,
channel_thread_id: str,
reply_to: str | None = None,
reply_in_thread: bool = False,
) -> IMMessageID | None
Send platform-native message payloads to a conversation destination.
channel_thread_id is the platform's external destination id: the thread
id on a thread surface, otherwise the chat id. reply_to references a
message within that destination. Platforms where thread and reply are the
same native field collapse them in their ink implementation.
Source code in octomate/tentacles/channel.py
suggest_addresses
async
¶
suggest_addresses(
address: ChannelAddress,
source_address: ChannelAddress | None = None,
) -> list[ChannelAddress]
Suggest thread parents for this identity, without creating or posting.
list_addresses
async
¶
list_addresses(
address: ChannelAddress,
inside: str | None = None,
*,
private: bool = False,
) -> list[ChannelAddress]
One level of this identity's places, fetched when it is opened: the top
level, or what a listed address's inside holds. Nothing is created. A
private landing is listed as the platform would open it for a
conversation only its user can read.
Source code in octomate/tentacles/channel.py
prepare_address
async
¶
prepare_address(
address: ChannelAddress,
source_address: ChannelAddress | None = None,
*,
private: bool = False,
) -> ChannelAddress
Validate one parent and resolve platform details without creating a thread.
Source code in octomate/tentacles/channel.py
open_dm
async
¶
The chat id of this bot's 1:1 with user_id, opening it if needed.
None when the platform offers nowhere private to reach them — no DM
surface at all, or an open that failed. Both leave a caller that needs
privacy with no answer, which is the only distinction it can act on.
Opening is idempotent wherever it is a call at all.
opener is the first thing the person will read there, for a platform that
cannot open a private chat without saying something. None from a caller
with nothing to say — and ignored by every platform that opens one silently.
Source code in octomate/tentacles/channel.py
ChannelTentacle ¶
Bases: Tentacle[RawT, MessageT]
Base class for IM channels.
A channel receives native platform events, converts them to MessageEvents, and asks Octomate to dispatch the turn to the assigned agent. Outbound messages are encoded by Chromo and sent by the configured ink implementation.
Source code in octomate/tentacles/channel.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | |
feelers
instance-attribute
¶
feelers: Feelers = Feelers(
markdown=markdown_feeler,
timeline=DefaultTimelineFeeler[RawT, MessageT](
ink=self.ink,
chromo=self.chromo,
ask_questions=questions_feeler,
approvals=approvals_feeler,
oauth=oauth_feeler,
deferred_actions=self.octomate.deferred_actions,
),
segments=segments_feeler,
approvals=approvals_feeler,
ask_questions=questions_feeler,
oauth=oauth_feeler,
artifacts=PlainTextArtifactFeeler(
artifacts=self.octomate.artifacts,
users=self.octomate.users,
segments=segments_feeler,
),
)
landing_unavailable
property
¶
Why no conversation can be moved or handed onto this channel, or None where a thread can be opened for one.
probe
async
¶
Resolve the channel's own identity from the platform. Awaited by the
host before the channel is served, so self.self_profile is set before any
inbound event is ingested.
Source code in octomate/tentacles/channel.py
ingest
async
¶
Inbound pipeline: decode, enrich sender, resolve media, dispatch.
Before ensuring a group surface, refresh its title from the event's chat name, or ask the ink when the event supplies no name. DM surfaces use the bot's name from its inspected profile.
Source code in octomate/tentacles/channel.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
open_dm
async
¶
The 1:1 conversation with user_id, opening it if the platform needs to.
None when this channel has nowhere private to reach them; a channel opts
in by declaring surfaces.direct_message and giving its ink an open_dm.
The returned address may already carry a history, which is why a teleport
there lands in a fresh thread or stays put rather than forking onto it.
opener is the first thing the person will read there, passed by a caller
that is about to move a whole turn in — and empty from one that only wants
somewhere to deliver a message. A channel that can only be run inside a
thread starts one from it; most have nothing to do with it, since the
conversation they hand back can be posted to as it is.
Source code in octomate/tentacles/channel.py
thread_user_id ¶
The linked identity whose thread locations this channel may expose.
is_shared ¶
Whether anyone besides its user can read this surface, told from the address alone, for a caller that holds a thread's row and no message from it. A thread is taken for shared unless its channel can say otherwise. It answers what the chromo says of a message on the same surface; each channel's chromo tests hold the two to that.
Source code in octomate/tentacles/channel.py
suggest_addresses
async
¶
suggest_addresses(
profile: UserProfile,
source_address: ChannelAddress | None = None,
) -> list[ChannelAddress]
Suggest addresses using the requesting user's linked channel identity.
Source code in octomate/tentacles/channel.py
list_addresses
async
¶
list_addresses(
profile: UserProfile,
inside: str | None = None,
*,
private: bool = False,
) -> list[ChannelAddress]
List one level using the requesting user's linked channel identity, as a
landing would open for a conversation that is private.
Source code in octomate/tentacles/channel.py
prepare_address
async
¶
prepare_address(
address: ChannelAddress,
source_address: ChannelAddress | None = None,
*,
private: bool = False,
) -> ChannelAddress
Validate the requested parent before any thread or history is created.
A private conversation's landing opens so only its user can read it,
where the platform allows, and the prepared shared says which it got.
Source code in octomate/tentacles/channel.py
start_thread
async
¶
Open an isolated destination, refusing to reuse an existing chat.
Source code in octomate/tentacles/channel.py
accepts_sub_thread ¶
Whether the address belongs to this channel and can contain a new thread.
Source code in octomate/tentacles/channel.py
start_sub_thread
async
¶
Source code in octomate/tentacles/channel.py
get_user_profile
async
¶
Source code in octomate/tentacles/channel.py
submerge
async
¶
Source code in octomate/tentacles/channel.py
absorb
async
¶
Download one inbound image to save_dir and rewrite seg.data.file.
Source code in octomate/tentacles/channel.py
build_channel ¶
Compose one configured channel into its tentacle.
The one place a type: becomes a platform, mirroring build_mcp. The
configured key is the tentacle id throughout, which is what lets one platform be
mounted more than once — two Lark apps are two keys, and nothing below here
learns that they share a class.
Imported inside the function because each platform module pulls in its vendor SDK, and importing this package must not cost all four.
Source code in octomate/tentacles/channel.py
octomate.tentacles.mcp ¶
Configured MCP declarations from which users create their own MCPs.
McpTentacle
dataclass
¶
Bases: Tentacle
Connection settings and tool instructions offered for installation.
Source code in octomate/tentacles/mcp.py
OAuthMcpTentacle
dataclass
¶
BareMcpTentacle ¶
Bases: McpTentacle
An MCP offered with an optional operator bearer token.
Source code in octomate/tentacles/mcp.py
build_mcp ¶
Build a tentacle and register any configured OAuth application.
Source code in octomate/tentacles/mcp.py
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 154 155 156 157 158 159 160 161 162 163 164 | |
Codex status¶
octomate.tentacles.codex.base.CodexTentacle.token_usage_status
async
¶
Render the latest recorded native usage snapshot for this Codex session.
Native totals count all requests, including tool loops. The last request and context capacity are separate from those cumulative totals. Copied events from another native session do not describe this session's usage.
Source code in octomate/tentacles/codex/base.py
octomate.tentacles.codex.ink.CodexInk.account_status
async
¶
Read ChatGPT quota windows without creating a thread or refreshing auth.
Each bucket reports its own remaining percentage and UTC reset time. Other authentication modes have no ChatGPT quota; RPC failures propagate. The SDK leaves the multi-bucket map untyped, so validate it before use.