Skip to content

Commit fff859e

Browse files
New import option and refactor of TaskManager for Agent Execution (#19)
* Add type import for cleaner use of the sdk, allow import of agent executor and bump to 0.5.7 * Deprecate legacy types and update documentation for clarity - Marked `TaskContext` as deprecated in favor of `A2AEngine`. - Commented out the export of `deployment` schema to indicate it is no longer in use. - Introduced `AgentExecutor` type and deprecated `TaskManager`, providing clearer guidance on usage. - Updated `agentExecutor` implementation for improved readability and added deprecation notice for `taskManager`. --------- Co-authored-by: EditUndo <patrick.buah.jr@gmail.com>
1 parent b9f2ee2 commit fff859e

File tree

12 files changed

+40
-14
lines changed

12 files changed

+40
-14
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- Updated `zod` package version
2323
- **BREAKING**: Rolled back from `zod/v4` to standard `zod` for better compatibility
2424
- Improved service interface architecture to support multiple protocol bindings
25+
- Renamed `artinet.v0.taskManager` and it's associate type `TaskManager` to `artinet.v0.agentExecutor` and `AgentExecutor` to avoid confusion with A2A `TaskManager` in `service.ts`
2526

2627
### Fixed
2728

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ It has [serveral template projects](https://github.com/the-artinet-project/creat
7373
| **Transport Layers** | Built-in support for Express/TRPC. | Express middleware, tRPC router, or easily create your own. |
7474
| **Core Types** | Fully implement A2A schema in Zod. | `AgentCard`, `Task`, `Message`, `Part`, `Artifact`, etc. |
7575
| **Deployment** | Bundle, test, and deploy agents onto the artinet platform (v0.5.2). | `@artinet/sdk/deployment`, `fullDeployment`, `testDeployment`, `bundle` |
76-
| **Agent Utilities** | Run agents in managed environments with our proxy system. | `artinet.v0.taskManager`, `artinet.v0.connect`, `artinet.v0.agent` |
76+
| **Agent Utilities** | Run agents in managed environments with our proxy system. | `artinet.v0.agentExecutor`, `artinet.v0.connect`, `artinet.v0.agent` |
7777

7878
## Installation
7979

@@ -781,7 +781,7 @@ Key features include:
781781

782782
- **Sandboxed Enviroments:** Streamline agent logic for quick and easy deployments. The new `artinet.v0` namespace (accessible via `@artinet/sdk/agents`) provides `taskManager`, `connect`, and `agent`.
783783

784-
- `artinet.v0.taskManager`: Manages the agent's lifecycle by iterating over the agent's `TaskHandler` and communicating updates to the host environment.
784+
- `artinet.v0.agentExecutor`: Manages the agent's lifecycle by iterating over the agent's `TaskHandler` and communicating updates to the host environment.
785785
- `artinet.v0.connect`: Replaces the deprecated `fetchResponseProxy`. Allows agents to make proxied calls to other agents or LLMs via the host environment.
786786
- `artinet.v0.agent`: A factory function to obtain a `ClientProxy` for type-safe communication with other agents, managed by the host environment.
787787

@@ -811,10 +811,10 @@ Key features include:
811811
}
812812

813813
// The host environment will invoke this taskManager with the agent's logic.
814-
await artinet.v0.taskManager({ taskHandler: myAgentLogic });
814+
await artinet.v0.agentExecutor({ taskHandler: myAgentLogic });
815815
```
816816

817-
_Note: The `taskHandlerProxy` and `fetchResponseProxy` utilities are now deprecated in favor of `artinet.v0.taskManager` and `artinet.v0.connect` respectively._
817+
_Note: The `taskHandlerProxy` and `fetchResponseProxy` utilities are now deprecated in favor of `artinet.v0.agentExecutor` and `artinet.v0.connect` respectively._
818818

819819
- **Test-Agents (Experimental):** Simulate and test your agents @ agents.artinet.io/test/deploy using the `testDeployment` tool.
820820

examples/code-deployment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,5 @@ export const coderAgent: AgentEngine = async function* (context: Context) {
8686
yield finalUpdate;
8787
};
8888

89-
await artinet.v0.taskManager({ taskHandler: coderAgent });
89+
await artinet.v0.agentExecutor({ taskHandler: coderAgent });
9090
console.log("[CoderAgent] Finished");

examples/nested-deployment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,5 @@ export const simpleEchoAgent: AgentEngine = async function* (context: Context) {
165165
yield completedUpdate;
166166
};
167167

168-
await artinet.v0.taskManager({ taskHandler: simpleEchoAgent });
168+
await artinet.v0.agentExecutor({ taskHandler: simpleEchoAgent });
169169
console.log("[SimpleEchoAgent] Finished");

llms.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The SDK is distributed as the `@artinet/sdk` npm package (current version: 0.5.6
6767
* Supports dynamic agent creation and management with shared state.
6868

6969
* **Code Deployment & Management:**
70-
* **`artinet.v0.taskManager`**: Standard utility for agents in managed environments to interact with the host for task lifecycle management.
70+
* **`artinet.v0.agentExecutor`**: Standard utility for agents in managed environments to interact with the host for task lifecycle management.
7171
* **`artinet.v0.connect`**: Standard utility for agents in managed environments to make proxied calls to other agents or LLMs.
7272
* **`artinet.v0.agent`**: Factory function for agents in managed environments to obtain a `ClientProxy` for type-safe communication.
7373
* `bundler`: Utility to bundle agent code using `esbuild`.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@artinet/sdk",
3-
"version": "0.5.6",
3+
"version": "0.5.7",
44
"description": "TypeScript SDK for the Agent2Agent (A2A) Protocol",
55
"type": "module",
66
"main": "./dist/index.js",
@@ -21,6 +21,12 @@
2121
"types": "./dist/types/utils/deployment/index.d.ts",
2222
"import": "./dist/utils/deployment/index.js",
2323
"default": "./dist/utils/deployment/index.js"
24+
},
25+
"./types":
26+
{
27+
"types": "./dist/types/types/index.d.ts",
28+
"import": "./dist/types/index.js",
29+
"default": "./dist/types/index.js"
2430
}
2531
},
2632
"rootDir": ".",

src/types/interfaces/services/a2a/legacy.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export interface TaskContext {
9898
* or artifact updates (TaskYieldUpdate). The server consumes these yields,
9999
* updates the task state in the store, and streams events if applicable.
100100
*
101+
* @deprecated Use A2AEngine instead.
101102
* @param context The TaskContext object containing task details and state.
102103
* @yields Updates to the task's status or artifacts.
103104
* @returns Optionally returns the final complete Task object (needed for non-streaming 'message/send').

src/types/schemas/deployment/proxy.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,21 @@ export interface TaskManagerProps {
3232

3333
/**
3434
* Defines the signature for a TaskManager function.
35+
* An AgentExecutor is responsible for orchestrating the execution of an agent's task,
36+
* typically by interfacing with a host environment.
37+
* @param props - The properties for the agent executor, including the taskHandler.
38+
* @returns A promise that resolves when the task handler has completed.
39+
*/
40+
export type AgentExecutor = (props: TaskManagerProps) => Promise<void>;
41+
42+
/**
43+
* @deprecated Use AgentExecutor instead.
3544
* A TaskManager is responsible for orchestrating the execution of an agent's task,
3645
* typically by interfacing with a host environment.
3746
* @param props - The properties for the task manager, including the taskHandler.
3847
* @returns A promise that resolves when the task handler has completed.
3948
*/
40-
export type TaskManager = (props: TaskManagerProps) => Promise<void>;
49+
export type TaskManager = AgentExecutor;
4150

4251
/**
4352
* Properties for the Connect function.

src/utils/deployment/agents.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import {
99
ClientProxy,
1010
ConnectAPICallback,
1111
ConnectProps,
12-
TaskManager,
12+
AgentExecutor,
1313
TaskManagerProps,
1414
TaskProxy,
15+
TaskManager,
1516
} from "~/types/schemas/deployment/index.js";
1617
import { Context as ExecutionContext } from "~/types/index.js";
1718

@@ -38,7 +39,9 @@ export namespace artinet {
3839
* @throws An error if the `taskManagerStub` or `context` is not set in `process.env`,
3940
* indicating an invalid runtime environment.
4041
*/
41-
export const taskManager: TaskManager = async (props: TaskManagerProps) => {
42+
export const agentExecutor: AgentExecutor = async (
43+
props: TaskManagerProps
44+
) => {
4245
const { taskHandler } = props;
4346
if (!env.taskManagerStub && !env.context) {
4447
console.warn(
@@ -66,6 +69,11 @@ export namespace artinet {
6669
}
6770
};
6871

72+
/**
73+
* @deprecated Use agentExecutor instead.
74+
*/
75+
export const taskManager: TaskManager = agentExecutor;
76+
6977
/**
7078
* Establishes a connection or sends a request to another agent or service.
7179
* This function proxies requests to a host-provided implementation, enabling

0 commit comments

Comments
 (0)