agent-lattice 0.14.0 → 0.15.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 +38 -0
- package/dist/index.d.ts +23 -2
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -700,6 +700,44 @@ type AgentLike<TContext = unknown> = {
|
|
|
700
700
|
That means a team can be used anywhere a callable agent is expected. From the
|
|
701
701
|
outside, a team is an agent; inside, it can contain a whole organization.
|
|
702
702
|
|
|
703
|
+
## Agent Specs (Templates) And Sessions
|
|
704
|
+
|
|
705
|
+
*Requires 0.15.0 or later.*
|
|
706
|
+
|
|
707
|
+
`createAgent()` returns a live session: one conversation, one history, one
|
|
708
|
+
workspace. `defineAgent()` returns an `AgentSpec` — a template carrying the
|
|
709
|
+
same options but no state. `spawn()` creates an independent session from it:
|
|
710
|
+
|
|
711
|
+
```ts
|
|
712
|
+
import { agentTool, defineAgent } from "agent-lattice";
|
|
713
|
+
|
|
714
|
+
const reviewerSpec = defineAgent({
|
|
715
|
+
name: "reviewer",
|
|
716
|
+
model: "claude-sonnet-4-5",
|
|
717
|
+
systemPrompt: "You are a senior code reviewer...",
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
// Register the spec: every tool call spawns a fresh session with no memory
|
|
721
|
+
// of previous calls. This is the safe default for reuse.
|
|
722
|
+
const lead = createAgent({
|
|
723
|
+
model: "claude-sonnet-4-5",
|
|
724
|
+
tools: [
|
|
725
|
+
agentTool("review", reviewerSpec, {
|
|
726
|
+
description: "Ask the reviewer to audit a change.",
|
|
727
|
+
}),
|
|
728
|
+
],
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
// Register a spawned session instead when the target should remember earlier
|
|
732
|
+
// tasks across calls — continuity is an explicit opt-in.
|
|
733
|
+
const reviewSession = reviewerSpec.spawn();
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
The same union applies to `delegateTool()`. The generated tool description
|
|
737
|
+
states which semantics a target has, so the calling agent knows whether each
|
|
738
|
+
task must be self-contained. Existing code that passes an `AgentLike` keeps
|
|
739
|
+
its current behavior: a long-lived session with history.
|
|
740
|
+
|
|
703
741
|
## Team Mailbox Collaboration
|
|
704
742
|
|
|
705
743
|
Use `createTeam()` when you want to talk to one `AgentLike` while it coordinates
|
package/dist/index.d.ts
CHANGED
|
@@ -692,12 +692,33 @@ export type AgentToolOptions = {
|
|
|
692
692
|
description: string;
|
|
693
693
|
targetMailboxId?: string;
|
|
694
694
|
};
|
|
695
|
-
|
|
696
|
-
|
|
695
|
+
/**
|
|
696
|
+
* An AgentLike is a live session: it keeps its conversation history across
|
|
697
|
+
* calls. An AgentSpec is a template: each call spawns a fresh session with no
|
|
698
|
+
* memory of previous calls. Prefer a spec unless the parent explicitly wants
|
|
699
|
+
* continuity.
|
|
700
|
+
*/
|
|
701
|
+
export type AgentToolTarget = AgentLike<any> | AgentSpec<any>;
|
|
702
|
+
export declare function agentTool(name: string, agent: AgentToolTarget, options: AgentToolOptions): ToolDefinition<AgentToolInput>;
|
|
703
|
+
export declare function delegateTool(name: string, description: string, agent: AgentToolTarget, options?: DelegateToolOptions): ToolDefinition<{
|
|
697
704
|
task: string;
|
|
698
705
|
}>;
|
|
699
706
|
export declare function createAgent<TContext = unknown>(options: AgentOptions<TContext>): Agent<TContext>;
|
|
700
707
|
export declare function createBareAgent<TContext = unknown>(options: BareAgentOptions<TContext>): Agent<TContext>;
|
|
708
|
+
/**
|
|
709
|
+
* A template describing an agent's identity: model, prompt, tools, skills,
|
|
710
|
+
* and workspace policy. A spec carries no conversation state; `spawn()`
|
|
711
|
+
* creates an independent session (an Agent) that owns its own history and
|
|
712
|
+
* workspace. Register a spec wherever a capability should be reused without
|
|
713
|
+
* leaking memory between tasks; spawn a session when continuity is wanted.
|
|
714
|
+
*/
|
|
715
|
+
export type AgentSpec<TContext = unknown> = {
|
|
716
|
+
readonly name?: string;
|
|
717
|
+
readonly options: AgentOptions<TContext>;
|
|
718
|
+
spawn(overrides?: Partial<AgentOptions<TContext>>): Agent<TContext>;
|
|
719
|
+
};
|
|
720
|
+
export declare function defineAgent<TContext = unknown>(options: AgentOptions<TContext>): AgentSpec<TContext>;
|
|
721
|
+
export declare function isAgentSpec(target: AgentLike<any> | AgentSpec<any>): target is AgentSpec<any>;
|
|
701
722
|
export declare function createBuiltinTools(options?: AgentWorkspaceToolsOptions): Array<ToolDefinition<any, any>>;
|
|
702
723
|
export declare function createJsonlContextTracer(options: JsonlContextTracerOptions): ContextTracer;
|
|
703
724
|
/**
|