@artinet/sdk 0.5.5 → 0.5.7
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/CHANGELOG.md +128 -20
- package/README.md +542 -212
- package/dist/client/a2a-client.js +6 -1
- package/dist/client/a2a-client.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/server/express/errors.js +51 -0
- package/dist/server/express/errors.js.map +1 -0
- package/dist/server/express/index.js +4 -0
- package/dist/server/express/index.js.map +1 -0
- package/dist/server/express/middeware.js +116 -0
- package/dist/server/express/middeware.js.map +1 -0
- package/dist/server/express/server.js +80 -0
- package/dist/server/express/server.js.map +1 -0
- package/dist/server/index.js +1 -7
- package/dist/server/index.js.map +1 -1
- package/dist/services/a2a/factory/builder.js +392 -0
- package/dist/services/a2a/factory/builder.js.map +1 -0
- package/dist/services/a2a/factory/context.js +151 -0
- package/dist/services/a2a/factory/context.js.map +1 -0
- package/dist/services/a2a/factory/event.js +182 -0
- package/dist/services/a2a/factory/event.js.map +1 -0
- package/dist/services/a2a/factory/index.js +6 -0
- package/dist/services/a2a/factory/index.js.map +1 -0
- package/dist/services/a2a/factory/method.js +15 -0
- package/dist/services/a2a/factory/method.js.map +1 -0
- package/dist/services/a2a/factory/service.js +12 -0
- package/dist/services/a2a/factory/service.js.map +1 -0
- package/dist/services/a2a/helpers/index.js +2 -0
- package/dist/services/a2a/helpers/index.js.map +1 -0
- package/dist/services/a2a/helpers/part.js +47 -0
- package/dist/services/a2a/helpers/part.js.map +1 -0
- package/dist/services/a2a/index.js +5 -1
- package/dist/services/a2a/index.js.map +1 -1
- package/dist/services/a2a/managers/cancellation.js +17 -0
- package/dist/services/a2a/managers/cancellation.js.map +1 -0
- package/dist/services/a2a/managers/connection.js +17 -0
- package/dist/services/a2a/managers/connection.js.map +1 -0
- package/dist/services/a2a/managers/context.js +17 -0
- package/dist/services/a2a/managers/context.js.map +1 -0
- package/dist/services/a2a/managers/index.js +6 -0
- package/dist/services/a2a/managers/index.js.map +1 -0
- package/dist/services/a2a/managers/task.js +17 -0
- package/dist/services/a2a/managers/task.js.map +1 -0
- package/dist/services/a2a/methods/cancel-task.js +47 -0
- package/dist/services/a2a/methods/cancel-task.js.map +1 -0
- package/dist/services/a2a/methods/get-task.js +15 -0
- package/dist/services/a2a/methods/get-task.js.map +1 -0
- package/dist/services/a2a/methods/index.js +6 -0
- package/dist/services/a2a/methods/index.js.map +1 -0
- package/dist/services/a2a/methods/resubscribe-task.js +77 -0
- package/dist/services/a2a/methods/resubscribe-task.js.map +1 -0
- package/dist/services/a2a/methods/send-message.js +20 -0
- package/dist/services/a2a/methods/send-message.js.map +1 -0
- package/dist/services/a2a/methods/stream-message.js +39 -0
- package/dist/services/a2a/methods/stream-message.js.map +1 -0
- package/dist/services/a2a/service.js +82 -236
- package/dist/services/a2a/service.js.map +1 -1
- package/dist/services/a2a/state/index.js +4 -0
- package/dist/services/a2a/state/index.js.map +1 -0
- package/dist/services/a2a/state/load.js +43 -0
- package/dist/services/a2a/state/load.js.map +1 -0
- package/dist/services/a2a/state/process.js +14 -0
- package/dist/services/a2a/state/process.js.map +1 -0
- package/dist/services/a2a/state/update/artifact.js +40 -0
- package/dist/services/a2a/state/update/artifact.js.map +1 -0
- package/dist/services/a2a/state/update/index.js +3 -0
- package/dist/services/a2a/state/update/index.js.map +1 -0
- package/dist/{server/lib/update/base.js → services/a2a/state/update/update.js} +23 -9
- package/dist/services/a2a/state/update/update.js.map +1 -0
- package/dist/services/core/execution/execute.js +26 -0
- package/dist/services/core/execution/execute.js.map +1 -0
- package/dist/services/core/execution/index.js +2 -0
- package/dist/services/core/execution/index.js.map +1 -0
- package/dist/services/core/index.js +3 -0
- package/dist/services/core/index.js.map +1 -0
- package/dist/services/core/managers/command.js +95 -0
- package/dist/services/core/managers/command.js.map +1 -0
- package/dist/services/core/managers/event.js +57 -0
- package/dist/services/core/managers/event.js.map +1 -0
- package/dist/services/core/managers/index.js +4 -0
- package/dist/services/core/managers/index.js.map +1 -0
- package/dist/services/core/managers/stream.js +78 -0
- package/dist/services/core/managers/stream.js.map +1 -0
- package/dist/services/index.js +3 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/mcp/service.js +114 -66
- package/dist/services/mcp/service.js.map +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/rpc/parser.js +13 -5
- package/dist/transport/rpc/parser.js.map +1 -1
- package/dist/transport/rpc/rpc-client.js +10 -2
- package/dist/transport/rpc/rpc-client.js.map +1 -1
- package/dist/transport/streaming/event-stream.js +5 -1
- package/dist/transport/streaming/event-stream.js.map +1 -1
- package/dist/transport/trpc/a2a/factory/index.js +2 -0
- package/dist/transport/trpc/a2a/factory/index.js.map +1 -0
- package/dist/transport/trpc/a2a/factory/router.js +17 -0
- package/dist/transport/trpc/a2a/factory/router.js.map +1 -0
- package/dist/transport/trpc/a2a/index.js +4 -0
- package/dist/transport/trpc/a2a/index.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/index.js +4 -0
- package/dist/transport/trpc/a2a/routes/index.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/info.js +10 -0
- package/dist/transport/trpc/a2a/routes/info.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/message/index.js +2 -0
- package/dist/transport/trpc/a2a/routes/message/index.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/message/route.js +38 -0
- package/dist/transport/trpc/a2a/routes/message/route.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/tasks/index.js +2 -0
- package/dist/transport/trpc/a2a/routes/tasks/index.js.map +1 -0
- package/dist/transport/trpc/a2a/routes/tasks/route.js +71 -0
- package/dist/transport/trpc/a2a/routes/tasks/route.js.map +1 -0
- package/dist/transport/trpc/a2a/trpc.js +36 -0
- package/dist/transport/trpc/a2a/trpc.js.map +1 -0
- package/dist/transport/trpc/index.js +2 -0
- package/dist/transport/trpc/index.js.map +1 -0
- package/dist/types/client/a2a-client.d.ts +5 -1
- package/dist/types/client/a2a-client.d.ts.map +1 -1
- package/dist/types/ext.js +11 -0
- package/dist/types/ext.js.map +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/interfaces/client.js +6 -0
- package/dist/types/interfaces/client.js.map +1 -0
- package/dist/types/interfaces/index.js +4 -0
- package/dist/types/interfaces/index.js.map +1 -0
- package/dist/types/interfaces/services/a2a/builder.js +6 -0
- package/dist/types/interfaces/services/a2a/builder.js.map +1 -0
- package/dist/types/interfaces/services/a2a/context.js +6 -0
- package/dist/types/interfaces/services/a2a/context.js.map +1 -0
- package/dist/types/interfaces/services/a2a/engine.js +6 -0
- package/dist/types/interfaces/services/a2a/engine.js.map +1 -0
- package/dist/types/interfaces/services/a2a/index.js +6 -0
- package/dist/types/interfaces/services/a2a/index.js.map +1 -0
- package/dist/types/interfaces/services/a2a/legacy.js +6 -0
- package/dist/types/interfaces/services/a2a/legacy.js.map +1 -0
- package/dist/types/interfaces/services/a2a/service.js +6 -0
- package/dist/types/interfaces/services/a2a/service.js.map +1 -0
- package/dist/types/interfaces/services/core/context/command.js +6 -0
- package/dist/types/interfaces/services/core/context/command.js.map +1 -0
- package/dist/types/interfaces/services/core/context/context.js +6 -0
- package/dist/types/interfaces/services/core/context/context.js.map +1 -0
- package/dist/types/interfaces/services/core/context/index.js +4 -0
- package/dist/types/interfaces/services/core/context/index.js.map +1 -0
- package/dist/types/interfaces/services/core/context/types.js +6 -0
- package/dist/types/interfaces/services/core/context/types.js.map +1 -0
- package/dist/types/interfaces/services/core/execution/engine.js +6 -0
- package/dist/types/interfaces/services/core/execution/engine.js.map +1 -0
- package/dist/types/interfaces/services/core/execution/environment.js +6 -0
- package/dist/types/interfaces/services/core/execution/environment.js.map +1 -0
- package/dist/types/interfaces/services/core/execution/execute.js +6 -0
- package/dist/types/interfaces/services/core/execution/execute.js.map +1 -0
- package/dist/types/interfaces/services/core/execution/index.js +4 -0
- package/dist/types/interfaces/services/core/execution/index.js.map +1 -0
- package/dist/types/interfaces/services/core/index.js +5 -0
- package/dist/types/interfaces/services/core/index.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/cancellation.js +6 -0
- package/dist/types/interfaces/services/core/managers/cancellation.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/connection.js +6 -0
- package/dist/types/interfaces/services/core/managers/connection.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/context.js +6 -0
- package/dist/types/interfaces/services/core/managers/context.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/event.js +6 -0
- package/dist/types/interfaces/services/core/managers/event.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/index.js +7 -0
- package/dist/types/interfaces/services/core/managers/index.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/stream.js +6 -0
- package/dist/types/interfaces/services/core/managers/stream.js.map +1 -0
- package/dist/types/interfaces/services/core/managers/task.js +2 -0
- package/dist/types/interfaces/services/core/managers/task.js.map +1 -0
- package/dist/types/interfaces/services/core/service.js +6 -0
- package/dist/types/interfaces/services/core/service.js.map +1 -0
- package/dist/types/interfaces/services/index.js +5 -0
- package/dist/types/interfaces/services/index.js.map +1 -0
- package/dist/types/interfaces/services/mcp/index.js +2 -0
- package/dist/types/interfaces/services/mcp/index.js.map +1 -0
- package/dist/types/interfaces/services/mcp/service.js +6 -0
- package/dist/types/interfaces/services/mcp/service.js.map +1 -0
- package/dist/types/{services → interfaces/services}/protocol.js +4 -0
- package/dist/types/interfaces/services/protocol.js.map +1 -0
- package/dist/types/interfaces/storage.js +6 -0
- package/dist/types/interfaces/storage.js.map +1 -0
- package/dist/types/schemas/a2a/agent.js +325 -0
- package/dist/types/schemas/a2a/agent.js.map +1 -0
- package/dist/types/schemas/a2a/auth.js +284 -0
- package/dist/types/schemas/a2a/auth.js.map +1 -0
- package/dist/types/schemas/a2a/error.js +119 -0
- package/dist/types/schemas/a2a/error.js.map +1 -1
- package/dist/types/schemas/a2a/index.js +8 -4
- package/dist/types/schemas/a2a/index.js.map +1 -1
- package/dist/types/schemas/a2a/kind.js +21 -0
- package/dist/types/schemas/a2a/kind.js.map +1 -0
- package/dist/types/schemas/a2a/message.js +130 -1
- package/dist/types/schemas/a2a/message.js.map +1 -1
- package/dist/types/schemas/a2a/notification.js +203 -1
- package/dist/types/schemas/a2a/notification.js.map +1 -1
- package/dist/types/schemas/a2a/parameters.js +241 -1
- package/dist/types/schemas/a2a/parameters.js.map +1 -1
- package/dist/types/schemas/a2a/protocol.js +60 -0
- package/dist/types/schemas/a2a/protocol.js.map +1 -0
- package/dist/types/schemas/a2a/rpc.js +126 -1
- package/dist/types/schemas/a2a/rpc.js.map +1 -1
- package/dist/types/schemas/a2a/task.js +131 -12
- package/dist/types/schemas/a2a/task.js.map +1 -1
- package/dist/types/schemas/a2a/transport.js +29 -0
- package/dist/types/schemas/a2a/transport.js.map +1 -0
- package/dist/types/schemas/deployment/index.js +3 -0
- package/dist/types/schemas/deployment/index.js.map +1 -0
- package/dist/types/schemas/deployment/proxy.js +6 -0
- package/dist/types/schemas/deployment/proxy.js.map +1 -0
- package/dist/types/schemas/deployment/request.js +88 -0
- package/dist/types/schemas/deployment/request.js.map +1 -0
- package/dist/types/schemas/index.js +1 -0
- package/dist/types/schemas/index.js.map +1 -1
- package/dist/types/server/express/errors.d.ts +10 -0
- package/dist/types/server/express/errors.d.ts.map +1 -0
- package/dist/types/server/express/index.d.ts +4 -0
- package/dist/types/server/express/index.d.ts.map +1 -0
- package/dist/types/server/express/middeware.d.ts +8 -0
- package/dist/types/server/express/middeware.d.ts.map +1 -0
- package/dist/types/server/express/server.d.ts +71 -0
- package/dist/types/server/express/server.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +1 -7
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/services/a2a/factory/builder.d.ts +352 -0
- package/dist/types/services/a2a/factory/builder.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/context.d.ts +133 -0
- package/dist/types/services/a2a/factory/context.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/event.d.ts +59 -0
- package/dist/types/services/a2a/factory/event.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/index.d.ts +6 -0
- package/dist/types/services/a2a/factory/index.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/method.d.ts +7 -0
- package/dist/types/services/a2a/factory/method.d.ts.map +1 -0
- package/dist/types/services/a2a/factory/service.d.ts +10 -0
- package/dist/types/services/a2a/factory/service.d.ts.map +1 -0
- package/dist/types/services/a2a/helpers/index.d.ts +2 -0
- package/dist/types/services/a2a/helpers/index.d.ts.map +1 -0
- package/dist/types/services/a2a/helpers/part.d.ts +49 -0
- package/dist/types/services/a2a/helpers/part.d.ts.map +1 -0
- package/dist/types/services/a2a/index.d.ts +5 -1
- package/dist/types/services/a2a/index.d.ts.map +1 -1
- package/dist/types/services/a2a/managers/cancellation.d.ts +12 -0
- package/dist/types/services/a2a/managers/cancellation.d.ts.map +1 -0
- package/dist/types/services/a2a/managers/connection.d.ts +12 -0
- package/dist/types/services/a2a/managers/connection.d.ts.map +1 -0
- package/dist/types/services/a2a/managers/context.d.ts +12 -0
- package/dist/types/services/a2a/managers/context.d.ts.map +1 -0
- package/dist/types/services/a2a/managers/index.d.ts +6 -0
- package/dist/types/services/a2a/managers/index.d.ts.map +1 -0
- package/dist/types/services/a2a/managers/task.d.ts +12 -0
- package/dist/types/services/a2a/managers/task.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/cancel-task.d.ts +8 -0
- package/dist/types/services/a2a/methods/cancel-task.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/get-task.d.ts +113 -0
- package/dist/types/services/a2a/methods/get-task.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/index.d.ts +6 -0
- package/dist/types/services/a2a/methods/index.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/resubscribe-task.d.ts +8 -0
- package/dist/types/services/a2a/methods/resubscribe-task.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/send-message.d.ts +8 -0
- package/dist/types/services/a2a/methods/send-message.d.ts.map +1 -0
- package/dist/types/services/a2a/methods/stream-message.d.ts +9 -0
- package/dist/types/services/a2a/methods/stream-message.d.ts.map +1 -0
- package/dist/types/services/a2a/service.d.ts +374 -41
- package/dist/types/services/a2a/service.d.ts.map +1 -1
- package/dist/types/services/a2a/state/index.d.ts +4 -0
- package/dist/types/services/a2a/state/index.d.ts.map +1 -0
- package/dist/types/services/a2a/state/load.d.ts +15 -0
- package/dist/types/services/a2a/state/load.d.ts.map +1 -0
- package/dist/types/services/a2a/state/process.d.ts +8 -0
- package/dist/types/services/a2a/state/process.d.ts.map +1 -0
- package/dist/types/services/a2a/state/update/artifact.d.ts +11 -0
- package/dist/types/services/a2a/state/update/artifact.d.ts.map +1 -0
- package/dist/types/services/a2a/state/update/index.d.ts +3 -0
- package/dist/types/services/a2a/state/update/index.d.ts.map +1 -0
- package/dist/types/services/a2a/state/update/update.d.ts +24 -0
- package/dist/types/services/a2a/state/update/update.d.ts.map +1 -0
- package/dist/types/services/core/execution/execute.d.ts +7 -0
- package/dist/types/services/core/execution/execute.d.ts.map +1 -0
- package/dist/types/services/core/execution/index.d.ts +2 -0
- package/dist/types/services/core/execution/index.d.ts.map +1 -0
- package/dist/types/services/core/index.d.ts +3 -0
- package/dist/types/services/core/index.d.ts.map +1 -0
- package/dist/types/services/core/managers/command.d.ts +40 -0
- package/dist/types/services/core/managers/command.d.ts.map +1 -0
- package/dist/types/services/core/managers/event.d.ts +19 -0
- package/dist/types/services/core/managers/event.d.ts.map +1 -0
- package/dist/types/services/core/managers/index.d.ts +4 -0
- package/dist/types/services/core/managers/index.d.ts.map +1 -0
- package/dist/types/services/core/managers/stream.d.ts +21 -0
- package/dist/types/services/core/managers/stream.d.ts.map +1 -0
- package/dist/types/services/index.d.ts +3 -1
- package/dist/types/services/index.d.ts.map +1 -1
- package/dist/types/services/mcp/service.d.ts +23 -22
- package/dist/types/services/mcp/service.d.ts.map +1 -1
- package/dist/types/transport/index.d.ts +1 -1
- package/dist/types/transport/index.d.ts.map +1 -1
- package/dist/types/transport/rpc/parser.d.ts +5 -1
- package/dist/types/transport/rpc/parser.d.ts.map +1 -1
- package/dist/types/transport/rpc/rpc-client.d.ts +5 -1
- package/dist/types/transport/rpc/rpc-client.d.ts.map +1 -1
- package/dist/types/transport/streaming/event-stream.d.ts +5 -1
- package/dist/types/transport/streaming/event-stream.d.ts.map +1 -1
- package/dist/types/transport/trpc/a2a/factory/index.d.ts +2 -0
- package/dist/types/transport/trpc/a2a/factory/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/factory/router.d.ts +2631 -0
- package/dist/types/transport/trpc/a2a/factory/router.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/index.d.ts +4 -0
- package/dist/types/transport/trpc/a2a/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/index.d.ts +4 -0
- package/dist/types/transport/trpc/a2a/routes/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/info.d.ts +102 -0
- package/dist/types/transport/trpc/a2a/routes/info.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/message/index.d.ts +2 -0
- package/dist/types/transport/trpc/a2a/routes/message/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/message/route.d.ts +523 -0
- package/dist/types/transport/trpc/a2a/routes/message/route.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/tasks/index.d.ts +2 -0
- package/dist/types/transport/trpc/a2a/routes/tasks/index.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/routes/tasks/route.d.ts +646 -0
- package/dist/types/transport/trpc/a2a/routes/tasks/route.d.ts.map +1 -0
- package/dist/types/transport/trpc/a2a/trpc.d.ts +272 -0
- package/dist/types/transport/trpc/a2a/trpc.d.ts.map +1 -0
- package/dist/types/transport/trpc/index.d.ts +2 -0
- package/dist/types/transport/trpc/index.d.ts.map +1 -0
- package/dist/types/types/ext.d.ts +14 -0
- package/dist/types/types/ext.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +3 -4
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/{client.d.ts → interfaces/client.d.ts} +7 -2
- package/dist/types/types/interfaces/client.d.ts.map +1 -0
- package/dist/types/types/interfaces/index.d.ts +4 -0
- package/dist/types/types/interfaces/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/builder.d.ts +37 -0
- package/dist/types/types/interfaces/services/a2a/builder.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/context.d.ts +163 -0
- package/dist/types/types/interfaces/services/a2a/context.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/engine.d.ts +8 -0
- package/dist/types/types/interfaces/services/a2a/engine.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/index.d.ts +6 -0
- package/dist/types/types/interfaces/services/a2a/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/legacy.d.ts +90 -0
- package/dist/types/types/interfaces/services/a2a/legacy.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/a2a/service.d.ts +409 -0
- package/dist/types/types/interfaces/services/a2a/service.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/context/command.d.ts +26 -0
- package/dist/types/types/interfaces/services/core/context/command.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/context/context.d.ts +208 -0
- package/dist/types/types/interfaces/services/core/context/context.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/context/index.d.ts +4 -0
- package/dist/types/types/interfaces/services/core/context/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/context/types.d.ts +12 -0
- package/dist/types/types/interfaces/services/core/context/types.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/execution/engine.d.ts +107 -0
- package/dist/types/types/interfaces/services/core/execution/engine.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/execution/environment.d.ts +12 -0
- package/dist/types/types/interfaces/services/core/execution/environment.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/execution/execute.d.ts +8 -0
- package/dist/types/types/interfaces/services/core/execution/execute.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/execution/index.d.ts +4 -0
- package/dist/types/types/interfaces/services/core/execution/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/index.d.ts +5 -0
- package/dist/types/types/interfaces/services/core/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/cancellation.d.ts +10 -0
- package/dist/types/types/interfaces/services/core/managers/cancellation.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/connection.d.ts +10 -0
- package/dist/types/types/interfaces/services/core/managers/connection.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/context.d.ts +18 -0
- package/dist/types/types/interfaces/services/core/managers/context.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/event.d.ts +329 -0
- package/dist/types/types/interfaces/services/core/managers/event.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/index.d.ts +7 -0
- package/dist/types/types/interfaces/services/core/managers/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/stream.d.ts +218 -0
- package/dist/types/types/interfaces/services/core/managers/stream.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/managers/task.d.ts +10 -0
- package/dist/types/types/interfaces/services/core/managers/task.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/core/service.d.ts +116 -0
- package/dist/types/types/interfaces/services/core/service.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/index.d.ts +5 -0
- package/dist/types/types/interfaces/services/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/mcp/index.d.ts +2 -0
- package/dist/types/types/interfaces/services/mcp/index.d.ts.map +1 -0
- package/dist/types/types/interfaces/services/mcp/service.d.ts +50 -0
- package/dist/types/types/interfaces/services/mcp/service.d.ts.map +1 -0
- package/dist/types/types/{services → interfaces/services}/protocol.d.ts +4 -0
- package/dist/types/types/interfaces/services/protocol.d.ts.map +1 -0
- package/dist/types/types/interfaces/storage.d.ts +9 -0
- package/dist/types/types/interfaces/storage.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/agent.d.ts +2584 -0
- package/dist/types/types/schemas/a2a/agent.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/auth.d.ts +909 -0
- package/dist/types/types/schemas/a2a/auth.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/error.d.ts +349 -27
- package/dist/types/types/schemas/a2a/error.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/index.d.ts +8 -216
- package/dist/types/types/schemas/a2a/index.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/kind.d.ts +12 -0
- package/dist/types/types/schemas/a2a/kind.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/message.d.ts +10309 -55
- package/dist/types/types/schemas/a2a/message.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/notification.d.ts +1480 -49
- package/dist/types/types/schemas/a2a/notification.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/parameters.d.ts +878 -109
- package/dist/types/types/schemas/a2a/parameters.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/protocol.d.ts +14364 -0
- package/dist/types/types/schemas/a2a/protocol.d.ts.map +1 -0
- package/dist/types/types/schemas/a2a/rpc.d.ts +135 -56
- package/dist/types/types/schemas/a2a/rpc.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/task.d.ts +5841 -206
- package/dist/types/types/schemas/a2a/task.d.ts.map +1 -1
- package/dist/types/types/schemas/a2a/transport.d.ts +32 -0
- package/dist/types/types/schemas/a2a/transport.d.ts.map +1 -0
- package/dist/types/types/schemas/deployment/index.d.ts +3 -0
- package/dist/types/types/schemas/deployment/index.d.ts.map +1 -0
- package/dist/types/types/{proxy.d.ts → schemas/deployment/proxy.d.ts} +6 -2
- package/dist/types/types/schemas/deployment/proxy.d.ts.map +1 -0
- package/dist/types/types/schemas/deployment/request.d.ts +2848 -0
- package/dist/types/types/schemas/deployment/request.d.ts.map +1 -0
- package/dist/types/types/utils/index.d.ts +2 -0
- package/dist/types/types/utils/index.d.ts.map +1 -0
- package/dist/types/types/{transform.d.ts → utils/transform.d.ts} +4 -0
- package/dist/types/types/utils/transform.d.ts.map +1 -0
- package/dist/types/utils/api/register.d.ts +4 -0
- package/dist/types/utils/api/register.d.ts.map +1 -1
- package/dist/types/utils/common/constants.d.ts +8 -4
- package/dist/types/utils/common/constants.d.ts.map +1 -1
- package/dist/types/utils/common/errors.d.ts +6 -12
- package/dist/types/utils/common/errors.d.ts.map +1 -1
- package/dist/types/utils/common/utils.d.ts +4 -14
- package/dist/types/utils/common/utils.d.ts.map +1 -1
- package/dist/types/utils/common/zAsyncIterable-v3.d.ts +25 -0
- package/dist/types/utils/common/zAsyncIterable-v3.d.ts.map +1 -0
- package/dist/types/utils/common/zAsyncIterable.d.ts +23 -0
- package/dist/types/utils/common/zAsyncIterable.d.ts.map +1 -0
- package/dist/types/utils/deployment/agents.d.ts +5 -1
- package/dist/types/utils/deployment/agents.d.ts.map +1 -1
- package/dist/types/utils/deployment/bundler.d.ts +4 -0
- package/dist/types/utils/deployment/bundler.d.ts.map +1 -1
- package/dist/types/utils/deployment/full-deployment.d.ts +12 -2
- package/dist/types/utils/deployment/full-deployment.d.ts.map +1 -1
- package/dist/types/utils/deployment/index.d.ts +5 -0
- package/dist/types/utils/deployment/index.d.ts.map +1 -0
- package/dist/types/utils/deployment/task-wrapper.d.ts +6 -2
- package/dist/types/utils/deployment/task-wrapper.d.ts.map +1 -1
- package/dist/types/utils/deployment/test-deployment.d.ts +7 -2
- package/dist/types/utils/deployment/test-deployment.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +4 -6
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/index.js +2 -0
- package/dist/types/utils/index.js.map +1 -0
- package/dist/types/utils/logging/index.d.ts +3 -0
- package/dist/types/utils/logging/index.d.ts.map +1 -0
- package/dist/types/utils/logging/log.d.ts +4 -0
- package/dist/types/utils/logging/log.d.ts.map +1 -1
- package/dist/types/utils/logging/logger.d.ts +4 -0
- package/dist/types/utils/logging/logger.d.ts.map +1 -1
- package/dist/types/{server/lib → utils}/storage/file.d.ts +9 -4
- package/dist/types/utils/storage/file.d.ts.map +1 -0
- package/dist/types/{server/lib → utils}/storage/memory.d.ts +9 -4
- package/dist/types/utils/storage/memory.d.ts.map +1 -0
- package/dist/types/{transform.js → utils/transform.js} +2 -1
- package/dist/types/utils/transform.js.map +1 -0
- package/dist/utils/api/register.js +4 -0
- package/dist/utils/api/register.js.map +1 -1
- package/dist/utils/common/constants.js +20 -11
- package/dist/utils/common/constants.js.map +1 -1
- package/dist/utils/common/errors.js +7 -40
- package/dist/utils/common/errors.js.map +1 -1
- package/dist/utils/common/utils.js +4 -46
- package/dist/utils/common/utils.js.map +1 -1
- package/dist/utils/common/zAsyncIterable-v3.js +39 -0
- package/dist/utils/common/zAsyncIterable-v3.js.map +1 -0
- package/dist/utils/common/zAsyncIterable.js +41 -0
- package/dist/utils/common/zAsyncIterable.js.map +1 -0
- package/dist/utils/deployment/agents.js +4 -0
- package/dist/utils/deployment/agents.js.map +1 -1
- package/dist/utils/deployment/bundler.js +4 -0
- package/dist/utils/deployment/bundler.js.map +1 -1
- package/dist/utils/deployment/full-deployment.js +6 -2
- package/dist/utils/deployment/full-deployment.js.map +1 -1
- package/dist/utils/deployment/index.js +5 -0
- package/dist/utils/deployment/index.js.map +1 -0
- package/dist/utils/deployment/task-wrapper.js +4 -0
- package/dist/utils/deployment/task-wrapper.js.map +1 -1
- package/dist/utils/deployment/test-deployment.js +15 -7
- package/dist/utils/deployment/test-deployment.js.map +1 -1
- package/dist/utils/index.js +10 -6
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logging/index.js +3 -0
- package/dist/utils/logging/index.js.map +1 -0
- package/dist/utils/logging/log.js +4 -0
- package/dist/utils/logging/log.js.map +1 -1
- package/dist/utils/logging/logger.js +13 -0
- package/dist/utils/logging/logger.js.map +1 -1
- package/dist/{server/lib → utils}/storage/file.js +17 -6
- package/dist/utils/storage/file.js.map +1 -0
- package/dist/{server/lib → utils}/storage/memory.js +15 -5
- package/dist/utils/storage/memory.js.map +1 -0
- package/package.json +18 -7
- package/dist/server/a2a-server.js +0 -237
- package/dist/server/a2a-server.js.map +0 -1
- package/dist/server/interfaces/params.js +0 -3
- package/dist/server/interfaces/params.js.map +0 -1
- package/dist/server/interfaces/server.js +0 -2
- package/dist/server/interfaces/server.js.map +0 -1
- package/dist/server/interfaces/store.js +0 -18
- package/dist/server/interfaces/store.js.map +0 -1
- package/dist/server/lib/express-server.js +0 -252
- package/dist/server/lib/express-server.js.map +0 -1
- package/dist/server/lib/json-middleware.js +0 -3
- package/dist/server/lib/json-middleware.js.map +0 -1
- package/dist/server/lib/middleware/a2a-methods.js +0 -140
- package/dist/server/lib/middleware/a2a-methods.js.map +0 -1
- package/dist/server/lib/middleware/factory.js +0 -59
- package/dist/server/lib/middleware/factory.js.map +0 -1
- package/dist/server/lib/state.js +0 -80
- package/dist/server/lib/state.js.map +0 -1
- package/dist/server/lib/storage/file.js.map +0 -1
- package/dist/server/lib/storage/memory.js.map +0 -1
- package/dist/server/lib/update/base.js.map +0 -1
- package/dist/services/a2a/repository.js +0 -160
- package/dist/services/a2a/repository.js.map +0 -1
- package/dist/services/manager.js +0 -61
- package/dist/services/manager.js.map +0 -1
- package/dist/transport/streaming/stream.js +0 -111
- package/dist/transport/streaming/stream.js.map +0 -1
- package/dist/types/client.js +0 -2
- package/dist/types/client.js.map +0 -1
- package/dist/types/express.js +0 -2
- package/dist/types/express.js.map +0 -1
- package/dist/types/extended-schema.js +0 -7
- package/dist/types/extended-schema.js.map +0 -1
- package/dist/types/proxy.js +0 -2
- package/dist/types/proxy.js.map +0 -1
- package/dist/types/schemas/a2a/auth/auth.js +0 -2
- package/dist/types/schemas/a2a/auth/auth.js.map +0 -1
- package/dist/types/schemas/a2a/auth/base.js +0 -2
- package/dist/types/schemas/a2a/auth/base.js.map +0 -1
- package/dist/types/schemas/a2a/auth/index.js +0 -4
- package/dist/types/schemas/a2a/auth/index.js.map +0 -1
- package/dist/types/schemas/a2a/auth/oauth.js +0 -2
- package/dist/types/schemas/a2a/auth/oauth.js.map +0 -1
- package/dist/types/schemas/a2a/ref.js +0 -25
- package/dist/types/schemas/a2a/ref.js.map +0 -1
- package/dist/types/server/a2a-server.d.ts +0 -145
- package/dist/types/server/a2a-server.d.ts.map +0 -1
- package/dist/types/server/interfaces/params.d.ts +0 -109
- package/dist/types/server/interfaces/params.d.ts.map +0 -1
- package/dist/types/server/interfaces/server.d.ts +0 -35
- package/dist/types/server/interfaces/server.d.ts.map +0 -1
- package/dist/types/server/interfaces/store.d.ts +0 -35
- package/dist/types/server/interfaces/store.d.ts.map +0 -1
- package/dist/types/server/lib/express-server.d.ts +0 -59
- package/dist/types/server/lib/express-server.d.ts.map +0 -1
- package/dist/types/server/lib/json-middleware.d.ts +0 -3
- package/dist/types/server/lib/json-middleware.d.ts.map +0 -1
- package/dist/types/server/lib/middleware/a2a-methods.d.ts +0 -7
- package/dist/types/server/lib/middleware/a2a-methods.d.ts.map +0 -1
- package/dist/types/server/lib/middleware/factory.d.ts +0 -12
- package/dist/types/server/lib/middleware/factory.d.ts.map +0 -1
- package/dist/types/server/lib/state.d.ts +0 -20
- package/dist/types/server/lib/state.d.ts.map +0 -1
- package/dist/types/server/lib/storage/file.d.ts.map +0 -1
- package/dist/types/server/lib/storage/memory.d.ts.map +0 -1
- package/dist/types/server/lib/update/base.d.ts +0 -21
- package/dist/types/server/lib/update/base.d.ts.map +0 -1
- package/dist/types/services/a2a/repository.d.ts +0 -77
- package/dist/types/services/a2a/repository.d.ts.map +0 -1
- package/dist/types/services/a2a/repository.js +0 -2
- package/dist/types/services/a2a/repository.js.map +0 -1
- package/dist/types/services/a2a/service.js +0 -2
- package/dist/types/services/a2a/service.js.map +0 -1
- package/dist/types/services/context.js +0 -29
- package/dist/types/services/context.js.map +0 -1
- package/dist/types/services/dispatcher.js +0 -33
- package/dist/types/services/dispatcher.js.map +0 -1
- package/dist/types/services/index.js +0 -9
- package/dist/types/services/index.js.map +0 -1
- package/dist/types/services/manager.d.ts +0 -44
- package/dist/types/services/manager.d.ts.map +0 -1
- package/dist/types/services/manager.js +0 -2
- package/dist/types/services/manager.js.map +0 -1
- package/dist/types/services/mcp/service.js +0 -8
- package/dist/types/services/mcp/service.js.map +0 -1
- package/dist/types/services/protocol.js.map +0 -1
- package/dist/types/services/service.js +0 -2
- package/dist/types/services/service.js.map +0 -1
- package/dist/types/transform.js.map +0 -1
- package/dist/types/transport/streaming/stream.d.ts +0 -42
- package/dist/types/transport/streaming/stream.d.ts.map +0 -1
- package/dist/types/types/client.d.ts.map +0 -1
- package/dist/types/types/express.d.ts +0 -66
- package/dist/types/types/express.d.ts.map +0 -1
- package/dist/types/types/extended-schema.d.ts +0 -174
- package/dist/types/types/extended-schema.d.ts.map +0 -1
- package/dist/types/types/proxy.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/auth/auth.d.ts +0 -80
- package/dist/types/types/schemas/a2a/auth/auth.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/auth/base.d.ts +0 -16
- package/dist/types/types/schemas/a2a/auth/base.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/auth/index.d.ts +0 -4
- package/dist/types/types/schemas/a2a/auth/index.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/auth/oauth.d.ts +0 -124
- package/dist/types/types/schemas/a2a/auth/oauth.d.ts.map +0 -1
- package/dist/types/types/schemas/a2a/ref.d.ts +0 -2057
- package/dist/types/types/schemas/a2a/ref.d.ts.map +0 -1
- package/dist/types/types/services/a2a/repository.d.ts +0 -85
- package/dist/types/types/services/a2a/repository.d.ts.map +0 -1
- package/dist/types/types/services/a2a/service.d.ts +0 -29
- package/dist/types/types/services/a2a/service.d.ts.map +0 -1
- package/dist/types/types/services/context.d.ts +0 -167
- package/dist/types/types/services/context.d.ts.map +0 -1
- package/dist/types/types/services/dispatcher.d.ts +0 -20
- package/dist/types/types/services/dispatcher.d.ts.map +0 -1
- package/dist/types/types/services/index.d.ts +0 -9
- package/dist/types/types/services/index.d.ts.map +0 -1
- package/dist/types/types/services/manager.d.ts +0 -42
- package/dist/types/types/services/manager.d.ts.map +0 -1
- package/dist/types/types/services/mcp/service.d.ts +0 -57
- package/dist/types/types/services/mcp/service.d.ts.map +0 -1
- package/dist/types/types/services/protocol.d.ts.map +0 -1
- package/dist/types/types/services/service.d.ts +0 -35
- package/dist/types/types/services/service.d.ts.map +0 -1
- package/dist/types/types/transform.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
# artinet SDK
|
|
9
9
|
|
|
10
|
-
The artinet SDK is a
|
|
10
|
+
The artinet SDK is a TypeScript library designed for Agentic Communication. It's written for [node.js](https://nodejs.org/) and aims to simplify the creation of interoperable AI agents. Learn more at [the artinet project](https://artinet.io/).
|
|
11
11
|
|
|
12
|
-
This SDK
|
|
12
|
+
This SDK leverages a service-oriented architecture for building AI agents allowing developers to easily create agents as simple processes or seamlessly embed them within a dedicated server.
|
|
13
13
|
|
|
14
14
|
### Quick Start
|
|
15
15
|
|
|
16
|
-
To build your own agent/server use the [`create-quick-agent`](https://www.npmjs.com/package/@artinet/create-quick-agent) command:
|
|
16
|
+
To build your own agent/server use the [`create-quick-agent`](https://www.npmjs.com/package/@artinet/create-quick-agent) (supports v0.5.2) command:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
npx @artinet/create-quick-agent@latest
|
|
@@ -22,6 +22,7 @@ npx @artinet/create-quick-agent@latest
|
|
|
22
22
|
It has [serveral template projects](https://github.com/the-artinet-project/create-quick-agent) that you can use to get started building agents today.
|
|
23
23
|
|
|
24
24
|
## Table of Contents
|
|
25
|
+
|
|
25
26
|
- [artinet SDK](#artinet-sdk)
|
|
26
27
|
- [Quick Start](#quick-start)
|
|
27
28
|
- [Table of Contents](#table-of-contents)
|
|
@@ -39,33 +40,40 @@ It has [serveral template projects](https://github.com/the-artinet-project/creat
|
|
|
39
40
|
- [Authentication](#authentication)
|
|
40
41
|
- [Server](#server)
|
|
41
42
|
- [Implementing an A2A Agent](#implementing-an-a2a-agent)
|
|
43
|
+
- [AgentBuilder](#agentbuilder)
|
|
44
|
+
- [AgentEngine](#agentengine)
|
|
45
|
+
- [Event Handling/Monitoring \& Message Streaming](#event-handlingmonitoring--message-streaming)
|
|
42
46
|
- [Persistent Storage](#persistent-storage)
|
|
43
47
|
- [Logging](#logging)
|
|
44
|
-
- [Server Registration \& Discovery](#server-registration--discovery)
|
|
48
|
+
- [Server Registration \& Discovery (v0.5.2)](#server-registration--discovery-v052)
|
|
45
49
|
- [Advanced Server Customization](#advanced-server-customization)
|
|
46
|
-
|
|
50
|
+
- [Cross Protocol Support](#cross-protocol-support)
|
|
51
|
+
- [Quick-Agents (Alpha v0.5.2)](#quick-agents-alpha-v052)
|
|
47
52
|
- [Contributing](#contributing)
|
|
48
53
|
- [License](#license)
|
|
49
54
|
- [Acknowledgements](#acknowledgements)
|
|
50
55
|
|
|
51
56
|
## Features
|
|
52
57
|
|
|
53
|
-
- **
|
|
54
|
-
- **
|
|
55
|
-
- **
|
|
56
|
-
- **
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
| **
|
|
62
|
-
| **
|
|
63
|
-
| **
|
|
64
|
-
| **
|
|
65
|
-
| **
|
|
66
|
-
| **
|
|
67
|
-
| **
|
|
68
|
-
| **
|
|
58
|
+
- **Service-Oriented Architecture:** Modern, modular design with a dedicated layer for protocol handling and state management.
|
|
59
|
+
- **Modern Express Server:** Quickly create an Express Server with the `createAgentServer()` function. It handles all of the transport-layer complexity, adds an A2A <-> JSON-RPC middleware, and manages Server-Sent Events (SSE) automatically.
|
|
60
|
+
- **TypeScript First:** Written in TypeScript with a fully implemented Zod <-> A2A schema.
|
|
61
|
+
- **Protocol Compliance:** Implements the complete A2A specification (v0.3.0) with support for any kind of transport layer (Express, tRPC, WebSockets, etc).
|
|
62
|
+
- **Code Deployment:** Bundle, test, and deploy agent code onto the artinet via the `./deployment` module (v0.5.3). Includes bundler, agent handler, and deployment utilities.
|
|
63
|
+
|
|
64
|
+
| Component/Feature | Description | Key Classes/Types |
|
|
65
|
+
| :------------------- | :-------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| **Client** | Interact with A2A-compliant agents. Supports standard & streaming requests. | `A2AClient` |
|
|
67
|
+
| **Server** | Quickly spin up an Agent as a Server. | `createAgentServer`, `ExpressAgentServer`, `jsonRPCMiddleware` |
|
|
68
|
+
| **Agent Creation** | Design agents with the Agent Builder or take control with the Agent Engine. | `AgentEngine`, `Context`, `AgentBuilder` |
|
|
69
|
+
| **Storage** | Persist event state. In-memory and file-based options included. | `Store`, `InMemoryTaskStore`, `FileStore` |
|
|
70
|
+
| **Streaming (SSE)** | Handle real-time updates via Server-Sent Events with middleware support. | Built-in SSE handling, streaming generators |
|
|
71
|
+
| **Event Handling** | Monitor agent execution with our event system. | `EventManager`, `eventOverrides`, Event listeners (`start`, `update`, `error`, `complete`, `cancel`) |
|
|
72
|
+
| **Logging** | Configure structured logging for debugging and monitoring. | `logger`, `configureLogger`, `LogLevel` |
|
|
73
|
+
| **Transport Layers** | Built-in support for Express/TRPC. | Express middleware, tRPC router, or easily create your own. |
|
|
74
|
+
| **Core Types** | Fully implement A2A schema in Zod. | `AgentCard`, `Task`, `Message`, `Part`, `Artifact`, etc. |
|
|
75
|
+
| **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` |
|
|
69
77
|
|
|
70
78
|
## Installation
|
|
71
79
|
|
|
@@ -75,59 +83,73 @@ npm install @artinet/sdk
|
|
|
75
83
|
|
|
76
84
|
## Requirements
|
|
77
85
|
|
|
78
|
-
- Node.js (v22.0.0 or higher recommended
|
|
86
|
+
- Node.js (v22.0.0 or higher recommended)
|
|
79
87
|
|
|
80
88
|
## Documentation
|
|
81
89
|
|
|
82
90
|
For more detailed documentation visit our documentation site [here](https://the-artinet-project.github.io/artinet-documentation/).
|
|
83
91
|
|
|
84
92
|
## Example
|
|
85
|
-
|
|
86
|
-
A basic A2A server and client interaction. For more detailed examples, see the `examples/` directory.
|
|
93
|
+
|
|
94
|
+
A basic A2A server and client interaction (For simple agents see the [AgentBuilder](#agentbuilder) section). For more detailed examples, see the `examples/` directory.
|
|
87
95
|
|
|
88
96
|
**1. Server (`quick-server.ts`)**
|
|
89
97
|
|
|
90
98
|
```typescript
|
|
91
99
|
import {
|
|
92
|
-
|
|
100
|
+
createAgentServer,
|
|
93
101
|
ExecutionContext,
|
|
94
102
|
AgentEngine,
|
|
95
|
-
|
|
103
|
+
TaskManager,
|
|
104
|
+
MessageSendParams,
|
|
105
|
+
getParts,
|
|
96
106
|
} from "@artinet/sdk";
|
|
97
107
|
|
|
98
|
-
//
|
|
99
|
-
const quickAgentLogic: AgentEngine = async function* (context:
|
|
100
|
-
const params = context.
|
|
101
|
-
const userInput = params.message.parts
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
//Define your Agents Behaviour
|
|
109
|
+
const quickAgentLogic: AgentEngine = async function* (context: Context) {
|
|
110
|
+
const params: MessageSendParams = context.command; //MessageSendParams
|
|
111
|
+
const { text: userInput} = getParts(params.message.parts); //helper function to consume parts
|
|
112
|
+
const task = context.State(); //TaskAndHistory
|
|
113
|
+
yield {
|
|
114
|
+
...
|
|
115
|
+
state: "working"
|
|
116
|
+
...
|
|
117
|
+
};
|
|
118
|
+
|
|
106
119
|
yield {
|
|
120
|
+
...
|
|
107
121
|
state: "completed",
|
|
108
122
|
message: {
|
|
109
123
|
role: "agent",
|
|
110
124
|
parts: [{ kind: "text", text: `You said: ${userInput}` }],
|
|
111
125
|
},
|
|
126
|
+
...
|
|
112
127
|
};
|
|
113
128
|
};
|
|
114
129
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
// Create an agent server
|
|
131
|
+
const { app, agent } = createAgentServer({
|
|
132
|
+
agent: {
|
|
133
|
+
engine: quickAgentLogic,
|
|
134
|
+
agentCard: {
|
|
135
|
+
name: "QuickStart Agent",
|
|
136
|
+
url: "http://localhost:4000/a2a",
|
|
137
|
+
version: "0.1.0",
|
|
138
|
+
capabilities: { streaming: true },
|
|
139
|
+
skills: [{ id: "echo", name: "Echo Skill" }],
|
|
140
|
+
...
|
|
141
|
+
},
|
|
142
|
+
tasks: new TaskManager(),
|
|
143
|
+
...
|
|
126
144
|
},
|
|
145
|
+
basePath: "/a2a",
|
|
146
|
+
agentCardPath: "/.well-known/agent.json"
|
|
147
|
+
...
|
|
127
148
|
});
|
|
128
149
|
|
|
129
|
-
|
|
130
|
-
console.log("A2A Server running at http://localhost:4000/a2a");
|
|
150
|
+
app.listen(4000, () => {
|
|
151
|
+
console.log("A2A Server running at http://localhost:4000/a2a");
|
|
152
|
+
});
|
|
131
153
|
```
|
|
132
154
|
|
|
133
155
|
**2. Client (`quick-client.ts`)**
|
|
@@ -142,13 +164,14 @@ async function runClient() {
|
|
|
142
164
|
messageId: "test-message-id",
|
|
143
165
|
kind: "message",
|
|
144
166
|
role: "user",
|
|
145
|
-
parts: [{ kind: "text", text: "Hello
|
|
167
|
+
parts: [{ kind: "text", text: "Hello World!" }],
|
|
168
|
+
...
|
|
146
169
|
};
|
|
147
170
|
|
|
148
171
|
const stream = client.sendStreamingMessage({ message });
|
|
149
172
|
|
|
150
173
|
for await (const update of stream) {
|
|
151
|
-
// process the
|
|
174
|
+
// process the updates
|
|
152
175
|
...
|
|
153
176
|
}
|
|
154
177
|
console.log("Stream finished.");
|
|
@@ -193,6 +216,7 @@ async function runBasicTask() {
|
|
|
193
216
|
kind: "message",
|
|
194
217
|
role: "user",
|
|
195
218
|
parts: [{ kind: "text", text: "What is the capital of France?" }],
|
|
219
|
+
...
|
|
196
220
|
};
|
|
197
221
|
|
|
198
222
|
const task = await client.sendMessage({ message });
|
|
@@ -216,10 +240,13 @@ async function runStreamingTask() {
|
|
|
216
240
|
const client = new A2AClient("https://your-a2a-server.com/a2a");
|
|
217
241
|
const message: Message = {
|
|
218
242
|
role: "user",
|
|
219
|
-
parts: [{
|
|
243
|
+
parts: [{ kind: "text", text: "Tell me a short story." }],
|
|
244
|
+
...
|
|
220
245
|
};
|
|
221
246
|
|
|
222
|
-
const stream = client.sendStreamingMessage({
|
|
247
|
+
const stream = client.sendStreamingMessage({
|
|
248
|
+
message,
|
|
249
|
+
});
|
|
223
250
|
|
|
224
251
|
for await (const update of stream) {
|
|
225
252
|
if ((update as TaskStatusUpdateEvent).status) {
|
|
@@ -253,76 +280,231 @@ client.setHeaders({ Authorization: "Bearer ...", "X-Custom": "value" });
|
|
|
253
280
|
|
|
254
281
|
### Server
|
|
255
282
|
|
|
256
|
-
|
|
283
|
+
Use `createAgentServer()` to embed your Agents in an Express App.
|
|
257
284
|
|
|
258
285
|
#### Implementing an A2A Agent
|
|
259
286
|
|
|
260
|
-
|
|
287
|
+
The SDK provides a variety of options for creating complex ([AgentEngine](#agentengine)) or simple agents ([AgentBuilder](#agentbuilder)).
|
|
288
|
+
|
|
289
|
+
##### AgentBuilder
|
|
290
|
+
|
|
291
|
+
**Option 1: Using AgentBuilder (Recommended for Simple Workflows)**
|
|
292
|
+
|
|
293
|
+
For simple agents with one or more processing steps, use the `AgentBuilder` pattern:
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
import { createAgentServer, AgentBuilder, TaskManager } from "@artinet/sdk";
|
|
297
|
+
|
|
298
|
+
//create a simple agent
|
|
299
|
+
const simpleAgent = AgentBuilder().text(() => "hello world!");
|
|
300
|
+
|
|
301
|
+
//or design a powerful workflow
|
|
302
|
+
const { app, agent } = createAgentServer({
|
|
303
|
+
agent: AgentBuilder()
|
|
304
|
+
.text(({ command, context }) => {
|
|
305
|
+
const userMessage =
|
|
306
|
+
command.message.parts[0]?.kind === "text"
|
|
307
|
+
? command.message.parts[0].text
|
|
308
|
+
: "";
|
|
309
|
+
return {
|
|
310
|
+
parts: [`Processing: ${userMessage}`], //parts are immediately sent back to the caller as TaskStatusUpdateEvents
|
|
311
|
+
args: [userMessage], //args are passed to the next step
|
|
312
|
+
};
|
|
313
|
+
})
|
|
314
|
+
.file(({ command, args }) => {
|
|
315
|
+
const processedText = args[0];
|
|
316
|
+
return {
|
|
317
|
+
parts: [
|
|
318
|
+
{
|
|
319
|
+
name: "result.txt",
|
|
320
|
+
mimeType: "text/plain",
|
|
321
|
+
bytes: `Processed result: ${processedText}`,
|
|
322
|
+
},
|
|
323
|
+
],
|
|
324
|
+
args: ["file-generated"],
|
|
325
|
+
};
|
|
326
|
+
})
|
|
327
|
+
.text(({ command, args }) => {
|
|
328
|
+
const status = args[0];
|
|
329
|
+
return `Task completed. Status: ${status}`;
|
|
330
|
+
}) //A final Task is returned to the caller which contains all of the emitted parts.
|
|
331
|
+
.createAgent({
|
|
332
|
+
agentCard: {
|
|
333
|
+
name: "Multi-Step Agent",
|
|
334
|
+
url: "http://localhost:3000/a2a",
|
|
335
|
+
version: "1.0.0",
|
|
336
|
+
capabilities: { streaming: true },
|
|
337
|
+
skills: [{ id: "multi-processor", name: "Multi-Step Processor" }],
|
|
338
|
+
},
|
|
339
|
+
tasks: new TaskManager(),
|
|
340
|
+
}),
|
|
341
|
+
basePath: "/a2a",
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
app.listen(3000, () => {
|
|
345
|
+
console.log("Multi-Step A2A Server running on http://localhost:3000/a2a");
|
|
346
|
+
});
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
The `AgentBuilder` approach is particularly useful when you need:
|
|
350
|
+
|
|
351
|
+
- **Step-by-step processing**: Break down complex tasks into discrete, manageable steps
|
|
352
|
+
- **Data flow between steps**: Pass results from one step to the next using the `args` parameter
|
|
353
|
+
- **Different content types**: Mix text, file, and data processing in a single workflow
|
|
354
|
+
- **Reusable components**: Build modular agents that can be easily edited or extended
|
|
355
|
+
|
|
356
|
+
##### AgentEngine
|
|
357
|
+
|
|
358
|
+
**Option 2: Direct AgentEngine Implementation**
|
|
359
|
+
|
|
360
|
+
When you need full control over the execution flow, implement an `AgentEngine` directly:
|
|
261
361
|
|
|
262
362
|
```typescript
|
|
263
363
|
import {
|
|
264
|
-
|
|
265
|
-
|
|
364
|
+
createAgentServer,
|
|
365
|
+
Context,
|
|
266
366
|
AgentEngine,
|
|
267
|
-
|
|
367
|
+
TaskManager,
|
|
268
368
|
} from "@artinet/sdk";
|
|
269
369
|
|
|
270
|
-
|
|
271
|
-
const
|
|
272
|
-
|
|
370
|
+
const myAgent: AgentEngine = async function* (context: Context) {
|
|
371
|
+
const task: TaskAndHistory = context.events.getState();
|
|
273
372
|
yield {
|
|
274
373
|
state: "working",
|
|
275
374
|
message: {
|
|
375
|
+
...
|
|
276
376
|
role: "agent",
|
|
277
|
-
parts: [{
|
|
377
|
+
parts: [{ kind: "text", text: "Processing..." }],
|
|
278
378
|
},
|
|
379
|
+
...
|
|
279
380
|
};
|
|
280
|
-
|
|
281
|
-
// Check context.isCancelled() if operation is long
|
|
282
|
-
// await someAsyncTask();
|
|
283
|
-
...
|
|
284
|
-
|
|
285
381
|
yield {
|
|
382
|
+
...
|
|
286
383
|
name: "result.txt",
|
|
287
384
|
mimeType: "text/plain",
|
|
288
|
-
parts: [{
|
|
385
|
+
parts: [{ kind: "text", text: "Report data" }],
|
|
289
386
|
};
|
|
290
387
|
|
|
291
388
|
yield {
|
|
389
|
+
...
|
|
292
390
|
state: "completed",
|
|
293
391
|
message: {
|
|
392
|
+
kind: "message"
|
|
294
393
|
role: "agent",
|
|
295
|
-
parts: [{
|
|
394
|
+
parts: [{ kind: "text", text: "Finished processing." }],
|
|
395
|
+
...
|
|
296
396
|
},
|
|
297
397
|
};
|
|
298
398
|
};
|
|
299
399
|
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
400
|
+
const { app, agent } = createAgentServer({
|
|
401
|
+
agent: {
|
|
402
|
+
engine: myAgent,
|
|
403
|
+
agentCard: {
|
|
404
|
+
name: "Example Agent",
|
|
405
|
+
url: "http://localhost:3000/a2a",
|
|
406
|
+
version: "1.0.0",
|
|
407
|
+
capabilities: { streaming: true },
|
|
408
|
+
skills: [{ id: "processor", name: "Text Processor" }],
|
|
409
|
+
},
|
|
410
|
+
tasks: new TaskManager(),
|
|
411
|
+
},
|
|
304
412
|
basePath: "/a2a",
|
|
305
|
-
|
|
306
|
-
|
|
413
|
+
agentCardPath: "/.well-known/agent-card.json",
|
|
414
|
+
});
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### Event Handling/Monitoring & Message Streaming
|
|
418
|
+
|
|
419
|
+
The SDK provides comprehensive event handling & message streaming capabilities that allow you to modify agent execution, subscribe to events, stream commands, and respond to state changes in real-time.
|
|
420
|
+
|
|
421
|
+
**Override Event Behaviour**
|
|
422
|
+
|
|
423
|
+
When using the service layer, you can provide your own Event Handlers:
|
|
424
|
+
|
|
425
|
+
```typescript
|
|
426
|
+
import { createAgent, TaskManager, ContextManager, Command, SendCommandInterface } from "@artinet/sdk";
|
|
427
|
+
|
|
428
|
+
const customContextManager = new ContextManger();
|
|
429
|
+
const agent = createAgent({
|
|
430
|
+
engine: (context: Context){
|
|
431
|
+
context.events.on("update", (currentState, nextState) => {
|
|
432
|
+
//allow other processes to subscribe to your agent
|
|
433
|
+
})
|
|
434
|
+
...
|
|
435
|
+
//handle command streams directly within an agent
|
|
436
|
+
for await (const command of context.command) {
|
|
437
|
+
console.log("new command recieved: ", command);
|
|
438
|
+
//will continue polling until the command stream is closed by calling command.close();
|
|
439
|
+
}
|
|
440
|
+
//or process them asynchronously
|
|
441
|
+
context.command.on("send", (command) => {
|
|
442
|
+
...
|
|
443
|
+
});
|
|
444
|
+
},
|
|
445
|
+
agentCard: {
|
|
446
|
+
name: "Event-Monitored Agent",
|
|
307
447
|
url: "http://localhost:3000/a2a",
|
|
308
448
|
version: "1.0.0",
|
|
309
449
|
capabilities: { streaming: true },
|
|
310
|
-
skills: [{ id: "
|
|
450
|
+
skills: [{ id: "monitor", name: "Monitored Agent" }],
|
|
311
451
|
},
|
|
452
|
+
contexts: customContextManager,
|
|
453
|
+
tasks: new TaskManager(),
|
|
454
|
+
eventOverrides: { //for even greater control create your own Event Handlers
|
|
455
|
+
onStart: async (context) => {
|
|
456
|
+
...
|
|
457
|
+
return currentState;
|
|
458
|
+
},
|
|
459
|
+
onUpdate: async (currentState, nextState) => {
|
|
460
|
+
...
|
|
461
|
+
return currentState;
|
|
462
|
+
},
|
|
463
|
+
...
|
|
464
|
+
},
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
const result = await agent.sendMessage({
|
|
468
|
+
contextId: "123"
|
|
469
|
+
...
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
const currentContext = customContextManager.getContext("123");
|
|
473
|
+
|
|
474
|
+
//subscribe to the events from a specific context
|
|
475
|
+
currentContext.events.on("complete", () {
|
|
476
|
+
...
|
|
477
|
+
//errors thrown here will be triggered in the original context
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
//stream new commands into a running context
|
|
481
|
+
(currentContext.command as SendCommandInterface<Command>).send({
|
|
482
|
+
...
|
|
312
483
|
});
|
|
313
484
|
|
|
314
|
-
|
|
315
|
-
console.log("A2A Server running on http://localhost:3000/a2a");
|
|
485
|
+
currentContext.command.close();
|
|
316
486
|
```
|
|
317
487
|
|
|
488
|
+
**Available Event Types**
|
|
489
|
+
|
|
490
|
+
The EventManager supports the following event types:
|
|
491
|
+
|
|
492
|
+
- **`OnStart`/`start`**: Fired when agent execution begins
|
|
493
|
+
- **`OnUpdate`/`update`**: Fired on each state update during execution
|
|
494
|
+
- **`OnError`/`error`**: Fired when an error occurs during execution
|
|
495
|
+
- **`OnComplete`/`complete`**: Fired when agent execution completes successfully
|
|
496
|
+
- **`OnCancel`/`cancel`**: Fired when agent execution is cancelled
|
|
497
|
+
|
|
318
498
|
#### Persistent Storage
|
|
319
499
|
|
|
320
|
-
|
|
500
|
+
For storage, use our out of the box storage providers like `FileStore`. Or implement the `Store` interface to create your own.
|
|
321
501
|
|
|
322
502
|
```typescript
|
|
323
503
|
import path from "path";
|
|
324
504
|
import fs from "fs";
|
|
505
|
+
import { FileStore } from "@artinet/sdk";
|
|
325
506
|
|
|
507
|
+
//make sure the directory exists
|
|
326
508
|
const dataDir = path.join(process.cwd(), "a2a-data");
|
|
327
509
|
if (!fs.existsSync(dataDir)) {
|
|
328
510
|
fs.mkdirSync(dataDir, { recursive: true });
|
|
@@ -330,8 +512,14 @@ if (!fs.existsSync(dataDir)) {
|
|
|
330
512
|
|
|
331
513
|
const myStore = new FileStore(dataDir);
|
|
332
514
|
|
|
333
|
-
const
|
|
334
|
-
|
|
515
|
+
const { app, agent } = createAgentServer({
|
|
516
|
+
agent: {
|
|
517
|
+
engine: myAgent,
|
|
518
|
+
agentCard: {
|
|
519
|
+
...
|
|
520
|
+
},
|
|
521
|
+
tasks: myStore,
|
|
522
|
+
},
|
|
335
523
|
...
|
|
336
524
|
});
|
|
337
525
|
```
|
|
@@ -350,108 +538,232 @@ logger.info("Server starting...");
|
|
|
350
538
|
//use helper functions
|
|
351
539
|
logDebug("LoggerTest", { taskId: "task-123" }, "Task status updated.");
|
|
352
540
|
|
|
353
|
-
// Create child
|
|
541
|
+
// Create child loggers with bounded contexts
|
|
354
542
|
const taskLogger = logger.child({ taskId: "abc" });
|
|
355
543
|
taskLogger.info("Processing step X");
|
|
356
544
|
```
|
|
357
545
|
|
|
358
|
-
#### Server Registration & Discovery
|
|
546
|
+
#### Server Registration & Discovery (v0.5.2)
|
|
359
547
|
|
|
360
|
-
The SDK includes features to help make your agent discoverable:
|
|
548
|
+
The SDK includes features to help make your agent discoverable using the new service-based architecture:
|
|
361
549
|
|
|
362
|
-
- **Automatic Registration:** You can configure your
|
|
550
|
+
- **Automatic Registration:** You can configure your agent server to automatically register your `AgentCard` with the [A2A Registry](https://artinet.io) upon startup by setting `register: true` in the server parameters (temporarily unavailable in v0.5.6).
|
|
363
551
|
|
|
364
552
|
```typescript
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
553
|
+
const { app, agent } = createAgentServer({
|
|
554
|
+
agent: {
|
|
555
|
+
engine: myAgent,
|
|
556
|
+
agentCard: {
|
|
557
|
+
// ...
|
|
369
558
|
url: "http://my-public-domain:3000/my-agent", // Publicly accessible URL
|
|
370
|
-
...
|
|
559
|
+
// ...
|
|
371
560
|
},
|
|
372
|
-
|
|
373
|
-
|
|
561
|
+
},
|
|
562
|
+
});
|
|
374
563
|
```
|
|
375
564
|
|
|
376
|
-
- **Custom Agent Card Path:** By default, the server exposes its `AgentCard` at `/.well-known/agent.json` [RFC8615](https://datatracker.ietf.org/doc/html/rfc8615)
|
|
565
|
+
- **Custom Agent Card Path:** By default, the server exposes its `AgentCard` at `/.well-known/agent-card.json` following [RFC8615](https://datatracker.ietf.org/doc/html/rfc8615). You can specify a custom path using the `agentCardPath` option.
|
|
377
566
|
|
|
378
567
|
```typescript
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
// The AgentCard is now accessible at http://localhost:3001/apiV2/custom-card-info
|
|
568
|
+
const { app, agent } = createAgentServer({
|
|
569
|
+
...
|
|
570
|
+
basePath: "/apiV2",
|
|
571
|
+
agentCardPath: "/apiV2/custom-card-info", // Custom agent card path
|
|
572
|
+
});
|
|
573
|
+
// The AgentCard is now accessible at http://localhost:3000/apiV2/custom-card-info
|
|
386
574
|
```
|
|
387
575
|
|
|
388
576
|
#### Advanced Server Customization
|
|
389
577
|
|
|
390
|
-
|
|
578
|
+
Our new architecture provides multiple ways to customize your agent server:
|
|
579
|
+
|
|
580
|
+
**1. Using `createAgentServer`:**
|
|
581
|
+
Easily spin up an A2A Express app `createAgentServer()`:
|
|
582
|
+
|
|
583
|
+
```typescript
|
|
584
|
+
const initialApp = express();
|
|
585
|
+
|
|
586
|
+
// custom middleware
|
|
587
|
+
initialApp.use((req, res, next) => {
|
|
588
|
+
...
|
|
589
|
+
next();
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
const { app, agent } = createAgentServer({
|
|
593
|
+
app: initialApp
|
|
594
|
+
agent: {
|
|
595
|
+
...
|
|
596
|
+
},
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
// custom middleware
|
|
600
|
+
app.use("/custom", (req, res, next) => {
|
|
601
|
+
...
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
**2. Use the JSON-RPC Middleware:**
|
|
607
|
+
Directly import our preconfigured JSON-RPC middleware:
|
|
608
|
+
|
|
609
|
+
```typescript
|
|
610
|
+
import express from "express";
|
|
611
|
+
import { createAgent, jsonRPCMiddleware, errorHandler, InMemoryTaskStore } from "@artinet/sdk";
|
|
612
|
+
|
|
613
|
+
const customApp = express();
|
|
614
|
+
|
|
615
|
+
const agent = createAgent({
|
|
616
|
+
engine: myAgentLogic,
|
|
617
|
+
agentCard: {
|
|
618
|
+
...
|
|
619
|
+
},
|
|
620
|
+
tasks: new InMemoryTaskStore(),
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
customApp.use("/auth", yourAuthMiddleware);
|
|
624
|
+
customApp.use("/metrics", yourMetricsMiddleware);
|
|
625
|
+
customApp.use(express.json());
|
|
626
|
+
|
|
627
|
+
// Add the A2A middleware
|
|
628
|
+
customApp.post("/", async (req, res, next) => {
|
|
629
|
+
return await jsonRPCMiddleware(agent, req, res, next);
|
|
630
|
+
});
|
|
631
|
+
// Dont forget to add error handling*
|
|
632
|
+
customApp.use(errorHandler);
|
|
633
|
+
|
|
634
|
+
// Serve the agent card
|
|
635
|
+
customApp.get("/.well-known/agent-card.json", (req, res) => {
|
|
636
|
+
res.json(agent.agentCard);
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
// Start your custom server
|
|
640
|
+
const server = customApp.listen(3000, () => {
|
|
641
|
+
console.log("Custom A2A server running on port 3000");
|
|
642
|
+
});
|
|
643
|
+
```
|
|
391
644
|
|
|
392
|
-
|
|
645
|
+
**3. Using Custom Transport Layers:**
|
|
646
|
+
Use our preconfigured TRPC router, or create your own integration with WebSockets & other protocols:
|
|
393
647
|
|
|
394
|
-
|
|
648
|
+
```typescript
|
|
649
|
+
import { createAgentRouter } from "@artinet/sdk";
|
|
395
650
|
|
|
396
|
-
|
|
651
|
+
const agentRouter = createAgentRouter();
|
|
652
|
+
```
|
|
397
653
|
|
|
398
|
-
**
|
|
654
|
+
**Use the Agent:**
|
|
655
|
+
Directly invoke the agent to use it locally:
|
|
399
656
|
|
|
400
657
|
```typescript
|
|
658
|
+
import { createAgent } from "@artinet/sdk";
|
|
401
659
|
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
660
|
+
const agent = createAgent({
|
|
661
|
+
engine: myAgentLogic,
|
|
662
|
+
agentCard: {
|
|
663
|
+
...
|
|
664
|
+
},
|
|
665
|
+
tasks: new InMemoryTaskStore(),
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
// Wrap these calls in your desired transport logic
|
|
669
|
+
const result = await agent.sendMessage({
|
|
410
670
|
...
|
|
411
|
-
|
|
412
|
-
};
|
|
671
|
+
});
|
|
413
672
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
const messageSendMethod = createJSONRPCMethod(params, myCustomSendMethod, "message/send");
|
|
419
|
-
const taskGetMethod = createJSONRPCMethod(params, defaultGetTaskMethod, "tasks/get");
|
|
420
|
-
const taskCancelMethod = createJSONRPCMethod(params, defaultCancelTaskMethod, "tasks/cancel");
|
|
421
|
-
|
|
422
|
-
// Note: Push notifications are not fully implemented yet
|
|
423
|
-
const taskPushNotificationSetMethod = createJSONRPCMethod(params, defaultSetTaskPushNotificationMethod, "tasks/pushNotificationConfig/set");
|
|
424
|
-
const taskPushNotificationGetMethod = createJSONRPCMethod(params, defaultGetTaskPushNotificationMethod, "tasks/pushNotificationConfig/get");
|
|
425
|
-
|
|
426
|
-
const rpcServer = new JSONRPCServer({
|
|
427
|
-
"message/send": messageSendMethod,
|
|
428
|
-
"tasks/get": taskGetMethod,
|
|
429
|
-
"tasks/cancel": taskCancelMethod,
|
|
430
|
-
"tasks/pushNotificationConfig/set": taskPushNotificationSetMethod,
|
|
431
|
-
"tasks/pushNotificationConfig/get": taskPushNotificationGetMethod,
|
|
432
|
-
});
|
|
673
|
+
// Directly process streams
|
|
674
|
+
const stream = agent.streamMessage({
|
|
675
|
+
...
|
|
676
|
+
});
|
|
433
677
|
|
|
434
|
-
|
|
435
|
-
|
|
678
|
+
for await (const update of stream) {
|
|
679
|
+
...
|
|
680
|
+
}
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
**Important:** When using custom implementations, ensure you handle:
|
|
684
|
+
|
|
685
|
+
- Server-Sent Events (SSE) for `message/stream` and `tasks/resubscribe`
|
|
686
|
+
- Agent card endpoints at `/.well-known/agent-card.json`
|
|
687
|
+
- Proper error handling and JSON-RPC compliance
|
|
688
|
+
- CORS headers if needed for web clients
|
|
689
|
+
|
|
690
|
+
#### Cross Protocol Support
|
|
691
|
+
|
|
692
|
+
**MCP (Model Context Protocol) Integration**
|
|
436
693
|
|
|
694
|
+
The SDK provides a Model Context Protocol (MCP) <-> A2A compatability layer.
|
|
437
695
|
|
|
438
|
-
|
|
439
|
-
|
|
696
|
+
Use `createMCPAgent` to expose your agent via MCP:
|
|
697
|
+
|
|
698
|
+
```typescript
|
|
699
|
+
import { createMCPAgent, createAgent } from "@artinet/sdk";
|
|
700
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
701
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
702
|
+
|
|
703
|
+
// Wrap your agent in an MCP Server
|
|
704
|
+
const mcpAgent = createMCPAgent({
|
|
705
|
+
serverInfo: {
|
|
706
|
+
name: "My MCP Agent",
|
|
707
|
+
version: "1.0.0",
|
|
708
|
+
},
|
|
709
|
+
options: {
|
|
710
|
+
...
|
|
711
|
+
},
|
|
712
|
+
agent: createAgent({
|
|
713
|
+
engine: myAgentEngine,
|
|
714
|
+
agentCard: {
|
|
715
|
+
name: "My Agent",
|
|
716
|
+
url: "http://localhost:3000/a2a",
|
|
717
|
+
version: "1.0.0",
|
|
718
|
+
capabilities: { streaming: true },
|
|
719
|
+
skills: [{ id: "helper", name: "Helper Agent" }],
|
|
720
|
+
},
|
|
721
|
+
}),
|
|
722
|
+
agentCardUri: "agent://card", //customize the URI for your AgentCard
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
// The MCPAgent is a fully compliant MCP Server so you can use it as you normally would.
|
|
726
|
+
mcpAgent.registerTool({
|
|
440
727
|
...
|
|
441
728
|
});
|
|
729
|
+
|
|
730
|
+
await mcpAgent.connect(new StdioServerTransport());
|
|
442
731
|
```
|
|
443
732
|
|
|
444
|
-
|
|
733
|
+
Use an MCP Client to interact with an mcpAgent:
|
|
734
|
+
|
|
735
|
+
```typescript
|
|
736
|
+
...
|
|
737
|
+
// Access the AgentCard as a Resource
|
|
738
|
+
const agentCard = await client.readResource({ uri: "agent://card" });
|
|
739
|
+
|
|
740
|
+
// or send messages via Tool Calling
|
|
741
|
+
const result = await client.callTool({
|
|
742
|
+
name: "send-message",
|
|
743
|
+
arguments: {
|
|
744
|
+
...
|
|
745
|
+
message: {
|
|
746
|
+
...
|
|
747
|
+
parts: [{ kind: "text", text: "Hello from MCP!" }],
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
});
|
|
751
|
+
```
|
|
445
752
|
|
|
446
|
-
|
|
753
|
+
**MCP Tools & Resources:**
|
|
447
754
|
|
|
448
|
-
|
|
755
|
+
- `send-message`: Send messages to the A2A agent
|
|
756
|
+
- `get-task`: Retrieve tasks by ID
|
|
757
|
+
- `cancel-task`: Cancel a running task
|
|
758
|
+
- `agent://card`: Retrieve the AgentCard
|
|
759
|
+
- `send-streaming-message`, `task-resubscribe` & `push-notifications` etc are currently not supported by default.
|
|
760
|
+
- Leverage the A2A Zod Schemas to implement them manually.
|
|
449
761
|
|
|
450
|
-
### Quick-Agents (Alpha)
|
|
762
|
+
### Quick-Agents (Alpha v0.5.2)
|
|
451
763
|
|
|
452
|
-
We are excited to introduce new capabilities for deploying agents directly onto the artinet.
|
|
764
|
+
We are excited to introduce new capabilities for deploying agents directly onto the artinet.
|
|
453
765
|
|
|
454
|
-
We've added a `testDeployment` utility which is available for all users letting you bundle and test your agent logic in a temporary sandboxed environment.
|
|
766
|
+
We've added a `testDeployment` utility which is available for all users letting you bundle and test your agent logic in a temporary sandboxed environment.
|
|
455
767
|
|
|
456
768
|
**QUICK-AGENTS** Use the `fullDeployment` utility, which allows direct deployment of your bundled agent code and `AgentCard` to the Artinet platform (requires an `ARTINET_API_KEY`).
|
|
457
769
|
|
|
@@ -459,89 +771,108 @@ To join the beta waitlist, please email us at humans@artinet.io and stay tuned f
|
|
|
459
771
|
|
|
460
772
|
Key features include:
|
|
461
773
|
|
|
462
|
-
-
|
|
463
|
-
```typescript
|
|
464
|
-
import { bundle } from "@artinet/sdk";
|
|
774
|
+
- **Easy Agent Bundling:** Bundle your agent's code and dependencies into a single file using the `bundle` utility from the new deployment export.
|
|
465
775
|
|
|
466
|
-
|
|
467
|
-
|
|
776
|
+
```typescript
|
|
777
|
+
import { bundle } from "@artinet/sdk/deployment";
|
|
468
778
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
- `artinet.v0.connect`: Replaces the deprecated `fetchResponseProxy`. Allows agents to make proxied calls to other agents or LLMs via the host environment.
|
|
472
|
-
- `artinet.v0.agent`: A factory function to obtain a `ClientProxy` for type-safe communication with other agents, managed by the host environment.
|
|
779
|
+
const bundledCode = await bundle(new URL("./your-agent.ts", import.meta.url));
|
|
780
|
+
```
|
|
473
781
|
|
|
474
|
-
|
|
475
|
-
```typescript
|
|
476
|
-
import { TaskContext, TaskYieldUpdate, Task } from "@artinet/sdk";
|
|
477
|
-
import { artinet } from "@artinet/sdk/agents";
|
|
782
|
+
- **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`.
|
|
478
783
|
|
|
479
|
-
|
|
480
|
-
|
|
784
|
+
- `artinet.v0.taskManager`: Manages the agent's lifecycle by iterating over the agent's `TaskHandler` and communicating updates to the host environment.
|
|
785
|
+
- `artinet.v0.connect`: Replaces the deprecated `fetchResponseProxy`. Allows agents to make proxied calls to other agents or LLMs via the host environment.
|
|
786
|
+
- `artinet.v0.agent`: A factory function to obtain a `ClientProxy` for type-safe communication with other agents, managed by the host environment.
|
|
481
787
|
|
|
482
|
-
|
|
483
|
-
const llmResponse = await artinet.v0.connect({
|
|
484
|
-
agentId: "SomeLLMAgentID",
|
|
485
|
-
messages: [{ role: "user", content: "Tell me a joke." }]
|
|
486
|
-
});
|
|
788
|
+
Example of using the new `artinet.v0` utilities in an agent:
|
|
487
789
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
});
|
|
492
|
-
const taskResult = await anotherAgent.sendTask({
|
|
493
|
-
...
|
|
494
|
-
});
|
|
790
|
+
```typescript
|
|
791
|
+
import { TaskContext, TaskYieldUpdate, Task } from "@artinet/sdk";
|
|
792
|
+
import { artinet } from "@artinet/sdk/agents";
|
|
495
793
|
|
|
496
|
-
|
|
794
|
+
export async function* myAgentLogic(context: TaskContext): AsyncGenerator<TaskYieldUpdate, Task | void, unknown> {
|
|
795
|
+
yield { state: "working" };
|
|
497
796
|
|
|
498
|
-
//
|
|
499
|
-
await artinet.v0.
|
|
500
|
-
|
|
501
|
-
|
|
797
|
+
// Call another agent/LLM using artinet.v0.connect
|
|
798
|
+
const llmResponse = await artinet.v0.connect({
|
|
799
|
+
agentId: "SomeLLMAgentID",
|
|
800
|
+
messages: [{ role: "user", content: "Tell me a joke." }]
|
|
801
|
+
});
|
|
502
802
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
803
|
+
// Or communicate tasks with artinet.v0.agent
|
|
804
|
+
const anotherAgent = artinet.v0.agent({
|
|
805
|
+
baseUrl: "https://agents.artinet.io/agentId=456",
|
|
806
|
+
});
|
|
807
|
+
const taskResult = await anotherAgent.sendTask({
|
|
808
|
+
...
|
|
809
|
+
});
|
|
506
810
|
|
|
507
|
-
|
|
508
|
-
code: "/* bundled code string */",
|
|
509
|
-
};
|
|
510
|
-
//create a list of tasks for your agent to complete once deployed
|
|
511
|
-
const testRequests: SendTaskRequest[] = [
|
|
512
|
-
{ id: "t1", message: { role: "user", parts: [{ type: "text", text: "Hi!" }] } }
|
|
513
|
-
];
|
|
811
|
+
}
|
|
514
812
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
```
|
|
813
|
+
// The host environment will invoke this taskManager with the agent's logic.
|
|
814
|
+
await artinet.v0.taskManager({ taskHandler: myAgentLogic });
|
|
815
|
+
```
|
|
519
816
|
|
|
520
|
-
|
|
521
|
-
```typescript
|
|
522
|
-
import { fullDeployment, ServerDeploymentRequestParams } from "@artinet/sdk";
|
|
817
|
+
_Note: The `taskHandlerProxy` and `fetchResponseProxy` utilities are now deprecated in favor of `artinet.v0.taskManager` and `artinet.v0.connect` respectively._
|
|
523
818
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
819
|
+
- **Test-Agents (Experimental):** Simulate and test your agents @ agents.artinet.io/test/deploy using the `testDeployment` tool.
|
|
820
|
+
|
|
821
|
+
```typescript
|
|
822
|
+
import {
|
|
823
|
+
testDeployment,
|
|
824
|
+
ServerDeploymentRequestParams,
|
|
825
|
+
SendTaskRequest,
|
|
826
|
+
} from "@artinet/sdk/deployment";
|
|
827
|
+
|
|
828
|
+
const deploymentParams: ServerDeploymentRequestParams = {
|
|
829
|
+
code: "/* bundled code string */",
|
|
830
|
+
};
|
|
831
|
+
//create a list of tasks for your agent to complete once deployed
|
|
832
|
+
const testRequests: SendTaskRequest[] = [
|
|
833
|
+
{
|
|
834
|
+
id: "t1",
|
|
835
|
+
message: { role: "user", parts: [{ type: "text", text: "Hi!" }] },
|
|
836
|
+
},
|
|
837
|
+
];
|
|
838
|
+
|
|
839
|
+
for await (const result of testDeployment(deploymentParams, testRequests)) {
|
|
840
|
+
console.log(result); //process the task completion requests as they come in to confirm your agents logic
|
|
841
|
+
}
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
- **Full Deployment (Experimental):** Deploy your agent to the Artinet platform using the `fullDeployment` utility.
|
|
845
|
+
|
|
846
|
+
```typescript
|
|
847
|
+
import {
|
|
848
|
+
fullDeployment,
|
|
849
|
+
ServerDeploymentRequestParams,
|
|
850
|
+
} from "@artinet/sdk/deployment";
|
|
851
|
+
|
|
852
|
+
const deploymentParams: ServerDeploymentRequestParams = {
|
|
853
|
+
name: "My Awesome Agent",
|
|
854
|
+
agentCard: {
|
|
855
|
+
/* your agent card */
|
|
856
|
+
},
|
|
857
|
+
code: "/* bundled code string */",
|
|
858
|
+
};
|
|
859
|
+
|
|
860
|
+
const deploymentResult = await fullDeployment(deploymentParams); // Requires an ARTINET_API_KEY environment variable
|
|
861
|
+
console.log("Deployment Result:", deploymentResult);
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
- **Dedicated Endpoints:** Once deployed your agent will be available On-Demand at its dedicated enpoint. (e.g. "https://agents.artinet.io/agentId=0xabf698845743538727a81352bfcfdb724e5c2bbe3113a26362482248f9f3e5fa/.well-known/agent-card.json")
|
|
865
|
+
- **New Types:** To support these features, new types for server deployment requests and responses (such as `ServerDeploymentRequestParams`, `ServerDeploymentResponse`) have been added to `src/types/extended-schema.ts`. New types for sandboxed agent interactions (`TaskProxy`, `ConnectAPICallback`, `ClientProxy`, etc.) are in `src/types/proxy.ts`.
|
|
866
|
+
|
|
867
|
+
**QUICK-AGENT FAQs**
|
|
868
|
+
|
|
869
|
+
- Test-Agents expire after 60s (need more time? let us know @humans@artinet.io)
|
|
870
|
+
- Quick-Agents do not have access to a filesystem or networking (limited persistance & networking capabalities are on the project roadmap).
|
|
871
|
+
- Quick-Agents v0 does not support streaming, push notifications or state transition history (these capabilities are on the project roadmap).
|
|
872
|
+
- Larger deployments can take significant time to deploy which may cause `fullDeployment` to timeout. In such cases wait to see if the listing has been added to your account before trying to deploy again.
|
|
873
|
+
- Quick-Agent logic is public, therefore the artinet project is not liable for any sensitive material held within a deployment.
|
|
874
|
+
- Available with version 0.5.6+ of the SDK with enhanced deployment capabilities.
|
|
529
875
|
|
|
530
|
-
const deploymentResult = await fullDeployment(deploymentParams); // Requires an ARTINET_API_KEY environment variable
|
|
531
|
-
console.log("Deployment Result:", deploymentResult);
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
- **Dedicated Endpoints:** Once deployed your agent will be available On-Demand at its dedicated enpoint. (e.g. "https://agents.artinet.io/agentId=0xabf698845743538727a81352bfcfdb724e5c2bbe3113a26362482248f9f3e5fa/.well-known/agent.json")
|
|
535
|
-
- **New Types:** To support these features, new types for server deployment requests and responses (such as `ServerDeploymentRequestParams`, `ServerDeploymentResponse`) have been added to `src/types/extended-schema.ts`. New types for sandboxed agent interactions (`TaskProxy`, `ConnectAPICallback`, `ClientProxy`, etc.) are in `src/types/proxy.ts`.
|
|
536
|
-
|
|
537
|
-
**QUICK-AGENT FAQs**
|
|
538
|
-
- Test-Agents expire after 60s (need more time? let us know @humans@artinet.io)
|
|
539
|
-
- Quick-Agents do not have access to a filesystem or networking (limited persistance & networking capabalities are on the project roadmap).
|
|
540
|
-
- Quick-Agents v0 does not support streaming, push notifications or state transition history (these capabilities are on the project roadmap).
|
|
541
|
-
- Larger deployments can take significant time to deploy which may cause `fullDeployment` to timeout. In such cases wait to see if the listing has been added to your account before trying to deploy again.
|
|
542
|
-
- Quick-Agent logic is public, therefore the artinet project is not liable for any sensitive material held within a deployment.
|
|
543
|
-
- Only availble with version 0.5.3 of the SDK.
|
|
544
|
-
|
|
545
876
|
Sign-up at [artinet.io](https://artinet.io/) to deploy your Quick-Agent today!
|
|
546
877
|
|
|
547
878
|
## Contributing
|
|
@@ -561,6 +892,5 @@ This SDK builds upon the concepts and specifications of the [Agent2Agent (A2A) P
|
|
|
561
892
|
Libraries used include:
|
|
562
893
|
|
|
563
894
|
- [Express.js](https://expressjs.com/) for the server framework.
|
|
564
|
-
- [Jayson](https://github.com/tedeh/jayson) for JSON-RPC handling.
|
|
565
895
|
- [Pino](https://getpino.io/) for logging.
|
|
566
896
|
- [EventSource Parser](https://github.com/rexxars/eventsource-parser) for SSE streaming.
|