Skip to content

Commit df1e7a4

Browse files
authored
Merge pull request #345 from tinyhumansai/harness-uplift/tasks-crate
refactor: extract tinyagents-tasks crate (D11 phase 2)
2 parents 5d32281 + 960caaa commit df1e7a4

40 files changed

Lines changed: 160 additions & 57 deletions

‎AGENTS.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ compatibility facade crate: consumers depend directly on the focused package
77
that owns an API. The public packages are `crates/tinyagents-graph/` (durable
88
typed state graphs), `crates/tinyagents-harness/` (provider-neutral model
99
calls, tools, middleware, and streaming), `crates/tinyagents-registry/` (the named
10-
capability catalog), `crates/tinyagents-session/` (durable session data), and
10+
capability catalog), `crates/tinyagents-session/` (durable session data),
11+
`crates/tinyagents-tasks/` (graph-independent detached-task registry,
12+
task stores and orchestration controls), and
1113
`crates/tinyagents-orchestration/` (direct and durable subagent invocation,
1214
tools, sessions, lifecycle logic, and focused tests).
1315
`crates/tinyagents-tracing/` supplies shared opt-in tracing macros, while

‎Cargo.lock‎

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ members = ["crates/*"]
33
default-members = [
44
"crates/tinyagents-harness",
55
"crates/tinyagents-graph",
6+
"crates/tinyagents-tasks",
67
"crates/tinyagents-registry",
78
"crates/tinyagents-session",
89
"crates/tinyagents-runtime",

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ TinyAgents is a Cargo workspace, not one crate. Depend on the pieces you need:
3434
`START`/`END`, nodes, conditional edges, `Send` fanout, reducers/channels,
3535
checkpoints, interrupts, subgraphs, and time travel. Features: `sqlite`,
3636
`tracing`.
37+
- **`tinyagents-tasks`** — graph-independent detached-task machinery: task
38+
model, `TaskStore` (in-memory and JSONL), `DetachedTaskRegistry`, restart
39+
reconciliation, and the `spawn`/`await`/`cancel`/`steer` orchestration tools.
40+
Re-exported from `tinyagents_graph::orchestration` for compatibility.
3741
- **`tinyagents-registry`** — a named capability catalog (models, tools,
3842
agents, graphs, and routers), plus an offline model price/capability catalog.
3943
- **`tinyagents-session`** — a SQLite-backed store for session history,

‎crates/tinyagents-graph/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ futures = { workspace = true }
1515
rusqlite = { workspace = true, optional = true }
1616
serde = { workspace = true }
1717
serde_json = { workspace = true }
18+
tinyagents-tasks = { path = "../tinyagents-tasks", version = "2.1.3", default-features = false }
1819
tinyagents-harness = { path = "../tinyagents-harness", version = "2.1.3", default-features = false, features = [
1920
"langfuse",
2021
] }

‎crates/tinyagents-graph/src/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ carry their own `README.md` — see the module map below.
2525
| `export` | Graph introspection/visualization: topology extraction, Mermaid/JSON export, validation reports. |
2626
| `goals` | A durable per-thread goal (single "completion contract"), continuation loop, and harness tools. See [`goals/README.md`](goals/README.md). |
2727
| `observability` | Durable graph observability: journals, status stores, the journaling sink, latency/health rollups, Langfuse export. See [`observability/README.md`](observability/README.md). |
28-
| `orchestration` | Managed child-work controls (`spawn`/`await`/`cancel`/... ) exposed as harness tools, backed by a `TaskStore`. See [`orchestration/README.md`](orchestration/README.md). |
28+
| `orchestration` | Managed child-work controls (`spawn`/`await`/`cancel`/... ) exposed as harness tools, backed by a `TaskStore`. Now lives in `tinyagents-tasks` ([README](../../tinyagents-tasks/src/README.md)); this module only re-exports it for compatibility. |
2929
| `parallel` | `map_reduce` — ordered, bounded-concurrency parallel map/reduce with a configurable failure policy, independent of the graph executor. |
3030
| `recursion` | Recursion policy and depth tracking: `RecursionFrame`/`RecursionPolicy`/`RecursionStack`/`RunTree` bound and observe nested graph/subgraph/sub-agent recursion. See [`recursion/README.md`](recursion/README.md). |
3131
| `reducer` | `StateReducer`/`Reducer` implementations (overwrite, append, min/max, set-union, closures) that fold branch updates into committed state at a superstep boundary. See [`reducer/README.md`](reducer/README.md). |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//! Compatibility shim: the detached-task machinery moved to `tinyagents-tasks`.
2+
//!
3+
//! Every item formerly defined here is re-exported unchanged so existing
4+
//! `tinyagents_graph::orchestration::*` paths keep compiling. The shim is
5+
//! permanent for now; prefer `tinyagents_tasks` in new code.
6+
7+
pub use tinyagents_tasks::*;
8+
9+
#[cfg(test)]
10+
#[path = "orchestration_tests.rs"]
11+
mod tests;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//! The old graph paths must keep resolving after the move to `tinyagents-tasks`.
2+
3+
use crate::orchestration::{
4+
DetachedTaskRegistry, InMemoryTaskStore, JsonlTaskStore, OrchestrationTaskStatus,
5+
SteeringRegistry, TaskStore, TaskStoreRegistry, reconcile_orphaned_tasks,
6+
};
7+
8+
#[test]
9+
fn old_graph_paths_are_the_tasks_crate_types() {
10+
fn same<T>(_: std::marker::PhantomData<T>, _: std::marker::PhantomData<T>) {}
11+
same(
12+
std::marker::PhantomData::<crate::OrchestrationTaskStatus>,
13+
std::marker::PhantomData::<tinyagents_tasks::OrchestrationTaskStatus>,
14+
);
15+
same(
16+
std::marker::PhantomData::<OrchestrationTaskStatus>,
17+
std::marker::PhantomData::<tinyagents_tasks::OrchestrationTaskStatus>,
18+
);
19+
same(
20+
std::marker::PhantomData::<SteeringRegistry>,
21+
std::marker::PhantomData::<tinyagents_tasks::SteeringRegistry>,
22+
);
23+
let _ = std::marker::PhantomData::<(
24+
InMemoryTaskStore,
25+
JsonlTaskStore,
26+
TaskStoreRegistry<u8>,
27+
DetachedTaskRegistry<(), ()>,
28+
Box<dyn TaskStore>,
29+
)>;
30+
let _ = reconcile_orphaned_tasks;
31+
}

‎crates/tinyagents-graph/src/testkit/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ caller-supplied adapter — can be certified by running the same assertions:
7171
ordering/limit/cycle-termination, `copy_thread` semantics (including
7272
rejecting a non-empty target), and per-namespace `prune`.
7373
- `taskstore_contract(store)` — basic CRUD/lifecycle contract for a
74-
`graph::orchestration::TaskStore` implementation.
74+
`tinyagents_tasks::TaskStore` implementation.
7575
- `taskstore_concurrent_contract(store: Arc<S>)` — concurrent-access contract
7676
(no lost updates, no corrupted records under concurrent writers).
7777
- `taskstore_replay_contract(reopen)` — durability contract: a store reopened

‎crates/tinyagents-orchestration/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ serde_json = { workspace = true }
1717
thiserror = "2"
1818
parking_lot = "0.12"
1919
tinyagents-graph = { path = "../tinyagents-graph", version = "2.1.3", default-features = false }
20+
tinyagents-tasks = { path = "../tinyagents-tasks", version = "2.1.3", default-features = false }
2021
tinyagents-harness = { path = "../tinyagents-harness", version = "2.1.3", default-features = false }
2122
tinyagents-session = { path = "../tinyagents-session", version = "2.1.3", default-features = false }
2223
tinyagents-runtime = { path = "../tinyagents-runtime", version = "2.1.3", default-features = false }

0 commit comments

Comments
 (0)