Mission reference
Public Pydantic Graph assembly for the Lycurgus mission orchestrator.
(c) Mike Casale 2026. Licensed under the MIT License.
Durable five-phase mission graph executed only in isolated worker processes.
(c) Mike Casale 2026. Licensed under the MIT License.
MissionState
Bases: BaseModel
Versioned replay state, with submission uncertainty preserved across restarts.
Source code in agent_k/mission.py
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 | |
MissionContext
dataclass
Services and paths owned by one mission subprocess.
Source code in agent_k/mission.py
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 | |
phase
async
phase(
name: str,
state: MissionState,
operation: Callable[[MissionState], Awaitable[None]],
) -> None
Execute one phase with a hard deadline and durable completion boundary.
Source code in agent_k/mission.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
discovery
async
discovery(state: MissionState) -> None
Select an observed competition or resolve the explicitly supplied slug.
Source code in agent_k/mission.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
research
async
research(state: MissionState) -> None
Download, discover, split, and research without reading acceptance labels.
Source code in agent_k/mission.py
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 | |
prototype
async
prototype(state: MissionState) -> None
Evaluate a real baseline and, when configured, a fixed Kumo challenger.
Source code in agent_k/mission.py
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 | |
evolution
async
evolution(state: MissionState) -> None
Run OpenEvolve's native search with per-iteration durable checkpoints.
Source code in agent_k/mission.py
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 | |
submission
async
submission(state: MissionState) -> None
Accept the selected candidate independently and optionally submit exactly once.
Source code in agent_k/mission.py
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 | |
checkpoint
async
checkpoint(state: MissionState) -> None
Publish replayable data once and a compact runtime archive at each boundary.
Source code in agent_k/mission.py
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 | |
check_control
async
check_control(state: MissionState) -> None
Acknowledge pause or cancel only after a durable snapshot exists.
Source code in agent_k/mission.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 | |
DiscoveryNode
dataclass
Bases: BaseNode[MissionState, MissionContext, MissionRunResult]
Select a competition and transition to research.
Source code in agent_k/mission.py
759 760 761 762 763 764 765 766 | |
run
async
run(
ctx: GraphRunContext[MissionState, MissionContext],
) -> ResearchNode
Complete discovery through the shared phase lifecycle.
Source code in agent_k/mission.py
763 764 765 766 | |
ResearchNode
dataclass
Bases: BaseNode[MissionState, MissionContext, MissionRunResult]
Discover dataset structure and collect evidence.
Source code in agent_k/mission.py
769 770 771 772 773 774 775 776 | |
run
async
run(
ctx: GraphRunContext[MissionState, MissionContext],
) -> PrototypeNode
Complete research through the shared phase lifecycle.
Source code in agent_k/mission.py
773 774 775 776 | |
PrototypeNode
dataclass
Bases: BaseNode[MissionState, MissionContext, MissionRunResult]
Establish independently scored baselines.
Source code in agent_k/mission.py
779 780 781 782 783 784 785 786 | |
run
async
run(
ctx: GraphRunContext[MissionState, MissionContext],
) -> EvolutionNode
Complete prototyping through the shared phase lifecycle.
Source code in agent_k/mission.py
783 784 785 786 | |
EvolutionNode
dataclass
Bases: BaseNode[MissionState, MissionContext, MissionRunResult]
Optimize with OpenEvolve only.
Source code in agent_k/mission.py
789 790 791 792 793 794 795 796 | |
run
async
run(
ctx: GraphRunContext[MissionState, MissionContext],
) -> SubmissionNode
Complete native evolution through the shared phase lifecycle.
Source code in agent_k/mission.py
793 794 795 796 | |
SubmissionNode
dataclass
Bases: BaseNode[MissionState, MissionContext, MissionRunResult]
Perform independent acceptance and prepare the final artifact.
Source code in agent_k/mission.py
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 | |
run
async
run(
ctx: GraphRunContext[MissionState, MissionContext],
) -> End[MissionRunResult]
Finish the mission with truthful local and external result separation.
Source code in agent_k/mission.py
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 | |
run_mission
async
run_mission(
job: JobLease, client: WorkerApiClient, workdir: Path
) -> MissionRunResult
Execute one fenced mission, restoring verified durable state when present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
JobLease
|
Current server-issued job lease, command, and event sequence. |
required |
client
|
WorkerApiClient
|
Authenticated worker client used for fenced state and artifact writes. |
required |
workdir
|
Path
|
Private directory owned exclusively by this worker attempt. |
required |
Returns:
| Type | Description |
|---|---|
MissionRunResult
|
A terminal result referencing verified artifacts and the final event sequence. |
Raises:
| Type | Description |
|---|---|
MissionInterrupted
|
A pause or cancellation has been durably acknowledged. |
ValueError
|
Configuration, restored state, or a mission contract is invalid. |
TimeoutError
|
A phase or remote submission remains incomplete past its deadline. |
Provider and Kaggle failures propagate to the worker's retry policy. A submission with an uncertain remote outcome is reconciled before any new submission attempt.
Source code in agent_k/mission.py
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 | |
Competition discovery with runtime dependency injection.
(c) Mike Casale 2026. Licensed under the MIT License.
LobbyistDeps
dataclass
Services and evidence scoped to one discovery run.
Source code in agent_k/lobbyist.py
41 42 43 44 45 46 47 | |
DiscoveryResult
Bases: BaseModel
Selection constrained to an observed competition identifier.
Source code in agent_k/lobbyist.py
50 51 52 53 54 55 | |
CompetitionSummary
Bases: BaseModel
Bounded competition evidence shown to the selecting model.
Source code in agent_k/lobbyist.py
58 59 60 61 62 63 64 65 66 67 68 69 70 | |
search_candidates
async
search_candidates(deps: LobbyistDeps) -> list[Competition]
Collect observed competitions satisfying the mission's hard constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deps
|
LobbyistDeps
|
Platform adapter, criteria, and the evidence map to populate. |
required |
Returns:
| Type | Description |
|---|---|
list[Competition]
|
At most |
Source code in agent_k/lobbyist.py
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 | |
discover
async
discover(
ctx: RunContext[LobbyistDeps],
) -> list[CompetitionSummary]
Find real competitions satisfying the user's hard constraints.
Source code in agent_k/lobbyist.py
106 107 108 109 110 | |
Evidence-bound research for an already discovered dataset.
(c) Mike Casale 2026. Licensed under the MIT License.
ResearchFinding
Bases: BaseModel
A recommendation with an observed source and a measurable validation step.
Source code in agent_k/scientist.py
48 49 50 51 52 53 54 | |
ResearchReport
Bases: BaseModel
Research output, separate from measured evaluation results.
Source code in agent_k/scientist.py
57 58 59 60 61 62 63 64 65 | |
ScientistDeps
dataclass
Research services and training-only evidence for one mission.
Source code in agent_k/scientist.py
68 69 70 71 72 73 74 75 76 | |
leaderboard
async
leaderboard(
ctx: RunContext[ScientistDeps],
) -> list[LeaderboardEntry] | str
Inspect actual public leaderboard values without estimating missing values.
Source code in agent_k/scientist.py
88 89 90 91 92 93 94 95 96 97 | |
search_papers
async
search_papers(
ctx: RunContext[ScientistDeps], query: str
) -> list[_Paper] | str
Search arXiv for a bounded set of relevant primary research sources.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ctx
|
RunContext[ScientistDeps]
|
Research dependencies for the current mission. |
required |
query
|
str
|
Plain keywords describing the technique or problem to look up. |
required |
Source code in agent_k/scientist.py
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 | |
profile_report
profile_report(
profile: DatasetProfile, *, reason: str
) -> ResearchReport
Build a citation-free report from measured training-profile guidance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile
|
DatasetProfile
|
Training-only profile whose recommendations were derived from data. |
required |
reason
|
str
|
Why model-authored research is unavailable for this mission. |
required |
Returns:
| Type | Description |
|---|---|
ResearchReport
|
A report that states its provenance and claims no external evidence. |
Source code in agent_k/scientist.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
Bridge mission events and artifacts to the fenced worker API.
(c) Mike Casale 2026. Licensed under the MIT License.
MissionTracker
dataclass
Serialize worker writes with deterministic event identities.
Source code in agent_k/tracking.py
25 26 27 28 29 30 31 32 33 34 35 36 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 | |
append_event
async
append_event(
mission_id: str,
event_type: EventType,
data: EventData,
*,
timestamp: datetime,
) -> AgentKEvent
Persist an event before returning its browser representation.
Source code in agent_k/tracking.py
34 35 36 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 | |
upload
async
upload(path: Path, *, role: str) -> ArtifactReference
Upload an immutable artifact through a scoped, expiring URL.
Source code in agent_k/tracking.py
66 67 68 69 70 71 72 73 74 | |
OpenEvolve orchestration and independent sandbox scoring.
(c) Mike Casale 2026. Licensed under the MIT License.
EvolutionSettings
Bases: BaseModel
A single source of truth for the native OpenEvolve search.
Source code in agent_k/evolution.py
56 57 58 59 60 61 62 63 64 65 66 67 | |
guidance
class-attribute
instance-attribute
guidance: tuple[str, ...] = ()
Advisory research recommendations; never treated as measured evidence.
EvolutionContext
Bases: BaseModel
Host-only evaluator configuration; this file is never mounted in a candidate.
Source code in agent_k/evolution.py
70 71 72 73 74 75 76 77 78 79 | |
EvolutionOutcome
Bases: BaseModel
A fully evaluated candidate with native-search provenance.
Source code in agent_k/evolution.py
82 83 84 85 86 87 88 89 90 91 | |
write_seed_program
write_seed_program(path: Path) -> None
Write the executable baseline that OpenEvolve may mutate inside isolation.
Source code in agent_k/evolution.py
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 | |
build_system_message
build_system_message(
spec: CandidateSpec,
baseline: EvaluationResult,
settings: EvolutionSettings,
) -> str
Compose the mutation prompt from the candidate contract and advisory research.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
CandidateSpec
|
Validation candidate contract whose engine and problem stay fixed. |
required |
baseline
|
EvaluationResult
|
Trusted validation score the search must beat. |
required |
settings
|
EvolutionSettings
|
Search settings carrying bounded research guidance. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Instructions naming the measured objective, the accepted hyperparameters, |
str
|
and research recommendations labeled as unverified. |
Source code in agent_k/evolution.py
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 | |
evaluate_program
evaluate_program(
program_path: Path, context: EvolutionContext
) -> EvaluationResult
Run untrusted code in Docker, then score its predictions with hidden labels.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
program_path
|
Path
|
Candidate Python file mounted read-only into the container. |
required |
context
|
EvolutionContext
|
Trusted split, prediction contract, immutable image, and runtime limits. |
required |
Returns:
| Type | Description |
|---|---|
EvaluationResult
|
A host-computed score after identity, checksum, schema, and row validation. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Candidate execution fails or its output violates the contract. |
OSError
|
Required candidate inputs or result artifacts cannot be read. |
Hidden labels remain on the host. Candidate stdout and claimed scores never determine the returned fitness.
Source code in agent_k/evolution.py
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 | |
evaluate_stage1
evaluate_stage1(program_path: str) -> dict[str, float]
Give syntactically valid code partial fidelity, always below complete results.
Source code in agent_k/evolution.py
250 251 252 253 254 255 256 257 258 259 | |
evaluate_stage2
evaluate_stage2(program_path: str) -> EvaluationResult
Perform full validation scoring after the cheap syntax gate.
Source code in agent_k/evolution.py
262 263 264 | |
evaluate
evaluate(program_path: str) -> EvaluationResult
OpenEvolve evaluator entry point loaded in the isolated mission's process pool.
Source code in agent_k/evolution.py
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 | |
run_evolution
async
run_evolution(
*,
initial_program: Path,
baseline: EvaluationResult,
context: EvolutionContext,
settings: EvolutionSettings,
checkpoint_callback: Callable[
[Path, int], Awaitable[None]
],
checkpoint_path: Path | None = None,
) -> EvolutionOutcome
Run the sole native evolution loop and independently revalidate its winner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_program
|
Path
|
Existing seed program executed only inside the sandbox. |
required |
baseline
|
EvaluationResult
|
Trusted validation score for the seed program. |
required |
context
|
EvolutionContext
|
Host-only evaluation inputs, hidden-label paths, and sandbox limits. |
required |
settings
|
EvolutionSettings
|
Search budget, model specifications, and evaluation concurrency. |
required |
checkpoint_callback
|
Callable[[Path, int], Awaitable[None]]
|
Persist each native checkpoint before reporting progress. |
required |
checkpoint_path
|
Path | None
|
Optional verified native checkpoint from a previous attempt. |
None
|
Returns:
| Type | Description |
|---|---|
EvolutionOutcome
|
The independently validated winner, or the measured baseline when search fails |
EvolutionOutcome
|
to produce an eligible improvement, with iteration and checkpoint provenance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
No evolution model is configured or a contract is invalid. |
Exception
|
Native search, sandbox execution, or durable checkpointing fails. |
Source code in agent_k/evolution.py
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 | |
validate_model_specs
validate_model_specs(specs: Sequence[str]) -> None
Reject evolution models that cannot be reached before a mission spends its budget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
specs
|
Sequence[str]
|
Ordered model specifications for the native search. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
No model is configured, a provider is unsupported, or a required provider credential is absent from the environment. |
Source code in agent_k/evolution.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |