runtara_agents/registry.rs
1// Copyright (C) 2025 SyncMyOrders Sp. z o.o.
2// SPDX-License-Identifier: AGPL-3.0-or-later
3//! Agent registry using inventory-based dynamic dispatch
4//!
5//! This module provides capability execution by looking up executors
6//! registered via the `#[capability]` macro at compile time.
7
8use serde_json::Value;
9
10/// Execute an agent capability
11///
12/// # Arguments
13/// * `agent_id` - The agent name (e.g., "utils", "transform", "csv")
14/// * `capability_id` - The capability name (e.g., "random-double", "extract")
15/// * `step_inputs` - The input data as JSON Value
16///
17/// # Returns
18/// Result containing the capability result as JSON Value or an error
19pub fn execute_capability(
20 agent_id: &str,
21 capability_id: &str,
22 step_inputs: Value,
23) -> Result<Value, String> {
24 runtara_dsl::agent_meta::execute_capability(agent_id, capability_id, step_inputs)
25}