You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SKILLS: list[Skill] = [
{
"name": "sales_analytics",
"description": "Database schema and business logic for sales data analysis including customers, orders, and revenue.",
"content": """# Sales Analytics Schema
## Tables### customers- customer_id (PRIMARY KEY)
- name
- email
- signup_date
- status (active/inactive)
- customer_tier (bronze/silver/gold/platinum)
### orders- order_id (PRIMARY KEY)
- customer_id (FOREIGN KEY -> customers)
- order_date
- status (pending/completed/cancelled/refunded)
- total_amount
- sales_region (north/south/east/west)
### order_items- item_id (PRIMARY KEY)
- order_id (FOREIGN KEY -> orders)
- product_id
- quantity
- unit_price
- discount_percent
## Business Logic**Active customers**: status = 'active' AND signup_date <= CURRENT_DATE - INTERVAL '90 days'
**Revenue calculation**: Only count orders with status = 'completed'. Use total_amount from orders table, which already accounts for discounts.
**Customer lifetime value (CLV)**: Sum of all completed order amounts for a customer.
**High-value orders**: Orders with total_amount > 1000
## Example Query
-- Get top 10 customers by revenue in the last quarter
SELECT
c.customer_id,
c.name,
c.customer_tier,
SUM(o.total_amount) as total_revenue
FROM customers c
JOIN orders o ON c.customer_id = o.customer_id
WHERE o.status = 'completed'
AND o.order_date >= CURRENT_DATE - INTERVAL '3 months'
GROUP BY c.customer_id, c.name, c.customer_tier
ORDER BY total_revenue DESC
LIMIT 10;
""",
},
{
"name": "inventory_management",
"description": "Database schema and business logic for inventory tracking including products, warehouses, and stock levels.",
"content": """# Inventory Management Schema
## Tables### products- product_id (PRIMARY KEY)
- product_name
- sku
- category
- unit_cost
- reorder_point (minimum stock level before reordering)
- discontinued (boolean)
### warehouses- warehouse_id (PRIMARY KEY)
- warehouse_name
- location
- capacity
### inventory- inventory_id (PRIMARY KEY)
- product_id (FOREIGN KEY -> products)
- warehouse_id (FOREIGN KEY -> warehouses)
- quantity_on_hand
- last_updated
### stock_movements- movement_id (PRIMARY KEY)
- product_id (FOREIGN KEY -> products)
- warehouse_id (FOREIGN KEY -> warehouses)
- movement_type (inbound/outbound/transfer/adjustment)
- quantity (positive for inbound, negative for outbound)
- movement_date
- reference_number
## Business Logic**Available stock**: quantity_on_hand from inventory table where quantity_on_hand > 0
**Products needing reorder**: Products where total quantity_on_hand across all warehouses is less than or equal to the product's reorder_point
**Active products only**: Exclude products where discontinued = true unless specifically analyzing discontinued items
**Stock valuation**: quantity_on_hand * unit_cost for each product
## Example Query
-- Find products below reorder point across all warehouses
SELECT
p.product_id,
p.product_name,
p.reorder_point,
SUM(i.quantity_on_hand) as total_stock,
p.unit_cost,
(p.reorder_point - SUM(i.quantity_on_hand)) as units_to_reorder
FROM products p
JOIN inventory i ON p.product_id = i.product_id
WHERE p.discontinued = false
GROUP BY p.product_id, p.product_name, p.reorder_point, p.unit_cost
HAVING SUM(i.quantity_on_hand) <= p.reorder_point
ORDER BY units_to_reorder DESC;
""",
},
]
publicstaticvoidmain(String[] args) throwsException {
// Create toolkit and skillBox, configure skillsToolkittoolkit = newToolkit();
SkillBoxskillBox = newSkillBox(toolkit);
// 1. Create data analysis skillAgentSkilldataSkill = createDataAnalysisSkill();
// 2. Register skill with data analysis tools to skillBoxskillBox.registration().tool(newDataAnalysisTools()).skill(dataSkill).apply();
// Create ReActAgent with data analysis skillsReActAgentagent =
ReActAgent.builder()
.name("DataAnalyst")
.sysPrompt(buildSystemPrompt())
.model(
DashScopeChatModel.builder()
.apiKey(apiKey)
.modelName("qwen-max")
.stream(true)
.enableThinking(true)
.formatter(newDashScopeChatFormatter())
.build())
.toolkit(toolkit)
.skillBox(skillBox) // Automatically registers tools and hook
.memory(newInMemoryMemory())
.build();
// Print example queriesprintExampleQueries();
// Start interactive chatExampleUtils.startChat(agent);
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
为什么要做 Multi-agen?无论 single agent 还是 multi-agent,本质的核心还是做好上下文管理。那么multi-agent在上下文管理上能带来哪些优势?
当大家聊 multi-agent 时,通常是需要解决认为复杂的问题时。比如我们可能认为multi-agent比较擅长实现以下几个方面:
什么时候需要 multi-agent?
智能体推理模式
1.1 Supervisor(子智能体)模式
核心特点:
适用场景:
挑战:
Workflow 工作流模式
1.2 Handoffs(交接)模式
核心特点:
current_step或active_agent)来动态改变Agent行为适用场景:
挑战:
1.3 Skills(技能)模式
核心特点:
适用场景**:**
1.4 Routing(路由)模式
核心特点:
适用场景:
1.5 Pipeline(管道)
┌→ Agent1 → Output1 输入 →──┼→ Agent2 → Output2 └→ Agent3 → Output3能力描述:
核心特性:
1.6 Custom Workflow(自定义工作流)模式
核心特点:
适用场景:
实现方式:
Beta Was this translation helpful? Give feedback.
All reactions