robotsix_chat.chat.server
Chat SSE server — HTTP + Server-Sent Events bridge for human-to-agent chat.
Re-exports the public API that used to live in the monolithic server.py,
preserving backward compatibility for all existing import sites
(tests/, src/robotsix_chat/chat/__init__.py, etc.).
create_agent_from_settings(instruction=None, settings=None, *, conversation_store=None, model_level=None, subsession_env=None, subsession_ctx=None, subsession_close_state=None, tool_wrapper=None, bare=False, memory_enabled=True, event_sink=None, diagnostic_store=None, knowledge_store=None, continuation_store=None, operator_attended=True)
Build an :class:LlmioChatAgent wired from settings.
The backend is chosen by robotsix-llmio's capability level: model_level
when given, else settings.chat_default_model_level. The level encodes the
transport + model; settings.openrouter_api_key is forwarded only when the
effective level's transport needs a key (keyless claudeSDK levels 2, 4, 5
never receive one).
When settings is None, Settings.load() resolves configuration
from the YAML config file and environment. When instruction is None,
it is taken from settings.agent_instruction.
bare (default False) skips skill injection, feature tools,
subsession wiring, and memory — the agent gets a NullMemory and no
tools. Use it for bounded text-transformation calls (e.g. the
compaction summary agent).
memory_enabled (default True) gates only the full long-term memory
while leaving tools and subsession wiring intact. Set False for
unattended background agents (subsession workers, periodic
auto-continue) that would otherwise recall + cognify every turn around
the clock; they get a NullMemory. The interactive main-chat agent
keeps the default. bare already implies no memory regardless.
operator_attended (default True) must be False for agents no
operator is watching (periodic sessions); it withholds the
operator-instruction-only repo creation / fork tools. Subsession agents
(subsession_ctx set) are always treated as unattended.
Subsession wiring (subsession_env):
- Main chat agent — pass subsession_env with
subsession_ctx=None. Per-request tools are built viarequest_tools_factoryso each tool closure captures the owningsession_idlexically. - Subsession agent — pass subsession_env, the worker's
subsession_ctx, and its subsession_close_state. The depth-aware
tools (including
complete_subsession) are baked in statically; identity is fixed at construction. None(default) — no subsession tools.
event_sink is forwarded to :class:~robotsix_chat.llm.LlmioChatAgent
for live tool/thinking activity frames on the GET /events channel.
Pass the same :class:~robotsix_chat.chat.events.EventBus given to
create_app — typically only for the main chat agent.
Source code in src/robotsix_chat/chat/server/agent_factory.py
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 | |
create_app(agent, *, summary_agent=None, serve_ui=True, idle_timeout_minutes=30, max_images_per_message=8, max_image_bytes=5242880, allowed_image_media_types=None, cors_allow_origins=None, correlation_id_header='X-Request-ID', conversation_store=None, event_bus=None, run_serializer=None, msg_id_store=None, message_coalescer=None, message_coalesce_seconds=0.3, subsession_registry=None, subsession_delivery=None, feedback_runner=None, periodic_definitions=None, periodic_agent_factory=None, periodic_state_path=None, on_startup=None, on_startup_async=None, on_shutdown=None, direct_repo_settings=None, central_deploy_settings=None, github_security_settings=None, github_actions_settings=None, mobile_auth=None, config_path=None, draft_store_dir=None, diagnostic_store=None, knowledge_store=None, health_settings=None, evergoing_settings=None, memory_component_settings=None, continuation_store=None)
Return a Starlette ASGI app wired to agent.
The returned app is a fully-initialised ASGI application that can be
mounted directly in tests via httpx.ASGITransport or passed to
uvicorn.run().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent
|
ChatAgent
|
Object whose |
required |
summary_agent
|
ChatAgent | None
|
Dedicated summariser agent used for the idle-timeout
compaction summary, the carryover summary and conversation
titles. |
None
|
serve_ui
|
bool
|
When |
True
|
idle_timeout_minutes
|
int
|
Minutes of no user activity before the UI
auto-restarts the conversation; |
30
|
max_images_per_message
|
int
|
Maximum number of images a client may attach
to a single |
8
|
max_image_bytes
|
int
|
Maximum decoded size (bytes) of a single attached
image. Default |
5242880
|
allowed_image_media_types
|
list[str] | None
|
Media types accepted for image
attachments. Default |
None
|
cors_allow_origins
|
list[str] | None
|
Origins permitted to call |
None
|
correlation_id_header
|
str
|
HTTP header name for the correlation /
request-id. Default |
'X-Request-ID'
|
conversation_store
|
ConversationStore | None
|
Tracks per-client multi-turn conversation history
and trace sessions. |
None
|
event_bus
|
EventBus | None
|
Per-client SSE notification bus for |
None
|
run_serializer
|
RunSerializer | None
|
Per-owner |
None
|
msg_id_store
|
MessageIdempotencyStore | None
|
Per-session message idempotency store that ensures
duplicate messages return the cached reply. When |
None
|
message_coalescer
|
MessageCoalescer | None
|
Per-session message coalescer that batches
rapid-fire user messages into a single agent run. When
|
None
|
message_coalesce_seconds
|
float
|
Debounce window (seconds) that the
coalescer waits before draining the pending-message batch.
Default |
0.3
|
subsession_registry
|
SubsessionRegistry | None
|
Shared
:class: |
None
|
subsession_delivery
|
ParentDelivery | None
|
The
:class: |
None
|
feedback_runner
|
Any
|
Optional
:class: |
None
|
periodic_definitions
|
list[Any] | None
|
Enabled
:class: |
None
|
periodic_agent_factory
|
Callable[[int | None], ChatAgent] | None
|
Callable mapping a preset's |
None
|
periodic_state_path
|
str | None
|
Override for the scheduler's firing-state file (tests); defaults to the standard /data location. |
None
|
on_startup
|
Callable[[], None] | None
|
Optional callable invoked during application startup
(the Starlette lifespan |
None
|
on_startup_async
|
Callable[[], Any] | None
|
Optional async callable invoked after on_startup during application startup. Pass a coroutine function that e.g. starts the component-agent responder. |
None
|
on_shutdown
|
Callable[[], Any] | None
|
Optional async callable invoked during application
shutdown (after |
None
|
direct_repo_settings
|
DirectRepoSettings | None
|
GitHub App credentials (app id, private key,
installation id) used by the
|
None
|
central_deploy_settings
|
CentralDeploySettings | None
|
Canonical deploy-plane settings (URL and
API key) used by the GitHub security/actions endpoints for
inbound |
None
|
github_security_settings
|
GitHubSecuritySettings | None
|
GitHub security-feature toggle config
(org, deploy API key) used by the
|
None
|
github_actions_settings
|
GitHubActionsSettings | None
|
GitHub Actions config (org, deploy API key)
used by the Actions secrets and workflow dispatch endpoints.
When |
None
|
mobile_auth
|
MobileAuthSettings | None
|
Mobile SSO authentication settings. When |
None
|
config_path
|
str | None
|
Path to the config JSON file, used by the
|
None
|
draft_store_dir
|
str | None
|
Path to the session-drafts directory, used by
the |
None
|
diagnostic_store
|
Any
|
Shared :class: |
None
|
knowledge_store
|
Any
|
Shared :class: |
None
|
health_settings
|
HealthSettings | None
|
Optional
:class: |
None
|
evergoing_settings
|
EvergoingSettings | None
|
Optional
:class: |
None
|
memory_component_settings
|
MemoryComponentSettings | None
|
Optional
:class: |
None
|
continuation_store
|
Any
|
Shared
:class: |
None
|
Source code in src/robotsix_chat/chat/server/app.py
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 | |
run_server(agent, *, summary_agent=None, host='0.0.0.0', port=8000, serve_ui=True, idle_timeout_minutes=30, max_images_per_message=8, max_image_bytes=5242880, allowed_image_media_types=None, cors_allow_origins=None, correlation_id_header='X-Request-ID', conversation_store=None, event_bus=None, run_serializer=None, subsession_registry=None, subsession_delivery=None, feedback_runner=None, periodic_definitions=None, periodic_agent_factory=None, periodic_state_path=None, on_startup=None, on_startup_async=None, on_shutdown=None, direct_repo_settings=None, central_deploy_settings=None, github_security_settings=None, github_actions_settings=None, mobile_auth=None, config_path=None, diagnostic_store=None, knowledge_store=None, health_settings=None, evergoing_settings=None, memory_component_settings=None, continuation_store=None)
Start the chat SSE server on host:port.
Blocks until the process is interrupted (uvicorn handles
SIGINT / SIGTERM).
Source code in src/robotsix_chat/chat/server/cli.py
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 | |
run_server_from_config(agent=None)
Start the chat SSE server using Settings.load() for configuration.
Resolves settings through the full cascade (pydantic defaults → YAML
config file → environment, with .env support), configures Python
logging, builds a default :class:LlmioChatAgent when agent is
None (using agent_instruction from config), and delegates to
:func:run_server. (Authentication is centralized at the central-deploy
gateway — the server itself is unauthenticated.)
Source code in src/robotsix_chat/chat/server/cli.py
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 | |