// Tools that work together
final tools = [
Tool(
name: 'get_current_time',
description: 'Get the current date and time',
onCall: (_) async => {'time': '2025-01-27T10:00:00Z'},
),
Tool(
name: 'find_events',
description: 'Find events for a date',
inputSchema: JsonSchema.object({
'date': JsonSchema.string(),
}),
onCall: (args) async => {
'events': ['Team Meeting at 11am', 'Lunch at 12pm'],
},
),
];
// Agent chains tools automatically
final agent = Agent('openai', tools: tools);
final result = await agent.send(
'What events do I have today? Find the current date first.'
);
// Agent will:
// 1. Call get_current_time → gets "2025-01-27"
// 2. Extract date from response
// 3. Call find_events with that date
// 4. Return final answer with events