Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sagentic-ai/sagentic-af
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.12
Choose a base ref
...
head repository: sagentic-ai/sagentic-af
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 8,735 additions and 6,723 deletions.
  1. +21 −4 .github/workflows/release.yml
  2. +64 −4 .github/workflows/test.yml
  3. +10 −7 .vscode/settings.json
  4. +41 −4 LICENSE
  5. +13 −13 README.md
  6. +135 −0 bin/lock-deps/index.ts
  7. +192 −60 bin/{bazed.ts → sagentic.ts}
  8. +55 −0 bin/utils/index.ts
  9. +3 −2 index.ts
  10. +55 −46 package.json
  11. +5,106 −0 pnpm-lock.yaml
  12. +35 −17 src/agent.ts
  13. +26 −4 src/agents/one-shot.ts
  14. +69 −25 src/agents/reactive.ts
  15. +0 −520 src/client.ts
  16. +123 −0 src/client_mux.ts
  17. +340 −0 src/clients/anthropic.ts
  18. +303 −0 src/clients/base.ts
  19. +97 −0 src/clients/common.ts
  20. +243 −0 src/clients/google.ts
  21. +374 −0 src/clients/openai.ts
  22. +1 −11 src/common.ts
  23. +1 −1 src/errors.ts
  24. +23 −19 src/ledger.ts
  25. +1 −1 src/logging.ts
  26. +441 −31 src/models.ts
  27. +25 −1 src/registry.ts
  28. +100 −44 src/server/server.ts
  29. +32 −25 src/session.ts
  30. +40 −1 src/thread.ts
  31. +64 −2 src/tool.ts
  32. +146 −0 src/ts-gen/gen.ts
  33. +215 −0 src/ts-gen/zodGen.ts
  34. +1 −1 templates/agents/one-shot.ts
  35. +2 −7 templates/agents/reactive.ts
  36. +1 −1 templates/project/.env.example
  37. +1 −1 templates/project/agents/hello.ts
  38. +20 −0 templates/project/index.ts
  39. +10 −6 templates/project/package.json
  40. +1 −1 templates/project/tools/tool.ts
  41. +1 −1 templates/tools/tool.ts
  42. +27 −12 test/agent.test.ts
  43. +39 −0 test/anthropic-client.test.ts
  44. +49 −0 test/azure-openai-client.test.ts
  45. +3 −9 test/common.test.ts
  46. +39 −0 test/google-client.test.ts
  47. +24 −24 test/ledger.test.ts
  48. +3 −2 test/mock-openai/chat.ts
  49. +1 −1 test/mock-openai/server.ts
  50. +90 −39 test/{client.test.ts → openai-client.test.ts}
  51. +4 −3 test/session.test.ts
  52. +4 −3 test/thread.test.ts
  53. +1 −1 test/tool.test.ts
  54. +20 −110 tsconfig.json
  55. +0 −5,659 yarn.lock
25 changes: 21 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -19,24 +19,41 @@ jobs:
with:
submodules: true

- name: Enable corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Enable corepack pnpm
run: corepack enable pnpm

- name: Use latest pnpm
run: corepack use pnpm@latest

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: 20
registry-url: "https://registry.npmjs.org"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}

- name: Install dependencies
run: yarn install
run: pnpm install --frozen-lockfile

- name: Set env
run: |
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV
echo "GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }}" >> $GITHUB_ENV
echo "ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }}" >> $GITHUB_ENV
- name: Run tests
run: yarn test --silent
run: pnpm test --silent
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

- name: Build
run: yarn build
run: pnpm build

- name: Publish
env:
68 changes: 64 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -9,6 +9,58 @@ on:
- "*" # Ignore tags

jobs:
build-node-18:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Enable corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

build-node-20:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Enable corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

test:
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -22,13 +74,21 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
node-version: 20

- name: Enable corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Install dependencies
run: yarn install
run: pnpm install --frozen-lockfile

- name: Set env
run: echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV
run: |
echo "OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}" >> $GITHUB_ENV
echo "GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }}" >> $GITHUB_ENV
echo "ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }}" >> $GITHUB_ENV
- name: Run tests
run: yarn test --silent
run: pnpm test --silent
17 changes: 10 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"editor.formatOnSave": true,
"licenser.author": "Ahyve AI Inc",
"licenser.license": "MIT",
"licenser.useSPDXLicenseFormat": true,
"licenser.customTermsAndConditions": "Copyright (C) 2023-@YEAR@ Ahyve AI Inc.",
"licenser.disableAutoHeaderInsertion": false,
}
"editor.formatOnSave": true,
"javascript.inlayHints.parameterTypes.enabled": true,
"javascript.inlayHints.propertyDeclarationTypes.enabled": true,
"javascript.inlayHints.variableTypes.enabled": true,
"typescript.inlayHints.functionLikeReturnTypes.enabled": true,
"typescript.inlayHints.parameterTypes.enabled": true,
"files.associations": {
"**/templates/**/*.ts": "plaintext"
}
}
45 changes: 41 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
Copyright 2023-2024 Ahyve AI Inc.
License text copyright © 2024 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
Copyright © 2023-2025 Ahyve AI Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Parameters

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Licensor:         Ahyve AI Inc.
Licensed Work:      Sagentic Agent Framework. The Licensed Work is © 2023-2025 Ahyve AI Inc.
Additional Use Grant:

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You may make production use of the Licensed Work provided that:
Your use does not include offering the Licensed Work to third parties on a hosted or embedded basis in order to compete with Ahyve AI Inc.’s paid version(s) of the Licensed Work.
Additionally, you may not use the Licensed Work — or any derivative work thereof — to develop, host, or offer any web3, cryptocurrency, token-related, or blockchain-based platform or service without express, prior written permission from Ahyve AI Inc.

For purposes of this License:

A “competitive offering” is defined as any Product that is offered to third parties on a paid basis (including via paid support arrangements) that significantly overlaps with the capabilities of Ahyve AI Inc.’s paid version(s) of the Licensed Work. (If your Product is not a competitive offering when you first make it generally available, it will not become one later due to Ahyve AI Inc. releasing a new version of the Licensed Work with additional capabilities.)
“Product” means software that is offered to end users for self-management or provided as a hosted service.
“Embedded” means including the source code or executable code from the Licensed Work in a competitive offering, or packaging the competitive offering in such a way that the Licensed Work must be accessed or downloaded for that offering to operate.
Hosting or using the Licensed Work internally within an organization (including by any affiliates under common control) is not considered a competitive offering.

Change Date:     Four years from the date the Licensed Work is published.
Change License:   MPL 2.0

For information about alternative licensing arrangements for the Licensed Work, please contact hello@sagentic.ai.

Notice

Business Source License 1.1

Terms

The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.

Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.

If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.

All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.

You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.

Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.

This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License). TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# 😎 Bazed.ai Agent Framework
# 😎 Sagentic.ai Agent Framework

Visit [bazed.ai](https://bazed.ai) for more information.
Visit [sagentic.ai](https://sagentic.ai) for more information.

Join our [Discord server](https://discord.gg/VmEEUrc7dg) for support and discussions.

## 📦 Installation

To create a new Bazed.ai Agent Framework project, run the following command and follow the instructions:
To create a new Sagentic.ai Agent Framework project, run the following command and follow the instructions:

```bash
npx @bazed-ai/bazed-af init my-project
npx @sagentic-ai/sagentic-af init my-project
```

It will create `my-project` directory and set up a fresh Bazed.ai Agent Framework project there.
It will create `my-project` directory and set up a fresh Sagentic.ai Agent Framework project there.

Remember to install dependencies with `yarn` or `npm install`!

See the [documentation](https://bazed.ai/installation.html) for more information.
See the [documentation](https://sagentic.ai/installation.html) for more information.

## 📚 Documentation

The documentation for the Bazed.ai Agent Framework can be found [here](https://bazed.ai/introduction.html).
The documentation for the Sagentic.ai Agent Framework can be found [here](https://sagentic.ai/introduction.html).

## 🚀 Usage

Bazed.ai Agent Framework comes with a dev server with hot reloading. To start it, run the following command:
Sagentic.ai Agent Framework comes with a dev server with hot reloading. To start it, run the following command:

```bash
yarn dev
@@ -43,18 +43,18 @@ curl -X POST http://localhost:3000/spawn \
}'
```

See the [documentation](https://bazed.ai/first-agent.html) for more information.
See the [documentation](https://sagentic.ai/first-agent.html) for more information.

## 🤝 Contributing

Contributions, issues and feature requests are welcome!

Check our [issues page](https://github.com/bazed-ai/bazed-af/issues).
Check our [issues page](https://github.com/sagentic-ai/sagentic-af/issues).

## 📝 License

This project is [MIT](https://opensource.org/license/mit/) licensed.
This project is licensed under the [Business Source License 1.1](LICENSE).

See the [LICENSE](/LICENSE) file.
For information about alternative licensing arrangements for the Licensed Work, please contact hello@sagentic.ai.

Copyright (c) 2024 Ahyve Inc.
Copyright (c) 2023-2025 Ahyve AI Inc.
135 changes: 135 additions & 0 deletions bin/lock-deps/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import * as fs from "fs";
import * as child_process from "child_process";
import depcheck from "depcheck";

// lock deps with given command
async function lock(command: string, path: string): Promise<void> {
return new Promise((resolve, reject) => {
const child = child_process.exec(
command,
{ cwd: path },
(error, stdout, stderr) => {
if (error) {
reject(error);
} else {
resolve();
}
}
);
});
}

// try to lock dependencies with pnpm
async function lockPnpm(path: string, debug: boolean): Promise<string> {
try {
const cmd = `pnpm install --prod --loglevel=error --lockfile-only`;
await lock(cmd, path);
return "pnpm-lock.yaml";
} catch (e: any) {
if (debug) {
console.log("Failed to lock dependencies with pnpm", e);
}
return "";
}
}

// try to lock dependencies with npm
async function lockNpm(path: string, debug: boolean): Promise<string> {
try {
const cmd = `npm install --only=production --loglevel=error --no-audit --no-fund --package-lock-only --omit dev`;
await lock(cmd, path);
return "package-lock.json";
} catch (e: any) {
if (debug) {
console.log("Failed to lock dependencies with npm", e);
}
return "";
}
}

// try locking dependencies with pnpm or npm, returning the lockfile path
export async function lockDeps(
path: string,
packageManager: string,
debug: boolean
): Promise<string> {
let pm = "";
let lockfile = "";
let pms = ["pnpm", "npm", "none"];
if (packageManager) {
pms = [packageManager];
}

console.log("Locking dependencies...");
for (const p of pms) {
switch (p) {
case "pnpm":
lockfile = await lockPnpm(path, debug);
break;
case "npm":
lockfile = await lockNpm(path, debug);
break;
case "none":
lockfile = "";
break;
default:
throw new Error(`Unknown package manager: ${p}`);
}
if (lockfile) {
pm = p;
break;
}
}

if (lockfile) {
console.log(`Locked dependencies with ${pm} at ${path}/${lockfile}`);
}
if (pm !== "pnpm") {
console.log(`Consider using pnpm for faster agent spawn times`);
}

return lockfile;
}

// return local dependencies from package.json
export function getLocalDeps(packageJson: any, debug: boolean): string[] {
const localDeps = [];
for (const key in packageJson.dependencies) {
if (packageJson.dependencies[key].startsWith("file:")) {
localDeps.push(key);
}
}
return localDeps;
}

// check if all used dependencies are declared in package.json
export async function checkDeps(
path: string,
debug: boolean
): Promise<string[]> {
try {
const missingDeps = [];
const options = {
ignoreBinPackage: false,
ignoreMatches: [
"eslint",
"eslint-config-prettier",
"eslint-plugin-prettier",
"prettier",
"husky",
"lint-staged",
"typescript",
],
};
const result = await depcheck(path, options);
for (const key in result.missing) {
missingDeps.push(key);
}
return missingDeps;
} catch (e) {
if (debug) {
console.log("Failed to check dependencies", e);
}
return [];
}
}
Loading