@tangle-network/agent-runtime 0.1.0
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.
- package/README.md +69 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# agent-runtime
|
|
2
|
+
|
|
3
|
+
Reusable runtime lifecycle for domain-specific agents.
|
|
4
|
+
|
|
5
|
+
`agent-runtime` is the shared skeleton for tax, legal, GTM, creative,
|
|
6
|
+
agent-builder generated agents, blueprint-agent, redteam, and similar packages.
|
|
7
|
+
It does not own domain policy, tools, connectors, or UI. It standardizes the
|
|
8
|
+
task lifecycle and delegates domain behavior to an adapter.
|
|
9
|
+
|
|
10
|
+
```txt
|
|
11
|
+
TaskSpec
|
|
12
|
+
-> Knowledge readiness
|
|
13
|
+
-> Question / acquisition decision
|
|
14
|
+
-> Agent control loop
|
|
15
|
+
-> Eval / verification
|
|
16
|
+
-> Run evidence
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add @tangle-network/agent-runtime @tangle-network/agent-eval
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { runAgentTask } from '@tangle-network/agent-runtime'
|
|
29
|
+
|
|
30
|
+
const result = await runAgentTask({
|
|
31
|
+
task: {
|
|
32
|
+
id: 'tax-2026-return-review',
|
|
33
|
+
intent: 'Review the return for missing evidence',
|
|
34
|
+
domain: 'tax',
|
|
35
|
+
requiredKnowledge: [{
|
|
36
|
+
id: 'filing-status',
|
|
37
|
+
description: 'Taxpayer filing status',
|
|
38
|
+
requiredFor: ['return-review'],
|
|
39
|
+
category: 'user_specific',
|
|
40
|
+
acquisitionMode: 'ask_user',
|
|
41
|
+
importance: 'blocking',
|
|
42
|
+
freshness: 'static',
|
|
43
|
+
sensitivity: 'private',
|
|
44
|
+
confidenceNeeded: 1,
|
|
45
|
+
currentConfidence: 0,
|
|
46
|
+
evidenceIds: [],
|
|
47
|
+
fallbackPolicy: 'ask',
|
|
48
|
+
}],
|
|
49
|
+
},
|
|
50
|
+
adapter,
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If knowledge readiness fails, `runAgentTask` stops before domain actions by
|
|
55
|
+
default. Adapters can override `onKnowledgeBlocked` to emit a domain action,
|
|
56
|
+
such as asking a user, querying a connector, or inspecting a repo.
|
|
57
|
+
|
|
58
|
+
## Package Boundaries
|
|
59
|
+
|
|
60
|
+
- `agent-runtime` owns the reusable lifecycle and adapter contracts.
|
|
61
|
+
- `agent-eval` owns control loops, readiness scoring, traces, evals, failure
|
|
62
|
+
classes, optimization, and release evidence.
|
|
63
|
+
- `agent-knowledge` owns evidence, claims, wiki pages, retrieval, and knowledge
|
|
64
|
+
bundle builders.
|
|
65
|
+
- Domain packages own domain tools, policies, credentials, UI text, and rubrics.
|
|
66
|
+
|
|
67
|
+
The primary API intentionally uses `runAgentTask`, not `runVerticalAgentTask`.
|
|
68
|
+
`domain` is metadata on the task, because the runtime should be reusable across
|
|
69
|
+
many kinds of agents without baking taxonomy into type names.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ControlEvalResult, KnowledgeRequirement, ControlBudget, KnowledgeReadinessReport, ControlStep, ControlDecision, UserQuestion, DataAcquisitionPlan, ControlRunResult, RunRecord, TraceStore } from '@tangle-network/agent-eval';
|
|
2
|
+
export { ControlBudget, ControlDecision, ControlEvalResult, ControlRunResult, ControlStep, DataAcquisitionPlan, KnowledgeReadinessReport, KnowledgeRequirement, RunRecord, UserQuestion } from '@tangle-network/agent-eval';
|
|
3
|
+
|
|
4
|
+
interface AgentTaskSpec {
|
|
5
|
+
id: string;
|
|
6
|
+
intent: string;
|
|
7
|
+
/** Domain is metadata, not an architectural boundary: tax, legal, gtm, creative, blueprint, redteam, etc. */
|
|
8
|
+
domain?: string;
|
|
9
|
+
inputs?: Record<string, unknown>;
|
|
10
|
+
requiredKnowledge?: KnowledgeRequirement[];
|
|
11
|
+
budget?: Partial<ControlBudget>;
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
interface AgentKnowledgeProvider {
|
|
15
|
+
buildReadiness?(task: AgentTaskSpec): Promise<KnowledgeReadinessReport> | KnowledgeReadinessReport;
|
|
16
|
+
answerQuestions?(questions: UserQuestion[], task: AgentTaskSpec): Promise<Record<string, string>> | Record<string, string>;
|
|
17
|
+
executeAcquisitionPlans?(plans: DataAcquisitionPlan[], task: AgentTaskSpec): Promise<string[]> | string[];
|
|
18
|
+
}
|
|
19
|
+
interface AgentTaskContext<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
20
|
+
task: AgentTaskSpec;
|
|
21
|
+
knowledge: KnowledgeReadinessReport;
|
|
22
|
+
state: TState;
|
|
23
|
+
evals: TEval[];
|
|
24
|
+
history: ControlStep<TState, TAction, TActionResult, TEval>[];
|
|
25
|
+
budget: ControlBudget;
|
|
26
|
+
stepIndex: number;
|
|
27
|
+
wallMs: number;
|
|
28
|
+
spentCostUsd: number;
|
|
29
|
+
remainingCostUsd?: number;
|
|
30
|
+
abortSignal: AbortSignal;
|
|
31
|
+
}
|
|
32
|
+
interface AgentAdapter<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
33
|
+
observe(ctx: {
|
|
34
|
+
task: AgentTaskSpec;
|
|
35
|
+
knowledge: KnowledgeReadinessReport;
|
|
36
|
+
history: ControlStep<TState, TAction, TActionResult, TEval>[];
|
|
37
|
+
abortSignal: AbortSignal;
|
|
38
|
+
}): Promise<TState> | TState;
|
|
39
|
+
validate(ctx: {
|
|
40
|
+
task: AgentTaskSpec;
|
|
41
|
+
knowledge: KnowledgeReadinessReport;
|
|
42
|
+
state: TState;
|
|
43
|
+
history: ControlStep<TState, TAction, TActionResult, TEval>[];
|
|
44
|
+
abortSignal: AbortSignal;
|
|
45
|
+
}): Promise<TEval[]> | TEval[];
|
|
46
|
+
decide(ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<ControlDecision<TAction>> | ControlDecision<TAction>;
|
|
47
|
+
act(action: TAction, ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<TActionResult> | TActionResult;
|
|
48
|
+
shouldStop?(ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<{
|
|
49
|
+
stop: boolean;
|
|
50
|
+
pass: boolean;
|
|
51
|
+
reason: string;
|
|
52
|
+
score?: number;
|
|
53
|
+
}> | {
|
|
54
|
+
stop: boolean;
|
|
55
|
+
pass: boolean;
|
|
56
|
+
reason: string;
|
|
57
|
+
score?: number;
|
|
58
|
+
};
|
|
59
|
+
onKnowledgeBlocked?(ctx: {
|
|
60
|
+
task: AgentTaskSpec;
|
|
61
|
+
knowledge: KnowledgeReadinessReport;
|
|
62
|
+
questions: UserQuestion[];
|
|
63
|
+
acquisitionPlans: DataAcquisitionPlan[];
|
|
64
|
+
}): Promise<ControlDecision<TAction>> | ControlDecision<TAction>;
|
|
65
|
+
getActionCostUsd?(ctx: {
|
|
66
|
+
action: TAction;
|
|
67
|
+
result: TActionResult;
|
|
68
|
+
task: AgentTaskSpec;
|
|
69
|
+
state: TState;
|
|
70
|
+
evals: TEval[];
|
|
71
|
+
history: ControlStep<TState, TAction, TActionResult, TEval>[];
|
|
72
|
+
}): number | undefined;
|
|
73
|
+
projectRunRecords?(result: ControlRunResult<TState, TAction, TActionResult, TEval>, task: AgentTaskSpec): RunRecord[];
|
|
74
|
+
}
|
|
75
|
+
interface RunAgentTaskOptions<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
76
|
+
task: AgentTaskSpec;
|
|
77
|
+
adapter: AgentAdapter<TState, TAction, TActionResult, TEval>;
|
|
78
|
+
knowledge?: AgentKnowledgeProvider;
|
|
79
|
+
store?: TraceStore;
|
|
80
|
+
signal?: AbortSignal;
|
|
81
|
+
scenarioId?: string;
|
|
82
|
+
projectId?: string;
|
|
83
|
+
variantId?: string;
|
|
84
|
+
minimumReadinessScore?: number;
|
|
85
|
+
}
|
|
86
|
+
interface AgentTaskRunResult<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {
|
|
87
|
+
task: AgentTaskSpec;
|
|
88
|
+
knowledge: KnowledgeReadinessReport;
|
|
89
|
+
questions: UserQuestion[];
|
|
90
|
+
acquisitionPlans: DataAcquisitionPlan[];
|
|
91
|
+
control: ControlRunResult<TState, TAction, TActionResult, TEval>;
|
|
92
|
+
runRecords: RunRecord[];
|
|
93
|
+
}
|
|
94
|
+
declare function runAgentTask<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(options: RunAgentTaskOptions<TState, TAction, TActionResult, TEval>): Promise<AgentTaskRunResult<TState, TAction, TActionResult, TEval>>;
|
|
95
|
+
|
|
96
|
+
export { type AgentAdapter, type AgentKnowledgeProvider, type AgentTaskContext, type AgentTaskRunResult, type AgentTaskSpec, type RunAgentTaskOptions, runAgentTask };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
acquisitionPlansForKnowledgeGaps,
|
|
4
|
+
blockingKnowledgeEval,
|
|
5
|
+
runAgentControlLoop,
|
|
6
|
+
scoreKnowledgeReadiness,
|
|
7
|
+
userQuestionsForKnowledgeGaps
|
|
8
|
+
} from "@tangle-network/agent-eval";
|
|
9
|
+
async function runAgentTask(options) {
|
|
10
|
+
const task = options.task;
|
|
11
|
+
const knowledge = await buildReadiness(task, options.knowledge);
|
|
12
|
+
const questions = userQuestionsForKnowledgeGaps(knowledge.blockingMissingRequirements);
|
|
13
|
+
const acquisitionPlans = acquisitionPlansForKnowledgeGaps([
|
|
14
|
+
...knowledge.blockingMissingRequirements,
|
|
15
|
+
...knowledge.nonBlockingGaps
|
|
16
|
+
]);
|
|
17
|
+
const control = await runAgentControlLoop({
|
|
18
|
+
intent: task.intent,
|
|
19
|
+
budget: task.budget,
|
|
20
|
+
signal: options.signal,
|
|
21
|
+
store: options.store,
|
|
22
|
+
scenarioId: options.scenarioId ?? task.id,
|
|
23
|
+
projectId: options.projectId,
|
|
24
|
+
variantId: options.variantId,
|
|
25
|
+
observe: ({ history, abortSignal }) => options.adapter.observe({ task, knowledge, history, abortSignal }),
|
|
26
|
+
validate: async ({ state, history, abortSignal }) => {
|
|
27
|
+
const readinessEval = blockingKnowledgeEval(knowledge, { minimumScore: options.minimumReadinessScore });
|
|
28
|
+
const evals = await options.adapter.validate({ task, knowledge, state, history, abortSignal });
|
|
29
|
+
return [readinessEval, ...evals];
|
|
30
|
+
},
|
|
31
|
+
decide: (ctx) => {
|
|
32
|
+
if (isKnowledgeBlocked(ctx.evals)) {
|
|
33
|
+
return options.adapter.onKnowledgeBlocked?.({ task, knowledge, questions, acquisitionPlans }) ?? {
|
|
34
|
+
type: "stop",
|
|
35
|
+
pass: false,
|
|
36
|
+
score: knowledge.readinessScore,
|
|
37
|
+
reason: `knowledge readiness blocked: ${knowledge.reason}`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return options.adapter.decide(toAgentContext(task, knowledge, ctx));
|
|
41
|
+
},
|
|
42
|
+
act: (action, ctx) => options.adapter.act(action, toAgentContext(task, knowledge, ctx)),
|
|
43
|
+
shouldStop: options.adapter.shouldStop ? (ctx) => options.adapter.shouldStop(toAgentContext(task, knowledge, ctx)) : void 0,
|
|
44
|
+
getActionCostUsd: options.adapter.getActionCostUsd ? ({ action, result, state, evals, history }) => options.adapter.getActionCostUsd({ action, result, task, state, evals, history }) : void 0
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
task,
|
|
48
|
+
knowledge,
|
|
49
|
+
questions,
|
|
50
|
+
acquisitionPlans,
|
|
51
|
+
control,
|
|
52
|
+
runRecords: options.adapter.projectRunRecords?.(control, task) ?? []
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function buildReadiness(task, provider) {
|
|
56
|
+
if (provider?.buildReadiness) return provider.buildReadiness(task);
|
|
57
|
+
return scoreKnowledgeReadiness({
|
|
58
|
+
taskId: task.id,
|
|
59
|
+
requirements: task.requiredKnowledge ?? [],
|
|
60
|
+
metadata: { domain: task.domain, ...task.metadata }
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function isKnowledgeBlocked(evals) {
|
|
64
|
+
return evals.some((evalResult) => evalResult.id === "knowledge-ready" && !evalResult.passed);
|
|
65
|
+
}
|
|
66
|
+
function toAgentContext(task, knowledge, ctx) {
|
|
67
|
+
return {
|
|
68
|
+
task,
|
|
69
|
+
knowledge,
|
|
70
|
+
state: ctx.state,
|
|
71
|
+
evals: ctx.evals,
|
|
72
|
+
history: ctx.history,
|
|
73
|
+
budget: ctx.budget,
|
|
74
|
+
stepIndex: ctx.stepIndex,
|
|
75
|
+
wallMs: ctx.wallMs,
|
|
76
|
+
spentCostUsd: ctx.spentCostUsd,
|
|
77
|
+
remainingCostUsd: ctx.remainingCostUsd,
|
|
78
|
+
abortSignal: ctx.abortSignal
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
runAgentTask
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n acquisitionPlansForKnowledgeGaps,\n blockingKnowledgeEval,\n runAgentControlLoop,\n scoreKnowledgeReadiness,\n userQuestionsForKnowledgeGaps,\n type ControlBudget,\n type ControlContext,\n type ControlDecision,\n type ControlEvalResult,\n type ControlRunResult,\n type ControlStep,\n type DataAcquisitionPlan,\n type KnowledgeReadinessReport,\n type KnowledgeRequirement,\n type RunRecord,\n type TraceStore,\n type UserQuestion,\n} from '@tangle-network/agent-eval'\n\nexport interface AgentTaskSpec {\n id: string\n intent: string\n /** Domain is metadata, not an architectural boundary: tax, legal, gtm, creative, blueprint, redteam, etc. */\n domain?: string\n inputs?: Record<string, unknown>\n requiredKnowledge?: KnowledgeRequirement[]\n budget?: Partial<ControlBudget>\n metadata?: Record<string, unknown>\n}\n\nexport interface AgentKnowledgeProvider {\n buildReadiness?(task: AgentTaskSpec): Promise<KnowledgeReadinessReport> | KnowledgeReadinessReport\n answerQuestions?(questions: UserQuestion[], task: AgentTaskSpec): Promise<Record<string, string>> | Record<string, string>\n executeAcquisitionPlans?(plans: DataAcquisitionPlan[], task: AgentTaskSpec): Promise<string[]> | string[]\n}\n\nexport interface AgentTaskContext<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {\n task: AgentTaskSpec\n knowledge: KnowledgeReadinessReport\n state: TState\n evals: TEval[]\n history: ControlStep<TState, TAction, TActionResult, TEval>[]\n budget: ControlBudget\n stepIndex: number\n wallMs: number\n spentCostUsd: number\n remainingCostUsd?: number\n abortSignal: AbortSignal\n}\n\nexport interface AgentAdapter<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {\n observe(ctx: {\n task: AgentTaskSpec\n knowledge: KnowledgeReadinessReport\n history: ControlStep<TState, TAction, TActionResult, TEval>[]\n abortSignal: AbortSignal\n }): Promise<TState> | TState\n\n validate(ctx: {\n task: AgentTaskSpec\n knowledge: KnowledgeReadinessReport\n state: TState\n history: ControlStep<TState, TAction, TActionResult, TEval>[]\n abortSignal: AbortSignal\n }): Promise<TEval[]> | TEval[]\n\n decide(ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<ControlDecision<TAction>> | ControlDecision<TAction>\n\n act(action: TAction, ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<TActionResult> | TActionResult\n\n shouldStop?(ctx: AgentTaskContext<TState, TAction, TActionResult, TEval>): Promise<{\n stop: boolean\n pass: boolean\n reason: string\n score?: number\n }> | {\n stop: boolean\n pass: boolean\n reason: string\n score?: number\n }\n\n onKnowledgeBlocked?(ctx: {\n task: AgentTaskSpec\n knowledge: KnowledgeReadinessReport\n questions: UserQuestion[]\n acquisitionPlans: DataAcquisitionPlan[]\n }): Promise<ControlDecision<TAction>> | ControlDecision<TAction>\n\n getActionCostUsd?(ctx: {\n action: TAction\n result: TActionResult\n task: AgentTaskSpec\n state: TState\n evals: TEval[]\n history: ControlStep<TState, TAction, TActionResult, TEval>[]\n }): number | undefined\n\n projectRunRecords?(result: ControlRunResult<TState, TAction, TActionResult, TEval>, task: AgentTaskSpec): RunRecord[]\n}\n\nexport interface RunAgentTaskOptions<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {\n task: AgentTaskSpec\n adapter: AgentAdapter<TState, TAction, TActionResult, TEval>\n knowledge?: AgentKnowledgeProvider\n store?: TraceStore\n signal?: AbortSignal\n scenarioId?: string\n projectId?: string\n variantId?: string\n minimumReadinessScore?: number\n}\n\nexport interface AgentTaskRunResult<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult> {\n task: AgentTaskSpec\n knowledge: KnowledgeReadinessReport\n questions: UserQuestion[]\n acquisitionPlans: DataAcquisitionPlan[]\n control: ControlRunResult<TState, TAction, TActionResult, TEval>\n runRecords: RunRecord[]\n}\n\nexport async function runAgentTask<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(\n options: RunAgentTaskOptions<TState, TAction, TActionResult, TEval>,\n): Promise<AgentTaskRunResult<TState, TAction, TActionResult, TEval>> {\n const task = options.task\n const knowledge = await buildReadiness(task, options.knowledge)\n const questions = userQuestionsForKnowledgeGaps(knowledge.blockingMissingRequirements)\n const acquisitionPlans = acquisitionPlansForKnowledgeGaps([\n ...knowledge.blockingMissingRequirements,\n ...knowledge.nonBlockingGaps,\n ])\n\n const control = await runAgentControlLoop<TState, TAction, TActionResult, TEval>({\n intent: task.intent,\n budget: task.budget,\n signal: options.signal,\n store: options.store,\n scenarioId: options.scenarioId ?? task.id,\n projectId: options.projectId,\n variantId: options.variantId,\n observe: ({ history, abortSignal }) => options.adapter.observe({ task, knowledge, history, abortSignal }),\n validate: async ({ state, history, abortSignal }) => {\n const readinessEval = blockingKnowledgeEval(knowledge, { minimumScore: options.minimumReadinessScore })\n const evals = await options.adapter.validate({ task, knowledge, state, history, abortSignal })\n return [readinessEval as TEval, ...evals]\n },\n decide: (ctx) => {\n if (isKnowledgeBlocked(ctx.evals)) {\n return options.adapter.onKnowledgeBlocked?.({ task, knowledge, questions, acquisitionPlans }) ?? {\n type: 'stop',\n pass: false,\n score: knowledge.readinessScore,\n reason: `knowledge readiness blocked: ${knowledge.reason}`,\n }\n }\n return options.adapter.decide(toAgentContext(task, knowledge, ctx))\n },\n act: (action, ctx) => options.adapter.act(action, toAgentContext(task, knowledge, ctx)),\n shouldStop: options.adapter.shouldStop\n ? (ctx) => options.adapter.shouldStop!(toAgentContext(task, knowledge, ctx))\n : undefined,\n getActionCostUsd: options.adapter.getActionCostUsd\n ? ({ action, result, state, evals, history }) => options.adapter.getActionCostUsd!({ action, result, task, state, evals, history })\n : undefined,\n })\n\n return {\n task,\n knowledge,\n questions,\n acquisitionPlans,\n control,\n runRecords: options.adapter.projectRunRecords?.(control, task) ?? [],\n }\n}\n\nfunction buildReadiness(\n task: AgentTaskSpec,\n provider: AgentKnowledgeProvider | undefined,\n): Promise<KnowledgeReadinessReport> | KnowledgeReadinessReport {\n if (provider?.buildReadiness) return provider.buildReadiness(task)\n return scoreKnowledgeReadiness({\n taskId: task.id,\n requirements: task.requiredKnowledge ?? [],\n metadata: { domain: task.domain, ...task.metadata },\n })\n}\n\nfunction isKnowledgeBlocked(evals: ControlEvalResult[]): boolean {\n return evals.some((evalResult) => evalResult.id === 'knowledge-ready' && !evalResult.passed)\n}\n\nfunction toAgentContext<TState, TAction, TActionResult, TEval extends ControlEvalResult>(\n task: AgentTaskSpec,\n knowledge: KnowledgeReadinessReport,\n ctx: ControlContext<TState, TAction, TActionResult, TEval>,\n): AgentTaskContext<TState, TAction, TActionResult, TEval> {\n return {\n task,\n knowledge,\n state: ctx.state,\n evals: ctx.evals,\n history: ctx.history,\n budget: ctx.budget,\n stepIndex: ctx.stepIndex,\n wallMs: ctx.wallMs,\n spentCostUsd: ctx.spentCostUsd,\n remainingCostUsd: ctx.remainingCostUsd,\n abortSignal: ctx.abortSignal,\n }\n}\n\nexport type {\n ControlBudget,\n ControlDecision,\n ControlEvalResult,\n ControlRunResult,\n ControlStep,\n DataAcquisitionPlan,\n KnowledgeReadinessReport,\n KnowledgeRequirement,\n RunRecord,\n UserQuestion,\n} from '@tangle-network/agent-eval'\n"],"mappings":"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","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tangle-network/agent-runtime",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Reusable runtime lifecycle for domain-specific agents.",
|
|
5
|
+
"homepage": "https://github.com/tangle-network/agent-runtime#readme",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/tangle-network/agent-runtime.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/tangle-network/agent-runtime/issues"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup",
|
|
32
|
+
"dev": "tsup --watch",
|
|
33
|
+
"prepare": "tsup",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:watch": "vitest",
|
|
36
|
+
"typecheck": "tsc --noEmit"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@tangle-network/agent-eval": "^0.20.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^25.6.0",
|
|
43
|
+
"tsup": "^8.0.0",
|
|
44
|
+
"typescript": "^5.7.0",
|
|
45
|
+
"vitest": "^3.0.0"
|
|
46
|
+
},
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=20"
|
|
49
|
+
},
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"packageManager": "pnpm@10.28.0"
|
|
52
|
+
}
|