ACP¶
octomate.tentacles.acp.channel ¶
The inbound ACP channel and its connection ownership.
AcpChannelTentacle
dataclass
¶
Bases: Tentacle[None, None]
Expose the ACP API and track attached public sessions.
The Octomate host mounts the router at connect time. Each broker dispatches kicks and reads the nerve for its WebSocket connection, so this API channel uses the base tentacle lifecycle rather than the IM channel's ink and siphon.
Source code in octomate/tentacles/acp/channel.py
octomate.tentacles.acp.base ¶
Run outbound ACP providers through the agent interface.
AcpAgentTentacle ¶
Bases: AgentTentacle[str, None]
Execute turns through an installed ACP harness.
Outbound runs use the thread and conversation supplied by the reflex, with the provider session ID stored on that conversation. Each turn holds its managed workspace, provider connection, and MCP credentials until the provider has stopped.
Startup discovers models and their reasoning levels from an unprompted session, selecting each model to read its current thought_level choices. Real sessions validate the chosen model and effort again before submitting their prompt.
Source code in octomate/tentacles/acp/base.py
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 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | |
provider_permission_mode
class-attribute
instance-attribute
¶
run
async
¶
run(
user_prompt: str | Sequence[UserContent] | None = None,
*,
conversation_address: ChannelAddress,
invocation: Invocation,
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,
interactive: bool = True,
instructions: AgentInstructions[None] = None,
deps: None = None,
model_settings: AgentModelSettings[None] | None = None,
usage_limits: UsageLimits | None = None,
metadata: AgentMetadata[None] | None = None,
output_retries: int | None = None,
infer_name: bool = True,
toolsets: Sequence[AbstractToolset[None]] | None = None,
builtin_tools: Sequence[AgentNativeTool[None]]
| None = None,
event_stream_handler: EventStreamHandler[None]
| None = None,
capabilities: Sequence[AgentCapability[None]]
| None = None,
spec: AgentSpecInput | None = None,
) -> AgentRunResult[str | RunOutputDataT]
Collect the same agent stream used by the reflex.
Source code in octomate/tentacles/acp/base.py
run_stream_events ¶
run_stream_events(
user_prompt: str | Sequence[UserContent] | None = None,
*,
conversation_address: ChannelAddress,
invocation: Invocation,
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,
interactive: bool = True,
instructions: AgentInstructions[None] = None,
deps: None = None,
model_settings: AgentModelSettings[None] | None = None,
usage_limits: UsageLimits | None = None,
metadata: AgentMetadata[None] | None = None,
output_retries: int | None = None,
infer_name: bool = True,
toolsets: Sequence[AbstractToolset[None]] | None = None,
builtin_tools: Sequence[AgentNativeTool[None]]
| None = None,
capabilities: Sequence[AgentCapability[None]]
| None = None,
spec: AgentSpecInput | None = None,
) -> ReactEventStream[str | RunOutputDataT]
Run the supplied prompt in this agent's conversation and workspace.
Source code in octomate/tentacles/acp/base.py
stream
async
¶
stream(
user_prompt: str | Sequence[UserContent] | None,
address: ChannelAddress,
invocation: Invocation,
source_address: ChannelAddress | None,
source_message_ids: Sequence[UUID7] | None,
run_name: str | None,
suspender: DeferredSuspender | None,
model: str | None,
effort: str | None,
) -> AsyncGenerator[ReactStreamEvent[str]]
Source code in octomate/tentacles/acp/base.py
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 | |
permission
async
¶
permission(
request: RequestPermissionRequest,
suspender: DeferredSuspender | None,
updates: Queue[
StreamEvent
| ActionBatchEvent
| ActionBatchAnsweredEvent
| None
],
) -> schema.RequestPermissionResponse
Route provider approvals through the existing live deferred-action flow.
Source code in octomate/tentacles/acp/base.py
elicit
async
¶
elicit(
request: CreateFormSessionElicitationRequest,
suspender: DeferredSuspender | None,
updates: Queue[
StreamEvent
| ActionBatchEvent
| ActionBatchAnsweredEvent
| None
],
) -> schema.CreateElicitationResponse
Answer a negotiated form on its live ACP request, preserving field types.
Source code in octomate/tentacles/acp/base.py
await_human
async
¶
await_human(
requests: DeferredToolRequests,
suspender: DeferredSuspender,
updates: Queue[
StreamEvent
| ActionBatchEvent
| ActionBatchAnsweredEvent
| None
],
*,
form: AcpForm | None = None,
) -> DeferredActionBatch | None
Collect partial card replies without ending the provider's live request.
Timeout or transport cancellation expires the batch so a late reply cannot be delivered to another request. Forms keep draft answers editable until an explicit submission passes validation.
Source code in octomate/tentacles/acp/base.py
review_response
async
¶
review_response(
batch: DeferredActionBatch,
response: DeferredActionBatchResponse,
form: AcpForm | None,
updates: Queue[
StreamEvent
| ActionBatchEvent
| ActionBatchAnsweredEvent
| None
],
) -> bool
Settle permission replies; keep form drafts open until a valid submission.
Source code in octomate/tentacles/acp/base.py
mcp_servers
async
¶
mcp_servers(
client: NativeAcpClient,
user_id: UUID7,
conversation_id: UUID7,
*,
habitat: Habitat,
) -> AsyncGenerator[list[schema.HttpMcpServer]]
Supply remote Octomate MCP with the caller's shared runtime API key.
Source code in octomate/tentacles/acp/base.py
invoke
async
¶
invoke(
client: NativeAcpClient,
invocation: Invocation,
request: PromptRequest,
address: ChannelAddress,
sender: UserProfile,
source_address: ChannelAddress | None,
source_message_ids: Sequence[UUID7] | None,
run_name: str | None,
updates: Queue[
StreamEvent
| ActionBatchEvent
| ActionBatchAnsweredEvent
| None
],
model: str | None,
) -> AsyncGenerator[ReactStreamEvent[str]]
Source code in octomate/tentacles/acp/base.py
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 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | |
record
async
¶
record(
invocation: Invocation,
history: AcpHistory,
run_id: str,
address: ChannelAddress,
sender: UserProfile,
source_address: ChannelAddress | None,
source_message_ids: Sequence[UUID7] | None,
run_name: str | None,
updates: Queue[
StreamEvent
| ActionBatchEvent
| ActionBatchAnsweredEvent
| None
],
model: str | None,
*,
failed: bool,
) -> None
Bind existing inbound messages and preserve partial replies on failure.
Source code in octomate/tentacles/acp/base.py
octomate.tentacles.acp.ink ¶
octomate.tentacles.acp.broker ¶
One ACP agent over Octomate's registered model routes.
Public session IDs are thread UUIDs. Model option values identify a registered agent and catalog model; provider session IDs remain on their conversations. Sessions are private to their creating account, including before their first message. A connection exclusively attaches the sessions it creates or reopens.
The cwd selects a registered project, otherwise the ordinary chat workspace is used. Additional directories, client tools, and session-supplied MCP servers are unsupported. Agents use their existing Octomate tools and linked MCP accounts.
AcpSession
dataclass
¶
A public thread's connection and active prompt state.
Source code in octomate/tentacles/acp/broker.py
AcpBroker
dataclass
¶
Serve one authenticated connection using kicks and a nerve subscription.
Permission requests are answered directly with ACP request_permission. Questions use negotiated form elicitation; without that capability the prompt fails explicitly rather than fabricating answers. Disconnect and cancellation settle the graph before releasing session attachments.
Source code in octomate/tentacles/acp/broker.py
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 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 | |
capabilities
class-attribute
instance-attribute
¶
sessions
class-attribute
instance-attribute
¶
session ¶
config_options
async
¶
config_options(
session: AcpSession,
) -> list[
schema.SessionConfigOptionSelect
| schema.SessionConfigOptionBoolean
]
Source code in octomate/tentacles/acp/broker.py
handle
async
¶
Validate protocol payloads once, then dispatch typed session operations.
Source code in octomate/tentacles/acp/broker.py
request
async
¶
request(
method: str, params: JsonValue | None
) -> (
schema.InitializeResponse
| schema.NewSessionResponse
| schema.LoadSessionResponse
| schema.ResumeSessionResponse
| schema.ListSessionsResponse
| schema.PromptResponse
| schema.SetSessionConfigOptionResponse
| schema.SetSessionModeResponse
)
Source code in octomate/tentacles/acp/broker.py
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 | |
update
async
¶
Source code in octomate/tentacles/acp/broker.py
new_session
async
¶
Source code in octomate/tentacles/acp/broker.py
select
async
¶
Source code in octomate/tentacles/acp/broker.py
set_mode
async
¶
Source code in octomate/tentacles/acp/broker.py
modes
async
¶
Source code in octomate/tentacles/acp/broker.py
reopen
async
¶
reopen(
request: LoadSessionRequest | ResumeSessionRequest,
) -> (
schema.LoadSessionResponse
| schema.ResumeSessionResponse
)
Source code in octomate/tentacles/acp/broker.py
list_sessions
async
¶
Source code in octomate/tentacles/acp/broker.py
prompt
async
¶
Source code in octomate/tentacles/acp/broker.py
settle
async
¶
Interrupt via the signal nerve and observe cleanup before detaching.
Source code in octomate/tentacles/acp/broker.py
run_prompt
async
¶
Source code in octomate/tentacles/acp/broker.py
drive
async
¶
drive(
session: AcpSession,
signal: UserMessageSignal | DeferredActionBatchResponse,
translator: AcpTranslator,
) -> DeferredActionBatchResponse | None
Source code in octomate/tentacles/acp/broker.py
read_events
async
¶
read_events(
session: AcpSession,
stream: ObjectReceiveStream[Impulse],
translator: AcpTranslator,
) -> DeferredActionBatchResponse | None
Translate the turn and answer live actions before awaiting its completion.
Source code in octomate/tentacles/acp/broker.py
answer
async
¶
Source code in octomate/tentacles/acp/broker.py
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 | |
close
async
¶
Cancel active prompts before releasing this connection's attachments.
Source code in octomate/tentacles/acp/broker.py
octomate.tentacles.acp.routes ¶
ACP v1 at WS /api/acp, exposing Octomate as one agent.
The Authorization header carries an acp-scoped bearer. Send one JSON-RPC object
per text frame; this is a custom WebSocket transport, not Streamable HTTP.
Initialize, create or reopen a session, and select a returned model option using
session/set_config_option with configId: "model". Provider names never occur
in the URL. See AcpBroker for session ownership, workspace and MCP contracts.
build_acp_router ¶
Bind authentication and connections to the registered ACP instance.
Source code in octomate/tentacles/acp/routes.py
octomate.tentacles.acp.transport ¶
Carry ACP JSON-RPC through the SDK's stream connection.
stdio_connection
async
¶
stdio_connection(
handler: AcpClientHandler,
command: str,
*args: str,
habitat: Habitat | None = None,
cwd: str | None = None,
env: dict[str, str] | None = None,
) -> AsyncGenerator[Connection]
Own the provider process in its execution environment, preserving ACP bytes.
Source code in octomate/tentacles/acp/transport.py
stream_connection
async
¶
Bridge a habitat byte stream to the SDK's public asyncio stream interface.
Source code in octomate/tentacles/acp/transport.py
websocket_connection
async
¶
websocket_connection(
websocket: WebSocket, handler: AcpClientHandler
) -> AsyncGenerator[Connection]
Adapt one JSON object per text frame to the SDK's newline-delimited streams.
A local socket pair supplies real asyncio streams without a TCP listener or
SDK-private hooks. The SDK owns request IDs, callbacks and dispatch. Call
main_loop on the yielded connection to serve until the WebSocket closes.
Malformed JSON, non-object payloads and binary frames close with code 1008.
Source code in octomate/tentacles/acp/transport.py
octomate.tentacles.acp.auth ¶
Authenticate the project ACP endpoint before accepting a connection.
acp_sender ¶
Bind the ACP bearer dependency to the tentacle mounted by the router.
A router uses this dependency before accepting a WebSocket. Only the Authorization header supplies a credential; browser cookies and query parameters cannot authorize agent execution. The bearer verifier accepts scoped API keys and resource-bound OAuth tokens, checking scope, expiry and revocation on each connection attempt.
The returned profile is transient. Authenticating creates no thread, session or ledger entry and grants no authority over another connection's sessions.
Source code in octomate/tentacles/acp/auth.py
octomate.tentacles.acp.client ¶
Own installed ACP harness connections and their provider sessions.
The installed adapters speak ACP over stdio. The SDK owns framing, request IDs and concurrent callbacks; the transport owns the local or habitat process. A caller handles agent requests and notifications directly; the nerve is not a request/reply transport.
This is the client foundation, not a registered agent or a public API. It neither creates managed workspaces nor persists transcripts. Authentication, session access checks and ledger projection belong to the caller that exposes a session.
AcpClientHandler ¶
NativeAcpSession
dataclass
¶
A provider-owned session, retaining its ACP response and workspace.
The session ID is opaque and scoped to its configured harness. This binding does not itself register an Octomate thread or grant access to one.
Source code in octomate/tentacles/acp/client.py
37 38 39 40 41 42 43 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 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 | |
mode_option
property
¶
Prefer the mode config selector over the legacy session modes API.
permission_modes
property
¶
Keep provider mode ids, labels, and scope descriptions intact.
model_option
property
¶
The first advertised model selector, including uncategorized model.
models
property
¶
Flatten the protocol's grouped or ungrouped model choices.
effort_option
property
¶
The first advertised reasoning selector, using its semantic category.
efforts
property
¶
The current model's reasoning levels, in the provider's order.
select_mode
async
¶
Apply an explicit provider mode before prompting, including on reload.
Source code in octomate/tentacles/acp/client.py
select_model
async
¶
Validate against this session's choices before changing its model.
Source code in octomate/tentacles/acp/client.py
select_effort
async
¶
Apply an explicit effort after model selection has refreshed its choices.
Omitting effort preserves the provider session's current setting.
Source code in octomate/tentacles/acp/client.py
NativeAcpClient
dataclass
¶
One initialized adapter connection, which may own several native sessions.
Use the SDK connection for ACP requests and notifications. Keeping the typed
request models at that boundary preserves _meta without flattening its keys
into method arguments. The peer's initialization response remains available
for capability negotiation before a caller exposes any optional operations.
Source code in octomate/tentacles/acp/client.py
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 | |
connect
async
classmethod
¶
connect(
provider: AcpProvider,
handler: AcpClientHandler,
initialize: InitializeRequest,
*,
env: dict[str, str] | None = None,
habitat: Habitat | None = None,
cwd: str | None = None,
) -> AsyncGenerator[Self]
Start an installed adapter and negotiate ACP v1 before yielding.
handler receives the method, JSON parameters and notification flag for
agent-to-client traffic, including permissions. initialize declares
only capabilities that handler implements. Local processes augment the
SDK's minimal inherited environment; habitat processes receive explicit
environment overrides. Local stderr is inherited; habitat failures retain
their stderr through the habitat. Stdout is exclusively protocol traffic.
Exiting closes this connection and its process, including on failed initialization or cancellation. It does not delete provider sessions.
Source code in octomate/tentacles/acp/client.py
new_session
async
¶
Create a native session using the supplied workspace and MCP settings.
The agent tentacle supplies the managed server workspace. HTTP MCP settings and extensions cross the SDK boundary intact, without mutating the caller's request. MCP process commands are refused.
Source code in octomate/tentacles/acp/client.py
octomate.tentacles.acp.history ¶
The conversation visible through ACP, folded into a driven run's messages.
ACP exposes presentation content, not native model turns. Each prompt becomes
one request and its output one response, labelled with source=acp. Original
content and updates are retained in metadata; model names, usage and native turn
IDs are not inferred. Reported context snapshots are independent of billing
usage. Tool titles are presentation names, not executable tools.
ContentBlock ¶
ContentBlock = (
TextContentBlock
| ImageContentBlock
| AudioContentBlock
| ResourceContentBlock
| EmbeddedResourceContentBlock
)
AcpHistory
dataclass
¶
Accumulate one prompt in wire order, producing the same live and stored content.
A changed message ID or content kind ends a text part. Tool updates replace supplied fields, retaining omitted fields. Raw updates also preserve plans, settings, diffs, terminals and provider metadata without inventing model parts.
Source code in octomate/tentacles/acp/history.py
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 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 | |
parts
class-attribute
instance-attribute
¶
calls
class-attribute
instance-attribute
¶
returns
class-attribute
instance-attribute
¶
answer
property
¶
The visible reply for the ledger; media stays intact in model history.
end_part ¶
feed ¶
Fold a validated update and return its live events in arrival order.
Source code in octomate/tentacles/acp/history.py
tool ¶
Merge a tool's partial updates and retain its native call/result pair.
Source code in octomate/tentacles/acp/history.py
content_value ¶
Keep media inline and resource links inert; never read a path or URL.
Source code in octomate/tentacles/acp/history.py
octomate.tentacles.acp.adapter ¶
Translate ACP prompts and run output without owning execution or transport.
Follows Pydantic AI Harness's ACP adapter for text, thinking and function tools, and adds Octomate's segment output and non-streaming results. Segments use their existing text representation; reply handles are omitted. Output-tool events are not rendered: their validated answer arrives through the result events.
Create one translator per prompt and retain it across deferred resumes. Run starts reset output tracking; tool IDs remain known across resumes. Other events produce no updates here: routing, actions, plans and session lifecycle need their own handling before this translator can serve a complete ACP channel.
AcpUpdate ¶
AcpTranslator
dataclass
¶
Present one prompt's run events as typed ACP session-update payloads.
The caller supplies the session ID when sending each update. Text starts carry content too; part ends contain accumulated content and must not be replayed. Function-tool execution events, rather than streamed argument fragments, announce tools. A repeated call ID after approval is announced only once.
Source code in octomate/tentacles/acp/adapter.py
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 | |
started_tools
class-attribute
instance-attribute
¶
translate ¶
Return zero or more updates, preserving stream order and tool-call IDs.
Source code in octomate/tentacles/acp/adapter.py
text_updates ¶
Split text by its JSON-escaped size, without losing Unicode or whitespace.
Source code in octomate/tentacles/acp/adapter.py
prompt_segments ¶
Translate the mandatory ACP prompt content into Octomate message segments.
Text blocks retain their whitespace and order. Resource links use Pydantic AI Harness's presentation: the title or name followed by the URI, or the URI alone when neither label is present. A link is context, not a local file to open or a URL to fetch during translation.
Image, audio and embedded-resource blocks require optional capabilities this adapter does not yet provide. Reject the whole request instead of dropping unsupported content. Empty and whitespace-only prompts are rejected before a caller records an inbound message or starts a run.
Source code in octomate/tentacles/acp/adapter.py
tool_payload ¶
Serialize tool data with an explicit oversized-data preview.
Raw bytes use base64; Pydantic models retain their own serialization settings. The limit measures ASCII-escaped JSON, as used by the ACP SDK's transport. Unsupported Python values raise a serialization error rather than becoming reprs. Only the presentation is bounded; the original event and ledger stay intact.