Agent task routing and hosting method and system based on conditional atomic updates

CN122946089APending Publication Date: 2026-10-20ZHAOXUN (SHENZHEN) INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611148924.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

仅以即时负载或静态权重进行调度,难以兼顾历史完成量、验收成功率、近期活跃度、争议情况、交付时延等多维度表现;同时,缺少超时驱动的逐级溢出机制会导致:定向指派的智能体无响应时任务长期搁置无法继续分发,或长尾类型任务始终无合适承接者响应而沉淀

Benefits of technology

1、本发明通过条件原子UPDATE将托管资格抢占、余额校验与冻结操作在单条SQL内完成,彻底消除了事务间隙带来的竞态窗口;同时,以“零价格创建-携价竞标-期望金额与竞标价格一致性校验”的时序设计,从根本上杜绝了发单方在并发请求中按已被修改的报价错误扣款的风险。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
Patent Text Reader

Abstract

This invention discloses a method and system for intelligent agent task routing and management based on conditional atomic updates, including the following steps: S1, maintaining a routing mode field, a routing status field, and a current routing round field on the problem data row, and resolving the candidate intelligent agent pool into one of the following: a directional pool, a top-level pool, a standard pool, a genesis pool, and a public pool based on the routing mode field, the routing status field, and the current routing round field; S2, under the current routing round, writing the sorted candidate intelligent agent identifier list into a snapshot field and recording the snapshot round, and returning the snapshot only when the snapshot round matches the current routing round during reading, thus determining the visible candidate set within the same round; The beneficial effects of this invention are: this invention completely eliminates the race window caused by transaction gaps; at the same time, it fundamentally eliminates the risk of the order issuer incorrectly deducting payment based on the modified quote in concurrent requests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of automatic task allocation and resource scheduling technology for autonomous software agents, specifically to an agent task routing and management method and system based on conditional atomic updates. Background Technology

[0002] The background technologies closest to this invention can be summarized into three categories: crowdsourcing and bounty trading platforms for human developers, online transaction fund escrow mechanisms, and general task scheduling and load balancing technologies.

[0003] The first category is crowdsourcing and bounty trading platforms geared towards humans. These platforms typically follow a workflow of "posting a request—human browsing or searching—human bidding or claiming—completion—human review—settlement." Matching and quality assurance heavily rely on human intervention and subjective credit evaluations (such as star ratings, historical reviews, and text comments). Their matching targets are natural person developers, not programmable autonomous software entities. The task allocation on these platforms is essentially an information display and retrieval process of "people finding tasks" or "tasks finding people," lacking programmatic routing and distribution capabilities for autonomous intelligent agent endpoints.

[0004] The second type is the online transaction fund escrow mechanism. A common practice is for the payer to deposit funds upon transaction completion, which are then released to the payee after delivery and confirmation. This type of mechanism is generally designed around a single time sequence of "quote or price first, then escrow." Fund operations typically employ a "read-modify-write" model: reading the balance, checking adequacy, and then writing the balance back. In concurrent scenarios, it requires additional database row locks or transaction isolation levels to ensure consistency, resulting in high implementation complexity and limited concurrency performance.

[0005] The third category is general task scheduling and load balancing technologies, such as round-robin, weighted round-robin, least connections, and consistent hashing. These technologies are designed for homogeneous computing nodes or service instances that can receive tasks at any time. Their scheduling is based on real-time load metrics or statically configured weights. They typically do not include multi-dimensional quantitative modeling of the long-term performance of heterogeneous loaders, nor do they have built-in timeout-driven upgrade semantics that "gradually expand the candidate range if a loader does not respond within a limited time".

[0006] As autonomous software agents accept tasks externally via network callback endpoints, a new application scenario has emerged: "automatically matching and delivering a technical problem to the autonomous agent for independent solution." In this scenario, the three background technologies mentioned above have the following shortcomings: Firstly, the timing and concurrent competition issues in the self-bidding scenario present potential risks related to order placement and fund custody. When order placement is free, bidders bid with their own prices, and the order issuer accepts a certain price and triggers fund custody amidst multiple concurrent requests (such as simultaneous triggering of web page operations and smart agent interface callbacks), the traditional fixed timing of "pricing first, then custody" and the "read-modify-write" balance operation method are prone to problems such as duplicate custody, incorrect deductions based on the modified price, and simultaneous release and refund of the same custodial funds.

[0007] Secondly, there is a lack of objective, multi-factor automatic scoring and hierarchical routing mechanisms for agent groups. Scheduling based solely on immediate load or static weights makes it difficult to consider multiple dimensions of performance, such as historical completion volume, acceptance success rate, recent activity, disputes, and delivery latency. Furthermore, the lack of a timeout-driven, tiered overflow mechanism leads to situations where tasks remain unresponsive when assigned agents fail to respond, or long-tail tasks remain unattended and stagnate. In addition, the lack of mutual exclusion coordination for the background scheduling process and stability guarantees for the visible candidate set within a single round of distribution in multi-instance deployment environments can easily result in the same task being processed repeatedly or the candidate set fluctuating frequently between scans.

[0008] Third, existing settlement mechanisms mostly use cash to pay bounties, lacking a means to offset non-cash knowledge deliverables against bounties at an agreed ratio and atomically deduct and return them from the cash portion during settlement; existing state change notification mechanisms also lack a reliable delivery mechanism that persists business state changes along with transactions and then asynchronously delivers them to the autonomous agent's callback endpoint with signature and backoff retries.

[0009] To address the aforementioned issues, we propose an agent-based task routing and management method and system based on conditional atomic updates. Summary of the Invention

[0010] The purpose of this invention is to provide a method and system for intelligent agent task routing and management based on conditional atomic updates, so as to solve the problems mentioned in the background art.

[0011] To achieve the above objectives, the present invention provides the following technical solution: an agent task routing and management method based on conditional atomic update, comprising the following steps: S1. Maintain the routing mode field, routing status field, and current routing round field on the problem data row. Based on the routing mode field, routing status field, and current routing round field, parse the candidate agent pool into one of the following: directional pool, top-level pool, standard pool, genesis pool, and public pool. S2. In the current routing round, write the sorted list of candidate agent identifiers into the snapshot field and record the snapshot round. When reading, return the snapshot only if the snapshot round matches the current routing round, so that the visible candidate set in the same round is determined. S3. The background scanning process runs as a single instance with database-level distributed lease protection, and the problem status is advanced step by step according to the timeout threshold. The timer is reset after each status advancement. S4. When accepting a bid, the order issuer inputs the expected amount, and the first condition atomic update is used to seize the escrow qualification. Then, the second condition atomic update is used to complete the fund freeze. The first condition atomic update requires that the escrow status of the problem line is empty or has been refunded. The second condition atomic update requires that the user's available balance is not less than the bid amount. S5. When the solution is accepted, release the escrow funds to the winning agent's owner account via a conditional atomic update and set the issue status to completed.

[0012] Preferably, in step S1, the candidate agent pool is resolved into one of the following based on the routing mode field, the routing status field, and the current routing round field: (Specifically:) When the routing mode is directed and the routing status is in the directed phase, it is resolved to the directed pool; when the routing mode is hierarchical overflow and the current route round number is ≤2, it is resolved to the top-level pool. When the routing mode is hierarchical overflow and the current routing round is equal to 3, it is resolved to the standard pool; When the routing mode is hierarchical overflow and the current routing round is ≥4 or the routing state is fallback, it is resolved to the genesis pool; When the routing mode is public, it resolves to a public pool; The background scanning step only handles issues that are in an open state, have not been assigned an agent, and whose routing mode is directional, hierarchical overflow, or fallback.

[0013] Preferably, in step S3, the process of progressively advancing the problem status according to the timeout threshold includes: When an issue is in the directional pool and remains there for more than the first timeout threshold, it is escalated to a hierarchical overflow state and the routing rounds are set to at least 2. When a problem is in the top-level pool and stays there for more than the second timeout threshold or the top-level pool is empty, the routing round will be increased to 3 and the problem will enter the standard pool. When the problem is in the standard pool and meets the timeout condition or the standard pool is empty, it enters the Genesis fallback assignment; When the problem is in the Genesis Pool and there are no available Genesis agents, set the routing state to fallback waiting; Each state advance resets the timing field, and the empty pool shortcut flag allows skipping empty layers within the same scan.

[0014] Preferably, in step S3, the database-level distributed lease is implemented as an atomic state machine through a lease table; The lease key serves as the unique identifier, and the holder's identifier consists of the hostname, process ID, role, and random token. If there is no lease row, insert and acquire the lease, and set the lease epoch to the initial value; This process renews leases and updates lease expiration dates when it holds them; it takes over leases when they expire and increments the lease epoch. The process rolls back and skips the current scan when it holds a valid lease; When handling long batches, periodic renewals are implemented, and the leases of crash holders are taken over by other instances after their lifespan expires.

[0015] Preferably, it also includes a dual-track automatic scoring step, specifically: The first track is a system-derived route score, calculated from historical task data aggregated from the database. It includes the sum of experience component, acceptance rate component, recent component, activity component, skill bonus, cost efficiency bonus, memory bonus, and arena bonus, minus the dispute penalty, and is constrained within a predetermined range. No administrator can manually set the path. The second track is a structured benchmark score, which is obtained by weighted averaging of six categories of deterministic rule scores using a zero-big-language model approach. The valid values ​​of the routing score and the baseline score are combined according to a predetermined weight and used as the sorting input for the candidate snapshot freezing step.

[0016] Preferably, the six categories and weights of the structured benchmark score are as follows: The scores are as follows: Response quality 0.25, instruction compliance 0.20, reasoning ability 0.20, response speed 0.10, reliability 0.15, and interface compliance 0.10. Each category is scored using deterministic rules, and the total score is a weighted average of the scores in the six categories. The benchmark score is set with a guidance decay window: when there is no completed benchmark, the guidance score is only counted in full value in the ranking before the guidance deadline, and the effective score is reduced to zero once the deadline is reached; after the first completion of the actual benchmark, the guidance window is permanently closed.

[0017] Preferably, step S4 specifically includes: The issue is created with zero price, zero escrow amount, and no escrow status; no balance verification or fund freezing is performed during the order placement process. Bids must include a binding price, which cannot be changed during the bid period; When accepting a bid, if the expected amount is inconsistent with the bid price, the operation is rejected and a conflict status code is returned; The first conditional atomic update is: when the escrow status of the problematic row is empty or has been refunded, set the escrow status to funded, requiring the number of affected rows to be 1; The second conditional atomic update is: based on the condition that the user's balance minus the frozen balance minus the withdrawal frozen balance is not less than the bidding amount, the frozen balance is atomically increased in the SQL statement; When funds are insufficient, the managed status is rolled back to zero using a conditional atomic update and an exception is thrown. When a proposal is rejected or cancelled, the escrow status is changed from "funded" to "refunded" via a conditional atomic update, automatically refunding the funds and resetting the issue price, and reopening the bidding process.

[0018] Preferably, step S5 further includes a knowledge compensation settlement sub-step, specifically: After the proposal is submitted, the designated agent owner can submit a knowledge package, with a maximum of one package per question. The knowledge deduction ratio is subject to the global or single question upper limit. The value of knowledge is calculated by dividing the product of the question price and the requested deduction ratio by an integer. After the issuer reviews and accepts the knowledge package, the cash portion of the settlement is the total amount of the problem minus the knowledge value. The platform fee is only charged on the cash portion. The agent's income is the cash portion minus the platform fee plus the knowledge value, and the settlement is completed through atomic lending. If the knowledge package is rejected, the settlement will be processed in full cash.

[0019] Preferably, it also includes an outbound event delivery step consistent with the business transaction, specifically: When the status changes, the event record is written to the same database transaction as the business change; After the transaction is committed, the single-threaded executor asynchronously and serially delivers the event to the callback endpoint of the external agent. If delivery fails, it will be retried at backoff intervals. Once the maximum number of retries is reached, it will be marked as a final failure. Each delivery is signed with an HMAC signature and timestamp for the receiver to perform idempotency and replay protection.

[0020] The intelligent agent task routing and hosting system based on conditional atomic update includes a problem state management module, a route scanning engine module, a fund hosting module, an intelligent agent scoring module, an event delivery module, and a database layer. The issue status management module is used to create and maintain issue records. The issue records include a routing mode field, a routing status field, a current routing round field, a candidate snapshot field, a managed status field, a managed amount field, and a price field. The routing scanning engine module is used to perform background periodic scanning, ensuring that only a single instance runs at the same time under a multi-instance deployment with database-level distributed leases; it advances the status of problematic routes step by step according to thresholds, and refreshes and freezes candidate snapshots each time they enter the top-level pool or standard pool; The escrow module is used to create issues at zero price during the issue issuance phase; when the issuer accepts a bid, it verifies the consistency between the expected amount and the bid price, completes the escrow qualification acquisition with a conditional atomic UPDATE, and then completes the fund freeze within SQL with a conditional atomic update of the balance guard; when the solution is rejected, canceled, or abandoned, it automatically refunds the escrow funds and resets the issue price with a conditional atomic update, reopening the bidding; during solution acceptance, it releases the escrow funds to the winning agent's owner's account with a conditional atomic update and deducts the handling fee according to the platform rate; The intelligent agent scoring module is used to perform dual-track automatic scoring; The event delivery module is used to deliver route assignment, bid acceptance, and scheme status change outwards in outbound mode. The database layer is used to map to a relational database based on an object-relational mapping framework to persistently store data entities.

[0021] The beneficial effects achieved by this invention are: 1. This invention completes the preemption of hosting rights, balance verification and freezing operations in a single SQL statement through conditional atomic UPDATE, completely eliminating the race window caused by transaction gaps; at the same time, with the timing design of "zero price creation - bidding with price - consistency verification of expected amount and bid price", it fundamentally eliminates the risk that the order issuer will incorrectly deduct payment based on the modified price in concurrent requests.

[0022] 2. This invention enables tasks to automatically expand the candidate pool according to time thresholds through a timeout-driven hierarchical overflow mechanism, which not only ensures the priority of targeted assignment but also avoids long-term task shelving. At the same time, the dual-track scoring integrates multi-dimensional performance, providing objective quantitative basis for routing decisions. Snapshot freezing ensures that the candidate set is determined within a round of distribution, and together with distributed leases, avoids multiple instances of duplicate processing. In addition, the transaction event delivery and HMAC signature mechanism atomically bind state changes and outbound notifications, and with backoff retries, ensure that the autonomous intelligent agent endpoints reliably receive tasks, realizing end-to-end business integrity from routing to settlement. Attached Figure Description

[0023] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] Please see Figure 1 This invention provides a technical solution: an agent task routing and management method based on conditional atomic update, comprising the following steps: S1. Maintain the routing mode field, routing status field, and current routing round field on the problem data row. Based on the routing mode field, routing status field, and current routing round field, parse the candidate agent pool into one of the following: directed pool, top-level pool, standard pool, genesis pool, and public pool. Specifically: When the routing mode is directed and the routing status is directed, it is resolved to the directed pool; when the routing mode is hierarchical overflow and the current routing round is ≤2, it is resolved to the top-level pool; when the routing mode is hierarchical overflow and the current routing round is equal to 3, it is resolved to the standard pool; when the routing mode is hierarchical overflow and the current routing round is ≥4 or the routing status is fallback, it is resolved to the genesis pool; when the routing mode is public, it is resolved to the public pool; the background scanning step only processes issues with the status open, no assigned agent, and the routing mode being directed, hierarchical overflow, or fallback.

[0026] S2. In the current routing round, write the sorted list of candidate agent identifiers into the snapshot field and record the snapshot round. When reading, return the snapshot only if the snapshot round matches the current routing round, so that the visible candidate set in the same round is determined.

[0027] S3. The background scanning process runs as a single instance with database-level distributed lease protection, progressively advancing the issue status according to timeout thresholds, resetting the timer after each status advancement; the progressive advancement of issue status according to timeout thresholds includes: When a problem is in the directional pool and stays there for more than the first timeout threshold, it is upgraded to the hierarchical overflow state and the routing round is set to at least 2. When a problem is in the top-level pool and stays there for more than the second timeout threshold or the top-level pool is empty, the routing round is upgraded to 3 and the problem enters the standard pool. When a problem is in the standard pool and meets the timeout condition or the standard pool is empty, it enters the genesis fallback assignment state. When a problem is in the genesis pool and there is no available genesis agent, the routing state is set to fallback waiting. The timing field is reset with each state advancement, and the empty pool shortcut flag allows skipping empty layers within the same scan. Database-level distributed leases implement atomic state machines through lease tables; The lease key serves as the unique identifier, and the holder's identifier consists of the hostname, process ID, role, and random token. When there is no lease row, a lease is inserted and acquired, and the lease epoch is set to the initial value. When the current process holds a lease, it renews the lease and updates the lease expiration time. When a lease expires, the process takes over the lease and increments the lease epoch. When another process holds a valid lease, the process rolls back and skips the current scan. When processing long batches, leases are renewed periodically, and leases held by crash holders are taken over by other instances after their lifetime expires.

[0028] S4. When accepting bids, the order issuer inputs the desired amount, using a first-condition atomic update to secure escrow eligibility, followed by a second-condition atomic update to freeze funds. The first-condition atomic update requires the escrow status of the problematic line to be empty or refunded, while the second-condition atomic update requires the user's available balance to be no less than the bid amount; specifically: The issue is created with a zero price, zero escrow amount, and no escrow status. No balance verification or fund freezing is performed during the order placement process. Bids must include a binding price, which cannot be changed during the bid validity period. When accepting a bid, if the expected amount differs from the bid price, the operation is rejected and a conflict status code is returned. The first conditional atomic update is: if the escrow status of the issue row is empty or has been refunded, the escrow status is set to "funded," requiring 1 row to be affected. The second conditional atomic update is: if the user's balance minus the frozen balance minus the withdrawal frozen balance is not less than the bid amount, the frozen balance is atomically increased within the SQL statement. If funds are insufficient, the escrow status is reverted to zero using a conditional atomic update, and an exception is thrown. When a proposal is rejected or canceled, the escrow status is changed from "funded" to "refunded" using a conditional atomic update, funds are automatically refunded, the issue price is reset, and bidding is reopened.

[0029] S5. Upon acceptance of the proposal, the escrow funds are released to the winning agent's account via a conditional atomic update, and the issue status is set to completed; this also includes a knowledge compensation settlement sub-step, specifically: After the proposal is submitted, the designated agent owner can submit a knowledge package, with a maximum of one package per question. The knowledge deduction ratio is subject to a global or single-question upper limit. The knowledge value is calculated by dividing the product of the question price and the requested deduction ratio. After the issuer reviews and accepts the knowledge package, the settlement is the total question amount minus the knowledge value as the cash portion. The platform fee is only charged on the cash portion. The agent's income is the cash portion minus the platform fee plus the knowledge value, and the settlement is completed through atomic loan disbursement. If the knowledge package is rejected, the settlement is processed in full cash.

[0030] The dual-track automatic scoring system is as follows: The first track is the system-derived route score, calculated from historical task data aggregated from the database. It includes the sum of experience, acceptance rate, recent data, activity level, skill bonus, cost efficiency bonus, memory bonus, and arena bonus, minus the dispute penalty, and is constrained within a predetermined range, without manual path setting by the administrator. The second track is the structured benchmark score, obtained by weighted averaging of six types of deterministic rule scores using a zero-scale language model. The valid values ​​of the route score and the benchmark score are combined according to predetermined weights and used as the sorting input for the candidate snapshot freezing step. The six categories and weights of the structured benchmark score are as follows: Answer quality is scored as 0.25, instruction compliance as 0.20, reasoning ability as 0.20, response speed as 0.10, reliability as 0.15, and interface compliance as 0.10. Each category is scored using deterministic rules, and the total score is a weighted average of the scores from the six categories. The benchmark score has a guidance decay window: when there is no completed benchmark, the guidance score is only counted in full for ranking before the guidance deadline, and the effective score is reset to zero once the deadline is reached. After the first real benchmark is completed, the guidance window is permanently closed.

[0031] The intelligent agent task routing and hosting system based on conditional atomic update includes a problem state management module, a route scanning engine module, a fund hosting module, an intelligent agent scoring module, an event delivery module, and a database layer. The issue status management module creates and maintains issue records, which include fields for routing mode, routing status, current routing round, candidate snapshot, escrow status, escrow amount, and price. The routing scanning engine module performs background periodic scans, ensuring only a single instance runs at any given time in a multi-instance deployment using database-level distributed leases. It progressively advances issue routing status according to thresholds, refreshing and freezing candidate snapshots each time an issue enters the top-level pool or standard pool. The escrow module creates issues at zero price during the issue issuance phase. When the issuer accepts a bid, it verifies the consistency between the expected amount and the bid price using conditional atomic UPDs. ATE completes the pre-emption of escrow qualification, and then freezes funds in SQL using conditional atomic updates for balance protection; when a proposal is rejected, canceled, or abandoned, escrow funds are automatically refunded and the issue price is reset and bidding is reopened using conditional atomic updates; during proposal acceptance, escrow funds are released to the winning agent's owner account using conditional atomic updates, and handling fees are deducted according to the platform rate; the agent scoring module is used to perform dual-track automatic scoring; the event delivery module is used to deliver route assignment, bid acceptance, and proposal status changes outward in outbound mode; the database layer is used to map to a relational database based on the object-relational mapping framework to persistently store data entities.

[0032] Example 1: Implementation of Timeout-Driven Hierarchical Routing and Candidate Snapshot Freezing This embodiment uses "automatic routing of enterprise-level database fault diagnosis tasks to intelligent agent clusters" as an application scenario to explain in detail the specific implementation of steps S1 to S3.

[0033] Scenario: An enterprise operations and maintenance platform has deployed five agent instances: a dedicated database agent, a general operations and maintenance agent, a cloud-native agent, a genealogy omnipotent agent, and a public community agent. A user submits a "relational database slow query optimization" issue. The initial routing mode is "directed," with the directed target being the dedicated database agent.

[0034] Implementation steps: Step 1: Problem Log Creation and Pool Resolution The system inserts a record into the problem table, with the initial values ​​of the key fields being: The issue number is automatically generated, the routing mode is set to "directed", the routing status is set to "directed", and the current routing round is set to one; the target agent number points to the dedicated database agent, the issue status is set to "open", and the timer start time is set to the current system time.

[0035] The background scanning process executes pool resolution logic every 30 seconds. According to the resolution rules, if the current routing mode is "directed" and the routing status is "directing", the problem is resolved into the directed pool, which is only visible to the dedicated database agent. The system generates a snapshot, writes the candidate agent list into the snapshot field, and records the snapshot round as the current routing round.

[0036] Step Two: Triggering the First Timeout Threshold and Upgrading the Level If the dedicated database agent does not accept a task within five minutes, the background scanning process detects that the difference between the start time and the current time exceeds a threshold, and escalates the status. The update operation changes the routing mode to "hierarchical overflow," the routing status to "overflowing," advances the current routing round to two, resets the start time to the current time, and keeps the issue status "open." This update operation is conditional; it is only executed if the issue is currently in "directed" mode and the status is "open" to prevent concurrent conflicts.

[0037] At this point, the routing pool is resolved to the top-level pool because the current routing round is 2. The candidate set is expanded to include dedicated database agents and general operations agents, i.e., agents from the same team or at the same level. The system refreezes the snapshot, writes the new candidate list to the snapshot field, and updates the snapshot round to the current routing round, ensuring that all scans within this round return the same candidate list and avoiding concurrency jitter.

[0038] Step 3: Gradual Degradation and Safety Net Measures in Case of Continuous Timeout If no one responds in the top-level pool, after ten minutes of the second timeout threshold, the current routing round is upgraded to level three and enters the standard pool, where it is a candidate to join a cloud-native intelligent agent. If the standard pool still times out, the current routing round reaches level four or higher and enters the genesis pool, where it is a candidate to join a genesis-level omnipotent intelligent agent. When there are no available intelligent agents in the genesis pool, the routing status is set to "fallback waiting". At this time, the problem can be claimed by the public pool and is visible to public community intelligent agents.

[0039] Step 4: Skip the empty pool When the background scanning process detects that a certain level pool is empty within a single scan, it skips that level and upgrades the round. For example, when there are no available agents in the top-level pool, the update operation directly advances the current routing round to three, while resetting the start time of the timer, with the additional condition that the current round is equal to two and the top-level pool is indeed empty.

[0040] In a multi-instance deployment environment, the background scanning process achieves mutual exclusion through a lease table. The lease table uses the lease key as the primary key and includes fields for holder ID, lease epoch, and expiration time. If no lease row exists, a new row is inserted and the lease is acquired, with the lease epoch set to its initial value. When the current process holds a lease, it renews the lease and updates the lease expiration time. If a lease expires, the process takes over the lease and increments the lease epoch. If another process holds a valid lease, the process rolls back and skips the current scan round.

[0041] In this specific deployment, the first server continuously renews its lease after acquiring it. When the first server crashes due to a failure, the second server detects the lease expiration after sixty seconds, performs a takeover operation, and increments the lease epoch to ensure the scanning process never stops. When processing long batches of tasks, the scanning process renews its lease periodically, and the lease of the crashed server is taken over by other instances after its lifespan expires.

[0042] Example 2: Implementation of Two-Condition Atomic Fund Custody under Concurrent Bidding This embodiment uses "three people bidding and accepting bids simultaneously" as a high-pressure scenario to explain in detail the anti-race state implementation of conditional atomic update in step S4.

[0043] Scenario: A problem is currently routed to the standard pool, with candidate agents being a general-purpose operations and maintenance agent, a cloud-native agent, and a generative all-around agent. The three agents submit bids of 800 yuan, 950 yuan, and 1200 yuan respectively. When the order issuer clicks to accept the 800 yuan bid from the general-purpose operations and maintenance agent on the webpage, the system automatically triggers an acceptance request for the same general-purpose operations and maintenance agent due to network retry.

[0044] Implementation steps: Step 1: Zero-price creation and bid entry.

[0045] When a problem is created, the price is zero, the escrow status is "none", and the escrow amount is zero, with no funds frozen. Each agent enters its bid through the bidding interface, and the bidding record includes the problem number, agent number, bid price, bidding time, and valid deadline.

[0046] Step 2: First condition atomic update - preemptively claim hosting rights.

[0047] When the issuer confirms acceptance of the bid from the general operations and maintenance agent, the system performs a first-condition atomic update. This update operation sets the managed status of the problematic row to the intermediate state of "funded", records the assigned agent number, and records the accepted bid price. The core condition for this update operation is that the managed status must be "none" or "refunded". If the condition is not met, the number of affected rows is zero, and the row is cleanly rejected. There is no "duplicate managed" competition window.

[0048] Step 3: Second Condition Atomic Update - Balance Guard Freeze After the first condition is met, the system immediately executes the second condition atomic update within the same database transaction. This update operation on the user account table keeps the total balance unchanged but adds a frozen balance field. The core condition for this update operation is that the user's available balance (i.e., total balance minus frozen balance minus withdrawal frozen balance) is not less than the bidding amount.

[0049] If the update operation affects zero rows, it indicates insufficient available balance. In this case, the entire transaction is rolled back, and the managed status of the problematic row is reverted to "none." The assigned agent clears the status and accepts the price being set to zero. In this scenario, the user has sufficient available balance, and the freeze is successful.

[0050] Step 4: Atomic refunds when the plan is rejected or cancelled.

[0051] If the issuer decides to cancel after the issue has been put into custody but before the solution is delivered, the system will perform a conditional rollback update. This update is only allowed to set the status to "refunded" if the custody status is "funded," the price will be reset to zero, and the assigned agent will clear the balance. Within the same transaction, an automatic fund unfreezing update will be performed to reduce the user's frozen balance. After the atomic refund, the issue will be reopened for bidding, and other agents can submit bids again.

[0052] Example 3: Implementation of Knowledge Compensation Settlement and Reliable Event Delivery This embodiment focuses on the scenario of "an intelligent agent submitting a knowledge package to offset part of the reward" and, in conjunction with step S5 and related dependent claims, fully describes the closed-loop process from solution delivery to final settlement.

[0053] Scenario: A native AI agent wins a bid for a problem, with a escrow amount of 950 yuan. The agent submits a knowledge package containing a "relational database parameter tuning template" and a "slow query analysis script," requesting a 40% deduction from the bounty. The issuer accepts and approves the knowledge package.

[0054] Step 1: Knowledge package submission and review.

[0055] The cloud-native intelligent agent includes knowledge package information in the solution submission interface. The update operation is written into the solution body, recording the knowledge package number, the requested deduction ratio, and setting the issue status to "pending review". The additional condition for this update operation is that the assigned intelligent agent is indeed a cloud-native intelligent agent.

[0056] After the issuing party reviews and accepts the knowledge package content, the review result is recorded as acceptance. The actual deduction ratio is the smaller value between the requested ratio and the global upper limit, which is set to 50%.

[0057] Step 2: Calculation of knowledge compensation settlement amount.

[0058] The system calculates each amount according to the divisibility rules: the total amount of the problem is 950 yuan; the requested deduction ratio is 40%; the knowledge value is equal to 950 yuan multiplied by 40%, which is rounded down to 380 yuan; the cash portion is 950 yuan minus 380 yuan, which equals 570 yuan; the agent's income is the cash portion minus the platform fee plus the knowledge value, which equals 570 yuan minus 57 yuan plus 380 yuan, which is 893 yuan.

[0059] Step 3: Conditional Atomic Loan Settlement.

[0060] After acceptance, perform the atomic loan disbursement operation. Update the issue table to set the status to "Completed" and the escrow status to "Released," recording the completion time. This update operation requires that the escrow status is "Funded" and the issue status is "Pending Review."

[0061] During the same transaction, the funds release update will add the calculated 893 yuan to the smart agent owner's account balance, while simultaneously deducting 950 yuan from the frozen balance. The platform handling fee of 57 yuan will be simultaneously credited to the platform account.

[0062] If the issuer refuses the knowledge package, the settlement will be made in full in cash, and the agent will receive 950 yuan minus the platform fee of 95 yuan, which is 855 yuan.

[0063] Step 4: Reliable event delivery for the same transaction.

[0064] After the settlement transaction is submitted, the system notifies the callback endpoint of the cloud-native intelligent agent through the outbound event delivery module. Event records and business changes are written to the event table within the same transaction. The event table includes fields such as event number, issue number, target callback address, event type, message payload, delivery status, number of retries, signature, and creation time.

[0065] After a transaction is committed, a single-threaded executor asynchronously and serially delivers the events to be processed. During delivery, a signature and timestamp are included in the Hypertext Transfer Protocol (HTTP) request header for the receiver to perform idempotency and replay protection.

[0066] If delivery fails, the system retryes according to the backoff interval. The backoff interval is calculated using an exponential backoff strategy, and the system is marked as a final failure after the maximum number of retries is reached (five). In the specific implementation, the first retry waits for ten seconds, the second for twenty seconds, the third for forty seconds, the fourth for eighty seconds, and the fifth for one hundred and sixty seconds.

[0067] The receiver verifies the hash message authentication code signature and timestamp, and only accepts events within five minutes before and after the current time; it also performs idempotent processing based on the event number to ensure that even if the same event is delivered multiple times due to network retries, the receiver will only process it once, thus preventing duplicate settlements or notifications.

[0068] In summary, this invention addresses the shortcomings of traditional solutions in three aspects: concurrency race conditions, heterogeneous scheduling, and hybrid settlement by integrating atomic updates of database conditions throughout the entire process of intelligent agent task routing, fund custody, and settlement delivery, using atomic conditional operations of structured query language as the core tool. Layered timeout overflow and snapshot freezing mechanisms ensure the stability of the candidate set and automatic task yielding; dual-condition atomic updates eliminate the risks of duplicate custody and over-deduction under high concurrency; and knowledge-based compensation settlement and delivery of same-transaction events enable atomic processing and reliable notification of non-cash deliverables.

[0069] In the description of this invention, it should be understood that the terms "coaxial," "bottom," "one end," "top," "middle," "other end," "upper," "side," "top," "inner," "front," "center," "both ends," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.

[0070] Furthermore, the terms "first," "second," "third," and "fourth" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first," "second," "third," or "fourth" may explicitly or implicitly include at least one of those features.

[0071] In this invention, unless otherwise explicitly specified and limited, the terms "installation," "setting," "connection," "fixing," "screw connection," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal connection of two components or the interaction between two components. Unless otherwise explicitly limited, those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0072] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for agent task routing and management based on conditional atomic updates, characterized in that, Includes the following steps: S1. Maintain the routing mode field, routing status field, and current routing round field on the problem data row. Based on the routing mode field, routing status field, and current routing round field, parse the candidate agent pool into one of the following: directional pool, top-level pool, standard pool, genesis pool, and public pool. S2. In the current routing round, write the sorted list of candidate agent identifiers into the snapshot field and record the snapshot round. When reading, return the snapshot only if the snapshot round matches the current routing round, so that the visible candidate set in the same round is determined. S3. The background scanning process runs as a single instance with database-level distributed lease protection, and the problem status is advanced step by step according to the timeout threshold. The timer is reset after each status advancement. S4. When accepting a bid, the order issuer inputs the expected amount, and the first condition atomic update is used to seize the escrow qualification. Then, the second condition atomic update is used to complete the fund freeze. The first condition atomic update requires that the escrow status of the problem line is empty or has been refunded. The second condition atomic update requires that the user's available balance is not less than the bid amount. S5. When the solution is accepted, release the escrow funds to the winning agent's owner account via a conditional atomic update and set the issue status to completed.

2. The agent task routing and management method based on conditional atomic update according to claim 1, characterized in that: In step S1, the candidate agent pool is resolved into one of the following categories based on the routing mode field, the routing status field, and the current routing round field: directional pool, top-level pool, standard pool, genesis pool, and public pool. When the routing mode is directed and the routing status is in the directed phase, it is resolved to the directed pool; when the routing mode is hierarchical overflow and the current route round number is ≤2, it is resolved to the top-level pool. When the routing mode is hierarchical overflow and the current routing round is equal to 3, it is resolved to the standard pool; When the routing mode is hierarchical overflow and the current routing round is ≥4 or the routing state is fallback, it is resolved to the genesis pool; When the routing mode is public, it resolves to a public pool; The background scanning step only handles issues that are in an open state, have not been assigned an agent, and whose routing mode is directional, hierarchical overflow, or fallback.

3. The agent task routing and management method based on conditional atomic update according to claim 1, characterized in that: In step S3, the problem status is progressively advanced according to the timeout threshold, including: When an issue is in the directional pool and remains there for more than the first timeout threshold, it is escalated to a hierarchical overflow state and the routing rounds are set to at least 2. When a problem is in the top-level pool and stays there for more than the second timeout threshold or the top-level pool is empty, the routing round will be increased to 3 and the problem will enter the standard pool. When the problem is in the standard pool and meets the timeout condition or the standard pool is empty, it enters the Genesis fallback assignment; When the problem is in the Genesis Pool and there are no available Genesis agents, set the routing state to fallback waiting; Each state advance resets the timing field, and the empty pool shortcut flag allows skipping empty layers within the same scan.

4. The agent task routing and management method based on conditional atomic update according to claim 1, characterized in that: In step S3, the database-level distributed leases are implemented using an atomic state machine through a lease table. The lease key serves as the unique identifier, and the holder's identifier consists of the hostname, process ID, role, and random token. If there is no lease row, insert and acquire the lease, and set the lease epoch to the initial value; This process renews leases and updates lease expiration dates when it holds them; it takes over leases when they expire and increments the lease epoch. The process rolls back and skips the current scan when it holds a valid lease; When handling long batches, periodic renewals are implemented, and the leases of crash holders are taken over by other instances after their lifespan expires.

5. The agent task routing and management method based on conditional atomic update according to claim 1, characterized in that: It also includes a dual-track automatic scoring step, specifically: The first track is a system-derived route score, calculated from historical task data aggregated from the database. It includes the sum of experience component, acceptance rate component, recent component, activity component, skill bonus, cost efficiency bonus, memory bonus, and arena bonus, minus the dispute penalty, and is constrained within a predetermined range. No administrator can manually set the path. The second track is a structured benchmark score, which is obtained by weighted averaging of six categories of deterministic rule scores using a zero-big-language model approach. The valid values ​​of the routing score and the baseline score are combined according to a predetermined weight and used as the sorting input for the candidate snapshot freezing step.

6. The agent task routing and management method based on conditional atomic update according to claim 5, characterized in that: The six categories and weights of the structured benchmark score are as follows: The scores are as follows: Response quality 0.25, instruction compliance 0.20, reasoning ability 0.20, response speed 0.10, reliability 0.15, and interface compliance 0.

10. Each category is scored using deterministic rules, and the total score is a weighted average of the scores in the six categories. The benchmark score is set with a guidance decay window: when there is no completed benchmark, the guidance score is only counted in full value in the ranking before the guidance deadline, and the effective score is reduced to zero once the deadline is reached; after the first completion of the actual benchmark, the guidance window is permanently closed.

7. The agent task routing and management method based on conditional atomic update according to claim 1, characterized in that: In step S4, specifically: The issue is created with zero price, zero escrow amount, and no escrow status; no balance verification or fund freezing is performed during the order placement process. Bids must include a binding price, which cannot be changed during the bid period; When accepting a bid, if the expected amount is inconsistent with the bid price, the operation is rejected and a conflict status code is returned; The first conditional atomic update is: when the escrow status of the problematic row is empty or has been refunded, set the escrow status to funded, requiring the number of affected rows to be 1; The second conditional atomic update is: based on the condition that the user's balance minus the frozen balance minus the withdrawal frozen balance is not less than the bidding amount, the frozen balance is atomically increased in the SQL statement; When funds are insufficient, the managed status is rolled back to zero using a conditional atomic update and an exception is thrown. When a proposal is rejected or cancelled, the escrow status is changed from "funded" to "refunded" via a conditional atomic update, automatically refunding the funds and resetting the issue price, and reopening the bidding process.

8. The agent task routing and management method based on conditional atomic update according to claim 1, characterized in that: Step S5 also includes a knowledge compensation settlement sub-step, specifically: After the proposal is submitted, the designated agent owner can submit a knowledge package, with a maximum of one package per question. The knowledge deduction ratio is subject to the global or single question upper limit. The value of knowledge is calculated by dividing the product of the question price and the requested deduction ratio by an integer. After the issuer reviews and accepts the knowledge package, the cash portion of the settlement is the total amount of the problem minus the knowledge value. The platform fee is only charged on the cash portion. The agent's income is the cash portion minus the platform fee plus the knowledge value, and the settlement is completed through atomic lending. If the knowledge package is rejected, the settlement will be processed in full cash.

9. The agent task routing and management method based on conditional atomic update according to claim 1, characterized in that: It also includes outbound event delivery steps consistent with business transactions, specifically: When the status changes, the event record is written to the same database transaction as the business change; After the transaction is committed, the single-threaded executor asynchronously and serially delivers the event to the callback endpoint of the external agent. If delivery fails, it will be retried at backoff intervals. Once the maximum number of retries is reached, it will be marked as a final failure. Each delivery is signed with an HMAC signature and timestamp for the receiver to perform idempotency and replay protection.

10. An agent-based task routing and management system based on conditional atomic updates, characterized in that: It includes a problem status management module, a route scanning engine module, a fund custody module, an agent scoring module, an event delivery module, and a database layer; The issue status management module is used to create and maintain issue records. The issue records include a routing mode field, a routing status field, a current routing round field, a candidate snapshot field, a managed status field, a managed amount field, and a price field. The routing scanning engine module is used to perform background periodic scanning, ensuring that only a single instance runs at the same time under a multi-instance deployment with database-level distributed leases; it advances the status of problematic routes step by step according to thresholds, and refreshes and freezes candidate snapshots each time they enter the top-level pool or standard pool; The fund custody module is used to create a problem at zero price during the order placement stage; when the order issuer accepts the bid, it verifies the consistency between the expected amount and the bid price, completes the custodian qualification grabbing with conditional atomic UPDATE, and then completes the fund freezing in SQL with conditional atomic update of balance guard; When a proposal is rejected, canceled, or abandoned, the escrow funds will be automatically refunded and the problem price reset via conditional atomic update, and the bidding will be reopened; upon proposal acceptance, the escrow funds will be released to the account of the winning intelligent agent owner via conditional atomic update, and the handling fee will be deducted according to the platform rate. The intelligent agent scoring module is used to perform dual-track automatic scoring; The event delivery module is used to deliver route assignment, bid acceptance, and scheme status change outwards in outbound mode. The database layer is used to map to a relational database based on an object-relational mapping framework to persistently store data entities.