app
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| ModelSelection pyt3client.models.tools |
||
| PendingRequestInput pyt3client.models.tools |
||
| ProjectListInput pyt3client.models.tools |
||
| ProviderOptionSelection pyt3client.models.tools |
||
| Runtime pyt3client.cli.app Per-invocation state; tests pass one as `obj\=` to inject an httpx transport. |
||
| T3AuthError pyt3client.errors Signing in failed, or the server no longer accepts the credential. |
||
| T3Client pyt3client.client Typed client for one T3 Code environment, over its `/mcp` endpoint. |
||
| T3Error pyt3client.errors Base class for every error pyt3client raises. |
||
| T3HttpError pyt3client.errors The server answered with an unexpected HTTP status. |
||
| T3McpError pyt3client.errors The server answered a request with a JSON-RPC error. |
||
| T3ProtocolError pyt3client.errors The server answered in a shape this client does not understand. |
||
| T3ToolError pyt3client.errors A tool call was refused. |
||
| ThreadInterruptInput pyt3client.models.tools |
||
| ThreadLaunchInput pyt3client.models.tools |
||
| ThreadListInput pyt3client.models.tools |
||
| ThreadReadInput pyt3client.models.tools |
||
| ThreadSearchInput pyt3client.models.tools |
||
| ThreadSendInput pyt3client.models.tools |
||
| WorkspaceStrategy pyt3client.models.tools 'worktree': new checkout from `baseRef`. Honor a requested base. Otherwise, independent work uses the default branch as `remote/branch` (e.g. `origin/main`) with `startFromOrigin: true`; with no remote, use the local default branch. Required unpublished commits and dependent or stacked work use their local base with `startFromOrigin: false`. 'existing_worktree': bind `worktreePath`, a project worktree. 'root': project checkout, the default, not your worktree. Uncommitted edits are not copied. |
🛈 DocStrings¶
The pyt3 command: drive a (possibly remote) T3 Code environment from a shell.
T3 Code's own t3 CLI only works on the machine that runs the server (it
reads the local data directory). pyt3 signs in to any environment's /mcp
once (pyt3 login) and then works from anywhere that can reach it.
Exit codes follow upstream t3 thread ... --wait: 0 when the run completed,
1 when it failed, was cancelled or interrupted (or on any error), 2 when the
agent waits for an answer or approval, and 3 when --timeout ran out first.
Runtime
dataclass
¶
Per-invocation state; tests pass one as obj= to inject an httpx transport.
Source code in src/pyt3client/cli/app.py
99 100 101 102 103 104 105 106 107 | |
answer
¶
answer(
ctx: Context,
thread: Annotated[str, Argument(help="Thread id.")],
request_id: Annotated[str, Argument(help="Request id from `pyt3 pending`.")],
answers: Annotated[
list[str],
Argument(
help="question-id=answer, where the answer is an option value or label, or free text. Repeat a question id to select several options."
),
],
as_json: JsonFlag = False,
) -> None
Answer an agent's pending question. Cannot approve permission requests.
Source code in src/pyt3client/cli/app.py
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 | |
envs
¶
envs(as_json: JsonFlag = False) -> None
List saved environments (never prints tokens).
Source code in src/pyt3client/cli/app.py
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 | |
interrupt
¶
interrupt(
ctx: Context,
thread: Annotated[str, Argument(help="Thread id.")],
run: Annotated[
str | None, Option(help="Run to interrupt (default: the newest running).")
] = None,
reason: Annotated[str | None, Option(help="Why; shown in the thread.")] = None,
as_json: JsonFlag = False,
) -> None
Interrupt a thread's running turn.
Source code in src/pyt3client/cli/app.py
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 | |
login
¶
login(
ctx: Context,
url: Annotated[str, Argument(help="Environment address, e.g. https://host:3773.")],
pairing_code: Annotated[str, Argument(help="Code from `t3 auth pairing create`.")],
access: Annotated[
Literal["read-only", "approval-required", "auto-accept-edits", "auto", "full-access"],
Option(help="What this CLI may do. App approval codes (AUTO-…) set their own."),
] = "auto",
name: Annotated[
str | None, Option("--name", help="Alias to save it as (default: its label).")
] = None,
client_name: Annotated[
str, Option(help="Label the environment shows for this sign-in.")
] = "pyt3",
as_json: JsonFlag = False,
) -> None
Sign in with a one-time pairing code and save the token.
Source code in src/pyt3client/cli/app.py
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 | |
login_native
¶
login_native(
ctx: Context,
url: Annotated[str, Argument(help="Environment address, e.g. https://host:3773.")],
pairing_token: Annotated[
str, Argument(help="Token from `t3 auth pairing create` (not an MCP code).")
],
name: Annotated[
str | None,
Option(
"--name",
help="Alias to save it as (default: the MCP sign-in of this URL, or its label).",
),
] = None,
client_name: Annotated[
str, Option(help="Label the environment shows for this sign-in.")
] = "pyt3",
as_json: JsonFlag = False,
) -> None
Sign in to the native WebSocket RPC (live streaming, approvals) and save the token.
The native surface rejects MCP tokens, so this is a second sign-in, kept under the same alias as the environment's MCP one.
Source code in src/pyt3client/cli/app.py
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 | |
logout
¶
logout(
ctx: Context,
alias: Annotated[
str | None, Argument(help="Environment to forget (default: --env or the only one).")
] = None,
) -> None
Forget a saved sign-in. Revoke it in T3 Code under Settings -> Sharing & access.
Source code in src/pyt3client/cli/app.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | |
main
¶
main(
ctx: Context,
env: Annotated[
str | None,
Option("--env", envvar="PYT3_ENV", help="Saved environment alias (see `pyt3 envs`)."),
] = None,
) -> None
Drive T3 Code environments (local or remote) over their MCP endpoint.
Source code in src/pyt3client/cli/app.py
123 124 125 126 127 128 129 130 131 132 133 134 | |
models
¶
models(ctx: Context, as_json: JsonFlag = False) -> None
List providers and their models.
Source code in src/pyt3client/cli/app.py
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 | |
pending
¶
pending(
ctx: Context, thread: Annotated[str, Argument(help="Thread id.")], as_json: JsonFlag = False
) -> None
List the questions a thread's agent waits on (approvals are not listed).
Source code in src/pyt3client/cli/app.py
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 | |
projects
¶
projects(ctx: Context, as_json: JsonFlag = False) -> None
List projects.
Source code in src/pyt3client/cli/app.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 | |
send
¶
send(
ctx: Context,
thread: Annotated[str, Argument(help="Thread id.")],
message: Annotated[str, Argument(help="Message; `-` reads stdin.")],
mode: Annotated[
Literal["auto", "queue", "steer", "restart"] | None,
Option(
help="auto (default): start an idle thread, steer or queue a busy one; queue: run after active work; steer: into the running turn; restart: interrupt and restart with this message."
),
] = None,
wait: Annotated[bool, Option(help="Wait for the run and print the reply.")] = False,
timeout: TimeoutOption = None,
as_json: JsonFlag = False,
) -> None
Send a message to a thread.
Source code in src/pyt3client/cli/app.py
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 | |
show
¶
show(
ctx: Context,
thread: Annotated[str, Argument(help="Thread id.")],
activity: Annotated[
bool, Option(help="Include tool calls, reasoning and runtime requests.")
] = False,
limit: Annotated[int, Option(min=1, max=100, help="Latest items to show.")] = 10,
as_json: JsonFlag = False,
) -> None
Show a thread's state and its latest messages.
Source code in src/pyt3client/cli/app.py
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 | |
start
¶
start(
ctx: Context,
project: Annotated[str, Argument(help="Project id, or a folder inside a project.")],
message: Annotated[str, Argument(help="First prompt; `-` reads stdin.")],
title: Annotated[
str | None, Option(help="Thread title (default: the message's first line).")
] = None,
provider: Annotated[
str | None, Option(help="Provider instance id (see `pyt3 models`).")
] = None,
model: Annotated[str | None, Option(help="Model slug of that provider.")] = None,
option: Annotated[list[str] | None, Option(help="Model option id=value (repeatable).")] = None,
mode: Annotated[
Literal["approval-required", "auto-accept-edits", "auto", "full-access"] | None,
Option(help="Runtime mode (default: the project's)."),
] = None,
plan: Annotated[bool, Option(help="Start in plan mode.")] = False,
worktree: Annotated[
str | None, Option(help="Run in a new worktree from this branch, tag or commit.")
] = None,
branch: Annotated[str | None, Option(help="Branch name for the new worktree.")] = None,
wait: Annotated[bool, Option(help="Wait for the run and print the reply.")] = False,
timeout: TimeoutOption = None,
as_json: JsonFlag = False,
) -> None
Start a thread and print its id (or, with --wait, the agent's reply).
Source code in src/pyt3client/cli/app.py
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 | |
threads
¶
threads(
ctx: Context,
project: Annotated[
str | None, Option(help="Project id or folder (default: all projects).")
] = None,
all_threads: Annotated[bool, Option("--all", help="Include subagent threads.")] = False,
status: Annotated[
list[ThreadStatus] | None, Option(help="Only threads in this status (repeatable).")
] = None,
search: Annotated[
str | None, Option(help="Search titles, branches, PRs and messages instead.")
] = None,
limit: Annotated[int, Option(min=1, max=100)] = 50,
as_json: JsonFlag = False,
) -> None
List threads, newest first, or search them.
Source code in src/pyt3client/cli/app.py
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 | |
wait_command
¶
wait_command(
ctx: Context,
thread: Annotated[str, Argument(help="Thread id.")],
run: Annotated[str | None, Option(help="Run to wait for (default: the latest).")] = None,
timeout: TimeoutOption = None,
as_json: JsonFlag = False,
) -> None
Wait until a thread's run ends; the exit code tells how it ended.
Source code in src/pyt3client/cli/app.py
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | |