{"id":13990776,"url":"https://github.com/wladpaiva/aibitat","last_synced_at":"2025-03-16T20:30:52.314Z","repository":{"id":200377758,"uuid":"703276306","full_name":"wladpaiva/aibitat","owner":"wladpaiva","description":"Multi-Agent Conversation Framework in TypeScript","archived":false,"fork":false,"pushed_at":"2023-11-25T20:50:13.000Z","size":1563,"stargazers_count":100,"open_issues_count":3,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-12T20:37:56.922Z","etag":null,"topics":["agent-based-framework","agents","chat","chat-application","chatbot","gpt","gpt-35-turbo","gpt-4","llm-agent","llm-framework","llm-inference","llmops","stateless","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wladpaiva.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-10-11T00:11:20.000Z","updated_at":"2024-10-03T14:48:29.000Z","dependencies_parsed_at":"2023-11-10T15:28:02.816Z","dependency_job_id":"99d71055-c32c-435f-a5fb-404dd5beea9f","html_url":"https://github.com/wladpaiva/aibitat","commit_stats":null,"previous_names":["wladiston/chatflow","wladpaiva/aibitat","wladiston/aibitat"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wladpaiva%2Faibitat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wladpaiva%2Faibitat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wladpaiva%2Faibitat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wladpaiva%2Faibitat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wladpaiva","download_url":"https://codeload.github.com/wladpaiva/aibitat/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221667649,"owners_count":16860623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent-based-framework","agents","chat","chat-application","chatbot","gpt","gpt-35-turbo","gpt-4","llm-agent","llm-framework","llm-inference","llmops","stateless","typescript"],"created_at":"2024-08-09T13:03:13.351Z","updated_at":"2024-10-27T11:13:13.025Z","avatar_url":"https://github.com/wladpaiva.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"This project is a fork from the original\n[autogen](https://github.com/microsoft/autogen) but done in TypeScript.\n\n# AIbitat - Multi-Agent Conversation Framework\n\nAIbitat is a stateless \u0026 extensible framework designed to enable interaction\nbetween multiple agents while allowing human participation.\n\nThink of it as Slack but for AI agents. Create agents, add them to channels and\nlet them chat with each other. You can also add intractable agents to channels\nand let them participate in the conversation.\n\n## Usage\n\n\u003e For a more complete example, check out the [examples](./examples) folder.\n\nYou can install the package:\n\n```bash\n# to install bun go to https://bun.sh and follow the instructions\n# then run to start a new project:\nmkdir my-project\ncd my-project\nbun init\n\n# then install aibitat\nbun install aibitat\n```\n\nCreate an `.env` file and add your `OPENAI_API_KEY`:\n\n```bash\nOPENAI_API_KEY=...\n```\n\nThen create a file called `index.ts` and add the following:\n\n```ts\nimport {AIbitat} from 'aibitat'\nimport {cli} from 'aibitat/plugins'\n\nconst aibitat = new AIbitat()\n  .use(cli())\n  .agent('client', {\n    interrupt: 'ALWAYS',\n    role: 'You are a human assistant. Reply \"TERMINATE\" when there is a correct answer or there`s no answer to the question.',\n  })\n  .agent('mathematician', {\n    role: `You are a Mathematician and only solve math problems from @client`,\n  })\n  .agent('reviewer', {\n    role: `You are a Peer-Reviewer and you do not solve math problems. \n    Check the result from @mathematician and then confirm. Just confirm, no talk.`,\n  })\n  .channel('management', ['mathematician', 'reviewer', 'client'])\n\n// aibitat.onMessage(console.log)\n\nawait aibitat.start({\n  from: 'client',\n  to: 'management',\n  content: 'How much is 2 + 2?',\n})\n\nconsole.log(aibitat.chats)\n```\n\nThen run:\n\n```bash\nbun run index.ts\n```\n\n## Roadmap\n\n| Feature            | What it does                                           | Status |\n| ------------------ | ------------------------------------------------------ | ------ |\n| Direct messages    | Agents talk directly with each other.                  | ✅     |\n| Feedback           | Keep chat alive until some agent interrupts the chat.  | ✅     |\n| Channels           | Agents talk with many others, like in a Slack channel. | ✅     |\n| Error handling     | Manage rate limits smoothly without crashing.          | ✅     |\n| Function execution | Agents can execute tasks and understand the results.   | ✅     |\n| Web browsing       | Navigate on the internet.                              | 🚧     |\n| Cache              | Save chat history for faster and fewer API calls.      | 🕝     |\n| File interaction   | Interact with local files by read/write/execute        | 🕝     |\n| Code execution     | Agents can run code and share the results.             | 🕝     |\n| Cost limit         | Limit the number of interactions by cost.              | 🕝     |\n\n### Providers\n\n| Provider     | Status |\n| ------------ | ------ |\n| OpenAI       | ✅     |\n| Anthropic    | ✅     |\n| Cohere       | 🕝     |\n| Fireworks.ai | 🕝     |\n| Hugging Face | 🕝     |\n| Replicate    | 🕝     |\n\n## Documentation\n\nSome terms used in this documentation:\n\n- `interrupt`: `NEVER`, `ALWAYS`. When `NEVER`, the agent will never interrupt\n  the conversation. When `ALWAYS`, the agent will always interrupt the\n  conversation. (Note: any of them can interrupt the conversation if they reply\n  \"INTERRUPT\" or terminate the chat when replying \"TERMINATE\".)\n- `role`: The role of the agent. It is used to describe the role the agent will\n  perform in the chat.\n- `maxRounds`: The maximum number of chats an agent or a group will reply to the\n  conversation. It is used to prevent loops.\n\n### `new AIbitat(config)`\n\nCreates a new AIbitat instance. The `config` object can be used to configure the\ninstance. By default, aibitat uses **OpenAI** and **GPT-3.5-TURBO** as the\nprovider for the conversation and **GPT-4** for predicting the next agent to\nspeak. You can change it by passing `provider` and `model` to the `AIbitat`\nconstructor or by setting them on the specific agent/channel config. Default\nconfig:\n\n```js\n{\n  providers: 'openai',\n  model: 'gpt-3.5-turbo',\n  interrupt: 'NEVER',\n  maxRounds: 100,\n  chats: [\n    // {\n    //   from: '🧑',\n    //   to: '🤖',\n    //   content: `Talk about something`,\n    //   state: 'success',\n    // },\n  ],\n}\n```\n\n### `.agent(name, config)`\n\nCreates a new agent. The `config` object can be used to configure the agent. By\ndefault, agents use the `interrupt` from the `AIbitat` config.\n\n### `.channel(name, agents, config)`\n\nCreates a new channel. The `config` object can be used to configure the channel.\nBy default, `maxRounds` is set to `100`.\n\n### `.function(config)`\n\nFunctions are used to execute code and return the result to the conversation. To\nuse it, call the `function` method passing the definitions for the function and\nadd its name to the `functions` property to the node config:\n\n```ts\nconst aibitat = new AIbitat()\n  .agent('...', {functions: ['doSomething']})\n  .function({\n    name: 'doSomething',\n    description: 'Let me do something for you.',\n    parameters: {\n      type: 'object',\n      properties: {},\n    },\n    async handler() {\n      return '...'\n    },\n  })\n```\n\nThe results will then be sent to the provider and returned to the conversation.\n\n### `.use(plugin)`\n\nPlugins are used to extend the functionality of AIbitat. They can be used to add\nnew features or to integrate with other services. You can create your own plugin\nby implementing the `AIbitatPlugin` interface.\n\nTo use a plugin, call the `use` method:\n\n```ts\n...\nimport {cli} from 'aibitat/plugins'\n\nconst aibitat = new AIbitat().use(cli())\n```\n\nYou can also create your own plugin by implementing the `AIbitatPlugin`\ninterface:\n\n```ts\nimport {AIbitatPlugin} from 'aibitat'\n\nexport function myPlugin(): AIbitatPlugin {\n  return {\n    name: 'my-plugin',\n    setup(aibitat) {\n      console.log(`setting up my plugin`)\n\n      aibitat.onMessage(({from, to, content}) =\u003e {\n        console.log(`${from}: ${content}`)\n      })\n    },\n  }\n}\n```\n\n**List of available plugins:**\n\n- `cli`: Adds a CLI interaction to the chat.\n- `fileHistory`: Saves the chat history to a JSON file. Defaults to `history`\n  folder\n- `experimental_webBrowsing`: Adds a `web-browsing` function to the chat that\n  enable agents to search and navigate on the internet. NOTE: this plugin is\n  experimental and may not work as expected.\n\n### Life cycle\n\nAIbitat supports Life Cycle events, which trigger at specific moments. The\nfollowing diagram shows the life cycle of a conversation:\n\n![Life cycle](./docs/life-cycle.png)\n\nThe life cycle events in AIbitat consists of:\n\n- `start`: Called when the chat starts.\n- `error`: Called when there's a known error (see `src/error.ts`). To retry,\n  call `.retry()`.\n- `message`: Called when a message is added to the chat history.\n- `terminate`: Called when the conversation is terminated. Generally means there\n  is nothing else to do and a new conversation should be started.\n- `interrupt`: Called when the conversation is interrupted by an agent.\n  Generally means the agent has a question or needs help. The conversation can\n  be resumed by calling `.continue(feedback)`.\n\n## Contributing\n\nCopy the `.env.example` file to `.env` and add your keys/tokens in there.\n\nTo install dependencies:\n\n```bash\nbun install\n```\n\nTo run:\n\n```bash\nbun run examples/beginner-chat.ts\n```\n\n\u003e Check out the [examples](./examples) folder for more examples.\n\nThis project was created using `bun init` in bun v1.0.3. [Bun](https://bun.sh)\nis a fast all-in-one JavaScript runtime.\n\n### Sponsors\n\n- [Every-AI: the largest ai tools directory \u0026 marketplace](http://www.every-ai.com)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwladpaiva%2Faibitat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwladpaiva%2Faibitat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwladpaiva%2Faibitat/lists"}