web-cortex-framework 2.6.0__tar.gz → 2.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/Cargo.lock +55 -22
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/Cargo.toml +2 -2
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/PKG-INFO +64 -6
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/README.md +63 -5
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/agent/provider.rs +47 -1
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/agent/registry.rs +32 -2
- web_cortex_framework-2.8.0/crates/webcortex-core/src/agent/replay.rs +341 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/agent/session.rs +76 -5
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/agent.rs +353 -16
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/app.rs +224 -28
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/bridge.rs +3 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/errors.rs +14 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/flow.rs +46 -11
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/http.rs +59 -8
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/lib.rs +4 -2
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/manifest.rs +147 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/mcp.rs +37 -0
- web_cortex_framework-2.8.0/crates/webcortex-core/src/schema.rs +317 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/server.rs +151 -5
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/status.rs +6 -1
- web_cortex_framework-2.8.0/crates/webcortex-core/src/trace.rs +749 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/ws.rs +139 -16
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/tests/diagnostics.rs +3 -1
- web_cortex_framework-2.8.0/crates/webcortex-core/tests/evidence.rs +570 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-py/src/behaviour.rs +69 -3
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-py/src/lib.rs +123 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/pyproject.toml +1 -1
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/__init__.py +1 -1
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/_bridge.py +173 -16
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/app.py +403 -4
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/cli.py +78 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/contextpack.py +45 -2
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/diagnostics.py +148 -0
- web_cortex_framework-2.8.0/python/webcortex/evals.py +533 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/starters.py +30 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/LICENSE +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/Cargo.toml +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/agent/vision.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/audit.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/auth.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/context.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/db.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/devices.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/files.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/ledger.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/middleware.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/openapi.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/router.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/templates.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-core/src/typegen.rs +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/crates/webcortex-py/Cargo.toml +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/client.py +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/errors.py +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/media.py +0 -0
- {web_cortex_framework-2.6.0 → web_cortex_framework-2.8.0}/python/webcortex/schema.py +0 -0
|
@@ -252,9 +252,9 @@ dependencies = [
|
|
|
252
252
|
|
|
253
253
|
[[package]]
|
|
254
254
|
name = "ctutils"
|
|
255
|
-
version = "0.4.
|
|
255
|
+
version = "0.4.6"
|
|
256
256
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
257
|
-
checksum = "
|
|
257
|
+
checksum = "fe3e9d21d39e6f39ff46e03d5b621424f88ee23d8a1672c6bfc9ccc7f2da4f6a"
|
|
258
258
|
dependencies = [
|
|
259
259
|
"cmov",
|
|
260
260
|
]
|
|
@@ -1048,11 +1048,20 @@ version = "0.2.16"
|
|
|
1048
1048
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1049
1049
|
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
|
1050
1050
|
|
|
1051
|
+
[[package]]
|
|
1052
|
+
name = "libredox"
|
|
1053
|
+
version = "0.1.25"
|
|
1054
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1055
|
+
checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d"
|
|
1056
|
+
dependencies = [
|
|
1057
|
+
"libc",
|
|
1058
|
+
]
|
|
1059
|
+
|
|
1051
1060
|
[[package]]
|
|
1052
1061
|
name = "libsqlite3-sys"
|
|
1053
|
-
version = "0.
|
|
1062
|
+
version = "0.39.1"
|
|
1054
1063
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1055
|
-
checksum = "
|
|
1064
|
+
checksum = "14a5f01b87b92705d07b433c06f96cbc764637d81a0bffb5734ce17cf0f9a2b3"
|
|
1056
1065
|
dependencies = [
|
|
1057
1066
|
"cc",
|
|
1058
1067
|
"pkg-config",
|
|
@@ -1230,6 +1239,24 @@ dependencies = [
|
|
|
1230
1239
|
"libm",
|
|
1231
1240
|
]
|
|
1232
1241
|
|
|
1242
|
+
[[package]]
|
|
1243
|
+
name = "objc2-core-foundation"
|
|
1244
|
+
version = "0.3.2"
|
|
1245
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1246
|
+
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
|
|
1247
|
+
dependencies = [
|
|
1248
|
+
"bitflags",
|
|
1249
|
+
]
|
|
1250
|
+
|
|
1251
|
+
[[package]]
|
|
1252
|
+
name = "objc2-system-configuration"
|
|
1253
|
+
version = "0.3.2"
|
|
1254
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1255
|
+
checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396"
|
|
1256
|
+
dependencies = [
|
|
1257
|
+
"objc2-core-foundation",
|
|
1258
|
+
]
|
|
1259
|
+
|
|
1233
1260
|
[[package]]
|
|
1234
1261
|
name = "once_cell"
|
|
1235
1262
|
version = "1.21.4"
|
|
@@ -1496,9 +1523,9 @@ dependencies = [
|
|
|
1496
1523
|
|
|
1497
1524
|
[[package]]
|
|
1498
1525
|
name = "quinn-udp"
|
|
1499
|
-
version = "0.5.
|
|
1526
|
+
version = "0.5.16"
|
|
1500
1527
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1501
|
-
checksum = "
|
|
1528
|
+
checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016"
|
|
1502
1529
|
dependencies = [
|
|
1503
1530
|
"cfg_aliases",
|
|
1504
1531
|
"libc",
|
|
@@ -1957,9 +1984,9 @@ dependencies = [
|
|
|
1957
1984
|
|
|
1958
1985
|
[[package]]
|
|
1959
1986
|
name = "sqlx"
|
|
1960
|
-
version = "0.9.
|
|
1987
|
+
version = "0.9.1"
|
|
1961
1988
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1962
|
-
checksum = "
|
|
1989
|
+
checksum = "edb1dddfbdfe5fb99dba0541a87b2edb8adbd59e45815db22d32d4fbbb8813dd"
|
|
1963
1990
|
dependencies = [
|
|
1964
1991
|
"sqlx-core",
|
|
1965
1992
|
"sqlx-macros",
|
|
@@ -1969,9 +1996,9 @@ dependencies = [
|
|
|
1969
1996
|
|
|
1970
1997
|
[[package]]
|
|
1971
1998
|
name = "sqlx-core"
|
|
1972
|
-
version = "0.9.
|
|
1999
|
+
version = "0.9.1"
|
|
1973
2000
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1974
|
-
checksum = "
|
|
2001
|
+
checksum = "c08f9787cc5aff062567dea2205f8ae37a617b04342633ab4f74944858ea6072"
|
|
1975
2002
|
dependencies = [
|
|
1976
2003
|
"base64 0.22.1",
|
|
1977
2004
|
"bytes",
|
|
@@ -1992,7 +2019,7 @@ dependencies = [
|
|
|
1992
2019
|
"percent-encoding",
|
|
1993
2020
|
"serde",
|
|
1994
2021
|
"serde_json",
|
|
1995
|
-
"sha2 0.
|
|
2022
|
+
"sha2 0.11.0",
|
|
1996
2023
|
"smallvec",
|
|
1997
2024
|
"thiserror",
|
|
1998
2025
|
"tokio",
|
|
@@ -2003,9 +2030,9 @@ dependencies = [
|
|
|
2003
2030
|
|
|
2004
2031
|
[[package]]
|
|
2005
2032
|
name = "sqlx-macros"
|
|
2006
|
-
version = "0.9.
|
|
2033
|
+
version = "0.9.1"
|
|
2007
2034
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2008
|
-
checksum = "
|
|
2035
|
+
checksum = "bf62c58a1e7fd6031ee684eee21d07572f5aebe71c273a01ae4f04eeeba47c47"
|
|
2009
2036
|
dependencies = [
|
|
2010
2037
|
"proc-macro2",
|
|
2011
2038
|
"quote",
|
|
@@ -2016,9 +2043,9 @@ dependencies = [
|
|
|
2016
2043
|
|
|
2017
2044
|
[[package]]
|
|
2018
2045
|
name = "sqlx-macros-core"
|
|
2019
|
-
version = "0.9.
|
|
2046
|
+
version = "0.9.1"
|
|
2020
2047
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2021
|
-
checksum = "
|
|
2048
|
+
checksum = "c1ff75c9d609ac84aa8a3e0d92b5c0c54bf541a7f70db492fb40c9a4bea792c8"
|
|
2022
2049
|
dependencies = [
|
|
2023
2050
|
"cfg-if",
|
|
2024
2051
|
"dotenvy",
|
|
@@ -2029,7 +2056,7 @@ dependencies = [
|
|
|
2029
2056
|
"quote",
|
|
2030
2057
|
"serde",
|
|
2031
2058
|
"serde_json",
|
|
2032
|
-
"sha2 0.
|
|
2059
|
+
"sha2 0.11.0",
|
|
2033
2060
|
"sqlx-core",
|
|
2034
2061
|
"sqlx-postgres",
|
|
2035
2062
|
"sqlx-sqlite",
|
|
@@ -2040,9 +2067,9 @@ dependencies = [
|
|
|
2040
2067
|
|
|
2041
2068
|
[[package]]
|
|
2042
2069
|
name = "sqlx-postgres"
|
|
2043
|
-
version = "0.9.
|
|
2070
|
+
version = "0.9.1"
|
|
2044
2071
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2045
|
-
checksum = "
|
|
2072
|
+
checksum = "b0e9e02f764a1fe640eeefc8eb33eeddd274204654ec9f2db8ff851a1dee2364"
|
|
2046
2073
|
dependencies = [
|
|
2047
2074
|
"atoi",
|
|
2048
2075
|
"base64 0.22.1",
|
|
@@ -2075,9 +2102,9 @@ dependencies = [
|
|
|
2075
2102
|
|
|
2076
2103
|
[[package]]
|
|
2077
2104
|
name = "sqlx-sqlite"
|
|
2078
|
-
version = "0.9.
|
|
2105
|
+
version = "0.9.1"
|
|
2079
2106
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2080
|
-
checksum = "
|
|
2107
|
+
checksum = "88b6b78a34ddcb1db4046d462db8f79cee811019d7297b99fca8fac5de26672e"
|
|
2081
2108
|
dependencies = [
|
|
2082
2109
|
"atoi",
|
|
2083
2110
|
"flume",
|
|
@@ -2662,7 +2689,7 @@ dependencies = [
|
|
|
2662
2689
|
|
|
2663
2690
|
[[package]]
|
|
2664
2691
|
name = "webcortex-core"
|
|
2665
|
-
version = "2.
|
|
2692
|
+
version = "2.8.0"
|
|
2666
2693
|
dependencies = [
|
|
2667
2694
|
"base64 0.23.1",
|
|
2668
2695
|
"bytes",
|
|
@@ -2690,7 +2717,7 @@ dependencies = [
|
|
|
2690
2717
|
|
|
2691
2718
|
[[package]]
|
|
2692
2719
|
name = "webcortex-py"
|
|
2693
|
-
version = "2.
|
|
2720
|
+
version = "2.8.0"
|
|
2694
2721
|
dependencies = [
|
|
2695
2722
|
"bytes",
|
|
2696
2723
|
"futures",
|
|
@@ -2716,6 +2743,12 @@ name = "whoami"
|
|
|
2716
2743
|
version = "2.1.2"
|
|
2717
2744
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2718
2745
|
checksum = "998767ef88740d1f5b0682a9c53c24431453923962269c2db68ee43788c5a40d"
|
|
2746
|
+
dependencies = [
|
|
2747
|
+
"libc",
|
|
2748
|
+
"libredox",
|
|
2749
|
+
"objc2-system-configuration",
|
|
2750
|
+
"web-sys",
|
|
2751
|
+
]
|
|
2719
2752
|
|
|
2720
2753
|
[[package]]
|
|
2721
2754
|
name = "windows-link"
|
|
@@ -3,10 +3,10 @@ members = ["crates/webcortex-core", "crates/webcortex-py"]
|
|
|
3
3
|
resolver = "3"
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "2.
|
|
6
|
+
version = "2.8.0"
|
|
7
7
|
edition = "2024"
|
|
8
8
|
license = "Apache-2.0"
|
|
9
|
-
rust-version = "1.
|
|
9
|
+
rust-version = "1.94"
|
|
10
10
|
repository = "https://github.com/slimboi34/web_cortex_framework"
|
|
11
11
|
homepage = "https://github.com/slimboi34/web_cortex_framework"
|
|
12
12
|
documentation = "https://docs.rs/webcortex-core"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: web-cortex-framework
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -284,6 +284,60 @@ app.pricing("claude-opus-5", input_per_mtok=5, output_per_mtok=25)
|
|
|
284
284
|
flow and model, and dollars where you declared prices — `null`, not zero,
|
|
285
285
|
where you did not.
|
|
286
286
|
|
|
287
|
+
## Evidence: typed answers, traces, evals
|
|
288
|
+
|
|
289
|
+
New in 2.8: what an agent answered, what a run did, and whether it still does it.
|
|
290
|
+
|
|
291
|
+
```python
|
|
292
|
+
@dataclass
|
|
293
|
+
class Triage:
|
|
294
|
+
category: Literal["bug", "billing", "other"]
|
|
295
|
+
urgency: int
|
|
296
|
+
|
|
297
|
+
app.agent("triage", system="Classify the ticket.", output=Triage)
|
|
298
|
+
app.agent("local", model="ollama/qwen3.5:9b", options={"seed": 7, "keep_alive": "30m"})
|
|
299
|
+
|
|
300
|
+
app.eval("refund_goes_to_billing", target="front_desk", input="I was charged twice",
|
|
301
|
+
expect={"path": ["front_desk", "billing"], "tools_called": ["lookup_invoice"],
|
|
302
|
+
"max_tokens": 6000})
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
- **Structured output.** `output=` is a dataclass, a `TypedDict` or a JSON Schema. The agent
|
|
306
|
+
answers through a `final_answer` tool and the *runtime* validates it: a mismatch goes back
|
|
307
|
+
to the model with the list of problems, twice, then the run fails with `WC318`. The result
|
|
308
|
+
carries the object as `data`, and a flow hands it to the next step as an object.
|
|
309
|
+
[docs](docs/structured-output.md)
|
|
310
|
+
- **Request options.** `options=` passes provider-specific fields straight into the request
|
|
311
|
+
body (`seed`, `top_p`, `keep_alive`, `thinking`, …) per agent, per behaviour or per
|
|
312
|
+
provider, without a keyword for each. `None` removes a field. Still not a universal LLM
|
|
313
|
+
abstraction: nothing is interpreted or renamed. [docs](docs/request-options.md)
|
|
314
|
+
- **Traces.** Every agent, flow and behaviour run is a span tree: the run, each model call
|
|
315
|
+
with its tokens, each tool call, nested runs under the call that started them. `webcortex
|
|
316
|
+
trace`, `GET /_webcortex/traces`, the `webcortex_trace` MCP tool, and OTLP/HTTP export to
|
|
317
|
+
the collector you already run. An incoming W3C `traceparent` is joined. Spans hold names,
|
|
318
|
+
timings, token counts and error codes, never prompts or results. [docs](docs/tracing.md)
|
|
319
|
+
- **Evals with cassettes.** `webcortex eval --record` keeps the model's responses;
|
|
320
|
+
afterwards evals replay them in-process with no key and no tokens, while your tools,
|
|
321
|
+
scopes, handoffs, budgets and flows run for real. Change an agent's prompt, model, tools or
|
|
322
|
+
options and its recording goes stale (`WC319`) instead of passing on old answers.
|
|
323
|
+
[docs](docs/evals.md)
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
$ webcortex trace latest
|
|
327
|
+
trace 7d1c…e02a ok 2.41s 4 model call(s) 2 tool call(s) 1830 tokens
|
|
328
|
+
agent front_desk 2.41s completed
|
|
329
|
+
└ chat default 0.61s 412 in / 38 out
|
|
330
|
+
└ tool billing 1.52s
|
|
331
|
+
└ agent billing 1.52s completed
|
|
332
|
+
└ chat default 0.58s 390 in / 41 out
|
|
333
|
+
└ tool lookup_invoice 3ms
|
|
334
|
+
└ chat default 0.90s 455 in / 96 out
|
|
335
|
+
└ chat default 0.27s 362 in / 36 out
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
(The tree's shape is what the command prints; the timings and token counts above are an
|
|
339
|
+
illustration, not a measurement.)
|
|
340
|
+
|
|
287
341
|
## Context and memory
|
|
288
342
|
|
|
289
343
|
```python
|
|
@@ -501,6 +555,8 @@ webcortex keygen mint an API key
|
|
|
501
555
|
webcortex doctor check the app is ready to run (exit 1 on a failure)
|
|
502
556
|
webcortex status the running app's live view: requests, errors, runs, spend, devices
|
|
503
557
|
webcortex explain CODE what an error code means; --list for all of them
|
|
558
|
+
webcortex trace [ID] what a recent run did, as a span tree; `latest` for the newest
|
|
559
|
+
webcortex eval run the declared evals; --record | --replay | --live
|
|
504
560
|
webcortex halt | release the emergency stop for actuators
|
|
505
561
|
```
|
|
506
562
|
|
|
@@ -527,7 +583,7 @@ tested, the known limits, and what v2 added to the surface.
|
|
|
527
583
|
|
|
528
584
|
## Status
|
|
529
585
|
|
|
530
|
-
v2.
|
|
586
|
+
v2.8.0. Working and tested: the manifest IR, router, native ops (static /
|
|
531
587
|
query / proxy / page / files / flow), the free-threaded Python bridge,
|
|
532
588
|
authentication and scopes, rate limiting, CORS, security headers, graceful
|
|
533
589
|
shutdown, Behaviours with concurrent leaves, the agent runtime with handoffs,
|
|
@@ -537,11 +593,13 @@ OpenAI-compatible, which covers local models), prompt caching, the spend
|
|
|
537
593
|
ledger, the audit trail, OpenAPI, the MCP server, TypeScript generation, the
|
|
538
594
|
context pack and `evolve`, images in and out of agent runs and MCP, actuators
|
|
539
595
|
and the emergency stop, the device hub (cameras, sensors, watchers, WebSocket
|
|
540
|
-
ingest and streams, agents over WebSocket),
|
|
596
|
+
ingest and streams, agents over WebSocket), diagnostics (stable error codes
|
|
541
597
|
with hints on every failure, `webcortex doctor`, the live `/_webcortex/status`
|
|
542
|
-
view and its MCP tool)
|
|
543
|
-
|
|
544
|
-
|
|
598
|
+
view and its MCP tool), and, new in 2.8, structured agent output validated by
|
|
599
|
+
the runtime, provider request options, run traces with OTLP export, and evals
|
|
600
|
+
that replay recorded model responses. **961 tests** (284 Rust, 677 Python,
|
|
601
|
+
including a 54-test adversarial suite and offline end-to-end suites that drive
|
|
602
|
+
the whole agent stack over HTTP), clippy clean.
|
|
545
603
|
|
|
546
604
|
Not yet: Postgres, token-level SSE streaming, durable agent runs that survive a
|
|
547
605
|
restart. See [DESIGN.md](DESIGN.md) for the roadmap, honest risk grading, and —
|
|
@@ -256,6 +256,60 @@ app.pricing("claude-opus-5", input_per_mtok=5, output_per_mtok=25)
|
|
|
256
256
|
flow and model, and dollars where you declared prices — `null`, not zero,
|
|
257
257
|
where you did not.
|
|
258
258
|
|
|
259
|
+
## Evidence: typed answers, traces, evals
|
|
260
|
+
|
|
261
|
+
New in 2.8: what an agent answered, what a run did, and whether it still does it.
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
@dataclass
|
|
265
|
+
class Triage:
|
|
266
|
+
category: Literal["bug", "billing", "other"]
|
|
267
|
+
urgency: int
|
|
268
|
+
|
|
269
|
+
app.agent("triage", system="Classify the ticket.", output=Triage)
|
|
270
|
+
app.agent("local", model="ollama/qwen3.5:9b", options={"seed": 7, "keep_alive": "30m"})
|
|
271
|
+
|
|
272
|
+
app.eval("refund_goes_to_billing", target="front_desk", input="I was charged twice",
|
|
273
|
+
expect={"path": ["front_desk", "billing"], "tools_called": ["lookup_invoice"],
|
|
274
|
+
"max_tokens": 6000})
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
- **Structured output.** `output=` is a dataclass, a `TypedDict` or a JSON Schema. The agent
|
|
278
|
+
answers through a `final_answer` tool and the *runtime* validates it: a mismatch goes back
|
|
279
|
+
to the model with the list of problems, twice, then the run fails with `WC318`. The result
|
|
280
|
+
carries the object as `data`, and a flow hands it to the next step as an object.
|
|
281
|
+
[docs](docs/structured-output.md)
|
|
282
|
+
- **Request options.** `options=` passes provider-specific fields straight into the request
|
|
283
|
+
body (`seed`, `top_p`, `keep_alive`, `thinking`, …) per agent, per behaviour or per
|
|
284
|
+
provider, without a keyword for each. `None` removes a field. Still not a universal LLM
|
|
285
|
+
abstraction: nothing is interpreted or renamed. [docs](docs/request-options.md)
|
|
286
|
+
- **Traces.** Every agent, flow and behaviour run is a span tree: the run, each model call
|
|
287
|
+
with its tokens, each tool call, nested runs under the call that started them. `webcortex
|
|
288
|
+
trace`, `GET /_webcortex/traces`, the `webcortex_trace` MCP tool, and OTLP/HTTP export to
|
|
289
|
+
the collector you already run. An incoming W3C `traceparent` is joined. Spans hold names,
|
|
290
|
+
timings, token counts and error codes, never prompts or results. [docs](docs/tracing.md)
|
|
291
|
+
- **Evals with cassettes.** `webcortex eval --record` keeps the model's responses;
|
|
292
|
+
afterwards evals replay them in-process with no key and no tokens, while your tools,
|
|
293
|
+
scopes, handoffs, budgets and flows run for real. Change an agent's prompt, model, tools or
|
|
294
|
+
options and its recording goes stale (`WC319`) instead of passing on old answers.
|
|
295
|
+
[docs](docs/evals.md)
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
$ webcortex trace latest
|
|
299
|
+
trace 7d1c…e02a ok 2.41s 4 model call(s) 2 tool call(s) 1830 tokens
|
|
300
|
+
agent front_desk 2.41s completed
|
|
301
|
+
└ chat default 0.61s 412 in / 38 out
|
|
302
|
+
└ tool billing 1.52s
|
|
303
|
+
└ agent billing 1.52s completed
|
|
304
|
+
└ chat default 0.58s 390 in / 41 out
|
|
305
|
+
└ tool lookup_invoice 3ms
|
|
306
|
+
└ chat default 0.90s 455 in / 96 out
|
|
307
|
+
└ chat default 0.27s 362 in / 36 out
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
(The tree's shape is what the command prints; the timings and token counts above are an
|
|
311
|
+
illustration, not a measurement.)
|
|
312
|
+
|
|
259
313
|
## Context and memory
|
|
260
314
|
|
|
261
315
|
```python
|
|
@@ -473,6 +527,8 @@ webcortex keygen mint an API key
|
|
|
473
527
|
webcortex doctor check the app is ready to run (exit 1 on a failure)
|
|
474
528
|
webcortex status the running app's live view: requests, errors, runs, spend, devices
|
|
475
529
|
webcortex explain CODE what an error code means; --list for all of them
|
|
530
|
+
webcortex trace [ID] what a recent run did, as a span tree; `latest` for the newest
|
|
531
|
+
webcortex eval run the declared evals; --record | --replay | --live
|
|
476
532
|
webcortex halt | release the emergency stop for actuators
|
|
477
533
|
```
|
|
478
534
|
|
|
@@ -499,7 +555,7 @@ tested, the known limits, and what v2 added to the surface.
|
|
|
499
555
|
|
|
500
556
|
## Status
|
|
501
557
|
|
|
502
|
-
v2.
|
|
558
|
+
v2.8.0. Working and tested: the manifest IR, router, native ops (static /
|
|
503
559
|
query / proxy / page / files / flow), the free-threaded Python bridge,
|
|
504
560
|
authentication and scopes, rate limiting, CORS, security headers, graceful
|
|
505
561
|
shutdown, Behaviours with concurrent leaves, the agent runtime with handoffs,
|
|
@@ -509,11 +565,13 @@ OpenAI-compatible, which covers local models), prompt caching, the spend
|
|
|
509
565
|
ledger, the audit trail, OpenAPI, the MCP server, TypeScript generation, the
|
|
510
566
|
context pack and `evolve`, images in and out of agent runs and MCP, actuators
|
|
511
567
|
and the emergency stop, the device hub (cameras, sensors, watchers, WebSocket
|
|
512
|
-
ingest and streams, agents over WebSocket),
|
|
568
|
+
ingest and streams, agents over WebSocket), diagnostics (stable error codes
|
|
513
569
|
with hints on every failure, `webcortex doctor`, the live `/_webcortex/status`
|
|
514
|
-
view and its MCP tool)
|
|
515
|
-
|
|
516
|
-
|
|
570
|
+
view and its MCP tool), and, new in 2.8, structured agent output validated by
|
|
571
|
+
the runtime, provider request options, run traces with OTLP export, and evals
|
|
572
|
+
that replay recorded model responses. **961 tests** (284 Rust, 677 Python,
|
|
573
|
+
including a 54-test adversarial suite and offline end-to-end suites that drive
|
|
574
|
+
the whole agent stack over HTTP), clippy clean.
|
|
517
575
|
|
|
518
576
|
Not yet: Postgres, token-level SSE streaming, durable agent runs that survive a
|
|
519
577
|
restart. See [DESIGN.md](DESIGN.md) for the roadmap, honest risk grading, and —
|
|
@@ -373,9 +373,31 @@ pub fn anthropic_body(req: &CompletionRequest<'_>) -> Value {
|
|
|
373
373
|
body["tool_choice"] = json!({"type": "tool", "name": name});
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
+
apply_options(&mut body, &agent.options);
|
|
376
377
|
body
|
|
377
378
|
}
|
|
378
379
|
|
|
380
|
+
/// Merge an agent's request options into a provider request body.
|
|
381
|
+
///
|
|
382
|
+
/// Each key becomes a top-level field of the body, replacing whatever the
|
|
383
|
+
/// runtime put there; a `null` value removes the field instead (how
|
|
384
|
+
/// `max_tokens` is swapped for `max_completion_tokens` on models that insist).
|
|
385
|
+
/// The fields the tool loop depends on ([`crate::manifest::RESERVED_OPTIONS`])
|
|
386
|
+
/// are skipped here as well as refused at boot, so no path can clobber them.
|
|
387
|
+
pub fn apply_options(body: &mut Value, options: &crate::manifest::RequestOptions) {
|
|
388
|
+
let Some(map) = body.as_object_mut() else { return };
|
|
389
|
+
for (key, value) in options {
|
|
390
|
+
if crate::manifest::RESERVED_OPTIONS.contains(&key.as_str()) {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
if value.is_null() {
|
|
394
|
+
map.remove(key);
|
|
395
|
+
} else {
|
|
396
|
+
map.insert(key.clone(), value.clone());
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
379
401
|
pub fn parse_anthropic(payload: &Value, model: &str) -> Result<ProviderResponse, String> {
|
|
380
402
|
let content = payload
|
|
381
403
|
.get("content")
|
|
@@ -537,6 +559,7 @@ pub fn openai_body(req: &CompletionRequest) -> Value {
|
|
|
537
559
|
body["tool_choice"] = json!({"type": "function", "function": {"name": name}});
|
|
538
560
|
}
|
|
539
561
|
}
|
|
562
|
+
apply_options(&mut body, &agent.options);
|
|
540
563
|
body
|
|
541
564
|
}
|
|
542
565
|
|
|
@@ -1003,6 +1026,8 @@ impl ModelProvider for ScriptedProvider {
|
|
|
1003
1026
|
/// * `json:<object>` — when a tool is being forced, answer with it
|
|
1004
1027
|
/// * `context?` — answer with the resolved system suffix, so a
|
|
1005
1028
|
/// test can see what context providers injected
|
|
1029
|
+
/// * `options?` — answer with the request options the call
|
|
1030
|
+
/// carries (the provider's merged with the agent's), as JSON
|
|
1006
1031
|
/// * anything else — answered as text, prefixed by the agent name
|
|
1007
1032
|
///
|
|
1008
1033
|
/// After tool results come back the fake answers with a text summary of them,
|
|
@@ -1061,7 +1086,18 @@ impl ModelProvider for FakeProvider {
|
|
|
1061
1086
|
|
|
1062
1087
|
// A forced tool: structured output.
|
|
1063
1088
|
if let Some(forced) = req.force_tool {
|
|
1064
|
-
let prompt = last_text.clone().unwrap_or_default();
|
|
1089
|
+
let mut prompt = last_text.clone().unwrap_or_default();
|
|
1090
|
+
// A forced call that follows a correction (structured output
|
|
1091
|
+
// being repaired) answers from the newest earlier message that
|
|
1092
|
+
// carries `json:`, as a model would answer the original ask.
|
|
1093
|
+
if !prompt.contains("json:")
|
|
1094
|
+
&& let Some(earlier) = req.conversation.messages.iter().rev().find_map(|m| {
|
|
1095
|
+
let text = crate::agent::message_text(&m.content);
|
|
1096
|
+
(m.role == "user" && text.contains("json:")).then_some(text)
|
|
1097
|
+
})
|
|
1098
|
+
{
|
|
1099
|
+
prompt = earlier;
|
|
1100
|
+
}
|
|
1065
1101
|
// The first JSON value after `json:`, ignoring whatever follows
|
|
1066
1102
|
// it — a flow's classifier appends the input after the prompt.
|
|
1067
1103
|
let args = prompt
|
|
@@ -1121,6 +1157,16 @@ impl ModelProvider for FakeProvider {
|
|
|
1121
1157
|
);
|
|
1122
1158
|
}
|
|
1123
1159
|
|
|
1160
|
+
if text.trim() == "options?" {
|
|
1161
|
+
let reply = Value::Object(req.agent.options.clone()).to_string();
|
|
1162
|
+
return done(
|
|
1163
|
+
reply.clone(),
|
|
1164
|
+
Vec::new(),
|
|
1165
|
+
json!([{"type": "text", "text": reply}]),
|
|
1166
|
+
StopReason::EndTurn,
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1124
1170
|
// `fail:<message>` answers as a provider error would, so the failure
|
|
1125
1171
|
// path (codes, hints, the status view) is testable offline. Write
|
|
1126
1172
|
// the message the way a real provider error reads, e.g.
|
|
@@ -13,7 +13,7 @@ use super::provider::{
|
|
|
13
13
|
AnthropicProvider, CompletionRequest, FakeProvider, ModelProvider, OpenAiCompatProvider,
|
|
14
14
|
ProviderResponse,
|
|
15
15
|
};
|
|
16
|
-
use crate::manifest::{AgentDef, ModelsConfig, Price};
|
|
16
|
+
use crate::manifest::{AgentDef, ModelsConfig, Price, RequestOptions};
|
|
17
17
|
use futures::future::BoxFuture;
|
|
18
18
|
use std::collections::BTreeMap;
|
|
19
19
|
use std::sync::Arc;
|
|
@@ -29,6 +29,8 @@ pub struct ProviderRegistry {
|
|
|
29
29
|
openai: Option<Arc<dyn ModelProvider>>,
|
|
30
30
|
fake: Option<Arc<dyn ModelProvider>>,
|
|
31
31
|
pricing: BTreeMap<String, Price>,
|
|
32
|
+
/// Request options by provider name, merged beneath each agent's own.
|
|
33
|
+
options: BTreeMap<String, RequestOptions>,
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
impl ProviderRegistry {
|
|
@@ -122,9 +124,35 @@ impl ProviderRegistry {
|
|
|
122
124
|
openai,
|
|
123
125
|
fake,
|
|
124
126
|
pricing: cfg.pricing.clone(),
|
|
127
|
+
options: cfg.options.clone(),
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
|
|
131
|
+
/// The name of the provider a concrete model belongs to: its prefix, or
|
|
132
|
+
/// `openai` / `anthropic` for a bare name, by the same rule [`Self::route`]
|
|
133
|
+
/// uses. This is the key `app.provider(..., options=...)` and
|
|
134
|
+
/// `app.request_options(...)` store options under.
|
|
135
|
+
pub fn provider_name(concrete: &str) -> &str {
|
|
136
|
+
match concrete.split_once('/') {
|
|
137
|
+
Some((prefix, _)) => prefix,
|
|
138
|
+
None if concrete.starts_with("gpt-")
|
|
139
|
+
|| concrete.starts_with("o1")
|
|
140
|
+
|| concrete.starts_with("o3")
|
|
141
|
+
|| concrete.starts_with("o4") => "openai",
|
|
142
|
+
None => "anthropic",
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/// The request options a call to `concrete` carries: the provider's,
|
|
147
|
+
/// overridden key by key by the agent's.
|
|
148
|
+
pub fn options_for(&self, concrete: &str, own: &RequestOptions) -> RequestOptions {
|
|
149
|
+
let mut merged = self.options.get(Self::provider_name(concrete)).cloned().unwrap_or_default();
|
|
150
|
+
for (k, v) in own {
|
|
151
|
+
merged.insert(k.clone(), v.clone());
|
|
152
|
+
}
|
|
153
|
+
merged
|
|
154
|
+
}
|
|
155
|
+
|
|
128
156
|
/// Which providers are live, for the startup banner and `/_webcortex/models`.
|
|
129
157
|
pub fn describe(&self) -> serde_json::Value {
|
|
130
158
|
serde_json::json!({
|
|
@@ -134,6 +162,7 @@ impl ProviderRegistry {
|
|
|
134
162
|
"fake": self.fake.is_some(),
|
|
135
163
|
"prefixes": self.prefixed.iter().map(|(p, _)| p.clone()).collect::<Vec<_>>(),
|
|
136
164
|
"priced_models": self.pricing.keys().collect::<Vec<_>>(),
|
|
165
|
+
"options": self.options,
|
|
137
166
|
})
|
|
138
167
|
}
|
|
139
168
|
|
|
@@ -245,7 +274,8 @@ impl ModelProvider for ProviderRegistry {
|
|
|
245
274
|
let (provider, wire_name) = self.route(&concrete)?;
|
|
246
275
|
// The provider must see the stripped name; everything else about
|
|
247
276
|
// the request is unchanged.
|
|
248
|
-
let
|
|
277
|
+
let options = self.options_for(&concrete, &req.agent.options);
|
|
278
|
+
let def = AgentDef { model: wire_name, options, ..req.agent.clone() };
|
|
249
279
|
let inner = CompletionRequest {
|
|
250
280
|
agent: &def,
|
|
251
281
|
conversation: req.conversation,
|