Skip to content

feat(core): semaphore option for limit request #461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 10, 2025
Merged

Conversation

samchon
Copy link
Member

@samchon samchon commented Jun 10, 2025

Special option for @autobe supporting.


This pull request introduces enhancements to the Agentica and MicroAgentica classes by adding support for concurrency control using semaphores, updates dependencies across multiple packages, and improves the configuration options for limiting concurrent requests. Additionally, it updates the pnpm-lock.yaml file to reflect the latest versions of dependencies. Below is a summary of the most important changes grouped by theme.

Concurrency Control Enhancements:

  • Added a Semaphore instance to the Agentica and MicroAgentica classes to manage the number of concurrent requests to the LLM vendor. The semaphore can be shared across agents or configured with a numerical limit. (packages/core/src/Agentica.ts [1] [2]; packages/core/src/MicroAgentica.ts [3] [4]
  • Updated the request handler in both classes to use the semaphore for controlling concurrent requests, ensuring proper acquisition and release of the semaphore. (packages/core/src/Agentica.ts [1] [2]; packages/core/src/MicroAgentica.ts [3] [4]

Dependency Updates:

  • Updated tstl and openai dependencies in package.json files to use the catalog:libs specifier instead of fixed versions. (packages/benchmark/package.json [1]; packages/core/package.json [2]
  • Reflected updated versions of dependencies such as openai, tstl, and @samchon/openapi in pnpm-lock.yaml. (pnpm-lock.yaml [1] [2] [3]

Configuration Improvements:

  • Enhanced the IAgenticaVendor interface to include a new semaphore property for configuring concurrency limits. This property can accept a Semaphore instance or a numerical value. (packages/core/src/structures/IAgenticaVendor.ts packages/core/src/structures/IAgenticaVendor.tsR40-R53)

These changes improve the scalability and configurability of the Agentica framework while ensuring compatibility with updated dependencies.

@samchon samchon requested review from sunrabbit123 and Copilot June 10, 2025 07:14
@samchon samchon self-assigned this Jun 10, 2025
@samchon samchon added the enhancement New feature or request label Jun 10, 2025
@samchon samchon added this to WrtnLabs Jun 10, 2025
@samchon samchon marked this pull request as ready for review June 10, 2025 07:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces configurable concurrency control via semaphores in the Agentica and MicroAgentica classes, updates multiple package dependencies to use pnpm catalogs, and extends the IAgenticaVendor interface with a new semaphore option.

  • Added semaphore-based request limits to Agentica and MicroAgentica
  • Switched several packages’ tstl and openai deps to catalog:libs in package.json and pnpm-workspace
  • Extended IAgenticaVendor with an optional semaphore property and updated docs

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
website/package.json Switched tstl to catalog:libs
test/package.json Switched tstl to catalog:libs
pnpm-workspace.yaml Bumped openai, added tstl, updated MCP & Typia plugins
packages/core/src/structures/IAgenticaVendor.ts Imported Semaphore, added `semaphore?: Semaphore
packages/core/src/MicroAgentica.ts Initialized .semaphore_, wrapped request calls with acquire/release
packages/core/src/Agentica.ts Initialized .semaphore_, wrapped request calls with acquire/release
packages/core/package.json Added tstl: "catalog:libs" dependency
packages/benchmark/package.json Switched tstl to catalog:libs
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/core/src/MicroAgentica.ts:97

  • Add or update unit tests to cover the new semaphore-based concurrency control logic in MicroAgentica.
    this.semaphore_ = props.vendor.semaphore != null

Copy link

pkg-pr-new bot commented Jun 10, 2025

Open in StackBlitz

@agentica/benchmark

npm i https://pkg.pr.new/wrtnlabs/agentica/@agentica/benchmark@461

@agentica/chat

npm i https://pkg.pr.new/wrtnlabs/agentica/@agentica/chat@461

agentica

npm i https://pkg.pr.new/wrtnlabs/agentica@461

@agentica/core

npm i https://pkg.pr.new/wrtnlabs/agentica/@agentica/core@461

create-agentica

npm i https://pkg.pr.new/wrtnlabs/agentica/create-agentica@461

@agentica/rpc

npm i https://pkg.pr.new/wrtnlabs/agentica/@agentica/rpc@461

@agentica/vector-selector

npm i https://pkg.pr.new/wrtnlabs/agentica/@agentica/vector-selector@461

commit: c0f5c7a

Copy link
Member

@sunrabbit123 sunrabbit123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add peerDependency

@sunrabbit123 sunrabbit123 changed the title feat(agent): semaphore option for limit request feat(core): semaphore option for limit request Jun 10, 2025
@samchon samchon merged commit 32d1009 into main Jun 10, 2025
12 of 18 checks passed
@samchon samchon deleted the feat/semaphore branch June 10, 2025 07:34
@github-project-automation github-project-automation bot moved this to Done in WrtnLabs Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants