Skip to content

Commit 9f5e8b8

Browse files
authored
Yj-refactor/zee (#84)
* wip * refactor(zee): agent assignment * refactor(zee): agent renaming * nit
1 parent c59b7b2 commit 9f5e8b8

File tree

7 files changed

+430
-232
lines changed

7 files changed

+430
-232
lines changed

docs/concepts/zee-workflows.mdx

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ The Zero-Employee Enterprise (ZEE) is a new business model where traditional wor
99
A ZEE workflow contains a couple of components:
1010

1111
- The [Agents](/concepts/agents) that are used to solve the problem.
12-
- The **breakdown** agent breaks down the final goal into smaller tasks and assigns them to the agents provided to the workflow.
13-
- The **mastermind** agent facilitate communication between all the agents via necessary context for the final goal.
12+
- The **planner** agent breaks down the final goal into smaller tasks and assigns them to the agents provided to the workflow.
13+
- The **router** agent facilitates communication between all the agents via necessary context for the final goal.
1414
- The **endgame** agent is the final agent that takes in the results from all the agents and formulates the final output.
1515

16+
> These agent names are reserved by the ZEE workflow. Make sure not to use these names for your agents.
17+
1618
## Creating a Workflow
1719

1820
To create a workflow, you need to create a new instance of the `ZeeWorkflow` class.

docs/get-started/overview.mdx

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The Agent SDK supports single model inference calls to multi-agent systems that
1414
flowchart LR
1515
%% Styling
1616
classDef input fill:#ffffff,stroke:#000000,stroke-width:2px, color:#000
17-
classDef breakdown fill:#f0f0f0,stroke:#000000,stroke-width:2px, color:#000
17+
classDef planner fill:#f0f0f0,stroke:#000000,stroke-width:2px, color:#000
1818
classDef agent fill:#e0e0e0,stroke:#000000,stroke-width:2px, color:#000
1919
classDef tool fill:#d0d0d0,stroke:#000000,stroke-width:2px, color:#000
2020
classDef state fill:#fafafa,stroke:#000000,stroke-width:2px,stroke-dasharray: 5 5, color:#000
@@ -25,8 +25,8 @@ flowchart LR
2525
2626
subgraph "Zero-Employee Enterprise"
2727
direction LR
28-
breakdown{"🔍 Breakdown Agent"}
29-
mastermind{"🧠 Mastermind Agent"}
28+
planner{"🔍 Planner Agent"}
29+
router{"🧠 Router Agent"}
3030
agent1("🤖 Primary Agent")
3131
agent2("🤖 Support Agent")
3232
agent3("🤖 Task Agent")
@@ -45,20 +45,20 @@ flowchart LR
4545
end
4646
4747
%% Connections
48-
inp1 --> breakdown
49-
breakdown --> mastermind
50-
mastermind <--> agent1
51-
mastermind <--> agent2
52-
mastermind <--> agent3
48+
inp1 --> planner
49+
planner --> router
50+
router <--> agent1
51+
router <--> agent2
52+
router <--> agent3
5353
agent1 <--> tool1
5454
agent2 <--> tool2
5555
agent3 <--> tool3
5656
agent3 <--> tool4
5757
5858
%% Apply styles
5959
class inp1 input
60-
class breakdown breakdown
61-
class mastermind breakdown
60+
class planner planner
61+
class router router
6262
class agent1,agent2,agent3 agent
6363
class tool1,tool2,tool3,tool4 tool
6464
class id1 state

packages/ai-agent-sdk/src/core/agent/agent.ts

+8-11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { AgentConfig, AgentGenerateParameters, AgentResponse } from ".";
22
import { systemMessage } from "../../functions";
33
import { Base } from "../base";
44
import { LLM } from "../llm";
5+
import { type CoreMessage } from "ai";
56

67
export class Agent extends Base {
78
private _config: AgentConfig;
@@ -26,21 +27,17 @@ export class Agent extends Base {
2627
}
2728

2829
async generate(args: AgentGenerateParameters): Promise<AgentResponse> {
30+
const _messages = [
31+
systemMessage(this.description),
32+
...(this.instructions?.map(systemMessage) ?? []),
33+
...(args.messages ?? []),
34+
] as CoreMessage[];
35+
2936
const response = await this._llm.generate(
3037
{
3138
...args,
3239
tools: this._config.tools,
33-
messages: [
34-
systemMessage(this.description),
35-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
36-
// @ts-expect-error
37-
...(this.instructions?.map((instruction) =>
38-
systemMessage(instruction)
39-
) ?? []),
40-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
41-
// @ts-expect-error
42-
...(args.messages ?? []),
43-
],
40+
messages: _messages,
4441
temperature: this._config.temperature,
4542
},
4643
true

0 commit comments

Comments
 (0)