teff.cli¶
teff.cli
¶
CLI for running teff workflows from YAML files.
The app doubles as the default run command: teff --file wf.yaml
and teff run --file wf.yaml are equivalent. Additional subcommands
cover validation, inspection, evaluation, and versioning.
Functions:
| Name | Description |
|---|---|
bot |
Run a workflow as a Telegram bot (long-polling or webhook). |
build |
Compile a flow.yaml into the low-level graph.yaml artifact. |
chat |
Chat with a workflow interactively from the terminal. |
daemon |
Run a workflow as a daemon: poll on an interval, keeping state between ticks. |
eval_ |
Evaluate a workflow against a dataset and report pass/fail. |
graph |
Inspect a workflow graph: YAML topology or a Mermaid diagram. |
inspect |
Print the saved state for a checkpointed run. |
main |
Run a workflow from a YAML file (default command). |
new |
Scaffold a new teff app from a template (fastapi|cli|daemon). |
obs_server |
Serve the trace dashboard + ingest endpoint (standalone obs server). |
prune |
Delete stale checkpoints (TTL / keep-last GC). |
run |
Run a workflow from a YAML file. |
serve |
Serve a workflow over HTTP/SSE plus any configured webhook channels. |
validate |
Validate a workflow YAML file without running it. |
version |
Print the teff version. |
bot
¶
bot(
file=typer.Argument(..., help="Path to workflow YAML file"),
token_env=typer.Option(
"TELEGRAM_BOT_TOKEN", "--token-env", help="Env var holding the bot token"
),
mode=typer.Option("polling", "--mode", help="Transport: polling or webhook"),
once=typer.Option(False, "--once", help="Process pending updates and exit"),
)
Run a workflow as a Telegram bot (long-polling or webhook).
Reads the workflow's channels.telegram block for mode/url
(CLI flags win), then binds the same compiled Assistant to every
chat: each chat is a durable session, so interrupts ask questions
in-chat and resume on the operator's answer.
Source code in teff/cli.py
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 | |
build
¶
build(
file=typer.Argument(..., help="Path to flow.yaml (authoring surface)"),
output=typer.Option(
None, "--output", "-o", help="Path for the compiled graph.yaml"
),
)
Compile a flow.yaml into the low-level graph.yaml artifact.
Previews the two-layer compile: flow.yaml → Graph → graph.yaml.
Unless --output is given the compiled YAML is written to
graph.yaml next to the source flow file.
Source code in teff/cli.py
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 | |
chat
¶
chat(
file=typer.Argument(..., help="Path to workflow YAML file"),
session=typer.Option(
None, "--session", "-s", help="Durable session id (default: chat-<user>)"
),
owner=typer.Option(
DEFAULT_OWNER, "--owner", help="Owner scoping this session's checkpoints"
),
prompt=typer.Option("> ", "--prompt", help="Input prompt shown before each turn"),
)
Chat with a workflow interactively from the terminal.
Builds the durable :class:~teff.assistant.Assistant from file and
runs a REPL: each line is one turn, the reply is printed, and a paused
workflow (interrupt) asks in-chat and resumes on your answer — so the
same workflow.yaml that serves HTTP/Telegram/webhook also runs as a
plain terminal conversation. Ctrl-D or Ctrl-C exits.
Source code in teff/cli.py
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | |
daemon
¶
daemon(
file=typer.Argument(..., help="Path to workflow YAML file"),
interval=typer.Option(60.0, "--interval", "-i", help="Seconds between ticks"),
once=typer.Option(False, "--once", help="Run a single tick and exit"),
trace=typer.Option(False, "--trace", "-t", help="Print a JSON run trace to stderr"),
checkpoint=typer.Option(
None,
"--checkpoint",
help='JSON checkpointer config, e.g. \'{"type":"file","path":"cp"}\'',
),
checkpoint_id=typer.Option(
"daemon", "--checkpoint-id", help="Checkpoint key for durable daemon state"
),
checkpoint_owner=typer.Option(
DEFAULT_OWNER,
"--checkpoint-owner",
help="Owner/session scoping the checkpoint (e.g. a user id)",
),
node_timeout=typer.Option(None, "--node-timeout", help="Max seconds per node"),
max_iterations=typer.Option(
None, "--max-iterations", help="Max node executions (loop guard)"
),
)
Run a workflow as a daemon: poll on an interval, keeping state between ticks.
The workflow itself defines what a tick does — e.g. list open GitLab
merge requests, review new ones, post verdicts and notify Telegram.
Durable state (already-reviewed MRs, counters, …) is carried across ticks
via the optional --checkpoint.
Source code in teff/cli.py
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 | |
eval_
¶
eval_(
file=typer.Argument(..., help="Path to workflow YAML file"),
data=typer.Option(..., "--data", "-d", help="Dataset file (.json/.jsonl/.csv)"),
output=typer.Option(None, "--output", "-o", help="Write the JSON report to a file"),
judge_model=typer.Option(
None, "--judge-model", help="Model used to score outputs (LLM judge)"
),
judge_provider=typer.Option(
None, "--judge-provider", help="Provider key for the judge model"
),
exact=typer.Option(
False, "--exact", help="Score by exact (normalised) string match"
),
max_examples=typer.Option(
None, "--max-examples", help="Limit the number of examples"
),
output_key=typer.Option(None, "--output-key", help="State key holding the answer"),
)
Evaluate a workflow against a dataset and report pass/fail.
Source code in teff/cli.py
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 | |
graph
¶
graph(
file=typer.Argument(..., help="Path to workflow YAML file"),
mermaid=typer.Option(
False, "--mermaid", help="Render the workflow graph as a Mermaid diagram"
),
)
Inspect a workflow graph: YAML topology or a Mermaid diagram.
Source code in teff/cli.py
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 | |
inspect
¶
inspect(
checkpoint=typer.Option(..., "--checkpoint", help="JSON checkpointer config"),
checkpoint_id=typer.Option(..., "--checkpoint-id", help="Run key to inspect"),
checkpoint_owner=typer.Option(
DEFAULT_OWNER,
"--checkpoint-owner",
help="Owner/session scoping the checkpoint (e.g. a user id)",
),
)
Print the saved state for a checkpointed run.
Source code in teff/cli.py
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 | |
main
¶
main(
ctx,
file=typer.Option(None, "--file", "-f", help="Path to workflow YAML file"),
output=typer.Option(None, "--output", "-o", help="Write result to file"),
pretty=typer.Option(False, "--pretty", "-p", help="Pretty-print JSON output"),
trace=typer.Option(False, "--trace", "-t", help="Print a JSON run trace to stderr"),
checkpoint=typer.Option(
None,
"--checkpoint",
help='JSON checkpointer config, e.g. \'{"type":"file","path":"cp"}\'',
),
checkpoint_id=typer.Option(
None, "--checkpoint-id", help="Checkpoint key identifying the run"
),
checkpoint_owner=typer.Option(
DEFAULT_OWNER,
"--checkpoint-owner",
help="Owner/session scoping the checkpoint (e.g. a user id)",
),
resume=typer.Option(
None, "--resume", help='Resume values as JSON, e.g. \'{"approved":"yes"}\''
),
node_timeout=typer.Option(None, "--node-timeout", help="Max seconds per node"),
max_iterations=typer.Option(
None, "--max-iterations", help="Max node executions (loop guard)"
),
interactive=typer.Option(
False,
"--interactive",
help="Prompt the operator on stdin when a workflow pauses for input",
),
)
Run a workflow from a YAML file (default command).
Source code in teff/cli.py
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 | |
new
¶
new(
name=typer.Argument(..., help="Project name, e.g. 'support-ai'"),
dest=typer.Option(None, "--dest", help="Destination directory (default: ./<slug>)"),
template=typer.Option(
"fastapi", "--template", "-t", help=f"App template: {', '.join(TEMPLATES)}"
),
with_variants=typer.Option(
"", "--with", help="Comma-separated feature variants: postgres,rag,celery"
),
)
Scaffold a new teff app from a template (fastapi|cli|daemon).
Source code in teff/cli.py
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 | |
obs_server
¶
obs_server(
db=typer.Option("traces.db", "--db", help="SQLite file holding the traces"),
host=typer.Option(
"127.0.0.1", "--host", help="Address to bind (use 0.0.0.0 to expose)"
),
port=typer.Option(8001, "--port", help="Port to listen on"),
prefix=typer.Option(
"/obs", "--prefix", help="URL prefix for the dashboard and ingest"
),
api_key=typer.Option(
None,
"--api-key",
envvar="TEFF_OBS_API_KEY",
help="Shared key required in the X-API-Key header (mandatory on 0.0.0.0)",
),
)
Serve the trace dashboard + ingest endpoint (standalone obs server).
Workflows with no API push their traces here via observability:
(type: webhook), and this process serves the dashboard UI::
teff obs-server --db traces.db --host 127.0.0.1 --port 8001
# open http://localhost:8001/obs/ui
Traces contain full prompts/responses. Binding to a non-loopback host
(0.0.0.0) without --api-key is refused: the server refuses to
start rather than expose them unauthenticated.
Source code in teff/cli.py
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 | |
prune
¶
prune(
checkpoint=typer.Option(..., "--checkpoint", help="JSON checkpointer config"),
checkpoint_owner=typer.Option(
None, "--checkpoint-owner", help="Only prune this owner (default: all owners)"
),
max_age=typer.Option(
None, "--max-age", help="Delete checkpoints older than this many seconds"
),
keep_last=typer.Option(
None, "--keep-last", help="Keep only the N most recent per owner"
),
)
Delete stale checkpoints (TTL / keep-last GC).
Source code in teff/cli.py
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 | |
run
¶
run(
file=typer.Option(..., "--file", "-f", help="Path to workflow YAML file"),
output=typer.Option(None, "--output", "-o", help="Write result to file"),
pretty=typer.Option(False, "--pretty", "-p", help="Pretty-print JSON output"),
trace=typer.Option(False, "--trace", "-t", help="Print a JSON run trace to stderr"),
checkpoint=typer.Option(
None,
"--checkpoint",
help='JSON checkpointer config, e.g. \'{"type":"file","path":"cp"}\'',
),
checkpoint_id=typer.Option(
None, "--checkpoint-id", help="Checkpoint key identifying the run"
),
checkpoint_owner=typer.Option(
DEFAULT_OWNER,
"--checkpoint-owner",
help="Owner/session scoping the checkpoint (e.g. a user id)",
),
resume=typer.Option(
None, "--resume", help='Resume values as JSON, e.g. \'{"approved":"yes"}\''
),
node_timeout=typer.Option(None, "--node-timeout", help="Max seconds per node"),
max_iterations=typer.Option(
None, "--max-iterations", help="Max node executions (loop guard)"
),
interactive=typer.Option(
False, "--interactive", help="Prompt on stdin when a workflow pauses for input"
),
)
Run a workflow from a YAML file.
Source code in teff/cli.py
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 | |
serve
¶
serve(
file=typer.Argument(..., help="Path to workflow YAML file"),
host=typer.Option("127.0.0.1", "--host", help="Bind host"),
port=typer.Option(8000, "--port", "-p", help="Bind port"),
)
Serve a workflow over HTTP/SSE plus any configured webhook channels.
The channels: block of the workflow YAML is the source of truth:
server (host/port) is overridable via --host/--port, and
every channels.webhook entry is mounted as a POST endpoint. The
same compiled :class:~teff.assistant.Assistant serves all routes, so
checkpoints and interrupts behave identically everywhere.
Source code in teff/cli.py
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 | |
validate
¶
validate(file=typer.Argument(..., help='Path to workflow YAML file'))
Validate a workflow YAML file without running it.
Detects whether file is authored in the idiom surface (team:,
map:, loop: …) or the classic graph format and runs the
matching validator, resolving include: blocks and declared plugins
first.
Source code in teff/cli.py
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 | |
version
¶
version()
Print the teff version.
Source code in teff/cli.py
1005 1006 1007 1008 | |