systemprompt_cli/commands/admin/agents/
mod.rs1pub mod types;
13
14mod client;
15pub mod create;
16pub mod delete;
17mod edit;
18mod edit_apply;
19mod list;
20pub mod logs;
21pub mod logs_db;
22pub mod logs_disk;
23mod message;
24mod message_request;
25mod message_streaming;
26mod registry;
27mod run;
28pub mod shared;
29pub mod show;
30mod status;
31mod task;
32mod tools;
33mod tools_mcp;
34mod validate;
35
36use anyhow::{Context, Result};
37use clap::Subcommand;
38
39use crate::context::CommandContext;
40use crate::shared::render_result;
41
42#[derive(Debug, Subcommand)]
43pub enum AgentsCommands {
44 #[command(about = "List configured agents")]
45 List(list::ListArgs),
46
47 #[command(about = "Display agent configuration")]
48 Show(show::ShowArgs),
49
50 #[command(about = "Check agent configs for errors")]
51 Validate(validate::ValidateArgs),
52
53 #[command(about = "Create new agent")]
54 Create(create::CreateArgs),
55
56 #[command(about = "Edit agent configuration")]
57 Edit(edit::EditArgs),
58
59 #[command(about = "Delete an agent")]
60 Delete(delete::DeleteArgs),
61
62 #[command(about = "Show agent process status")]
63 Status(status::StatusArgs),
64
65 #[command(about = "View agent logs")]
66 Logs(logs::LogsArgs),
67
68 #[command(about = "Get running agents from gateway registry (A2A discovery)")]
69 Registry(registry::RegistryArgs),
70
71 #[command(about = "Send a message to an agent via A2A protocol")]
72 Message(message::MessageArgs),
73
74 #[command(about = "Get task details and response from an agent")]
75 Task(task::TaskArgs),
76
77 #[command(about = "List MCP tools available to an agent")]
78 Tools(tools::ToolsArgs),
79
80 #[command(about = "Run an agent server directly (bypasses orchestration)")]
81 Run(run::RunArgs),
82}
83
84pub async fn execute(command: AgentsCommands, ctx: &CommandContext) -> Result<()> {
85 let result = match command {
86 AgentsCommands::List(args) => {
87 list::execute(args, &ctx.cli).context("Failed to list agents")?
88 },
89 AgentsCommands::Show(args) => {
90 show::execute(args, ctx.prompter(), &ctx.cli).context("Failed to show agent")?
91 },
92 AgentsCommands::Validate(args) => {
93 validate::execute(&args, &ctx.cli).context("Failed to validate agents")?
94 },
95 AgentsCommands::Create(args) => {
96 create::execute(args, ctx.prompter(), &ctx.cli).context("Failed to create agent")?
97 },
98 AgentsCommands::Edit(args) => {
99 edit::execute(&args, ctx.prompter(), &ctx.cli).context("Failed to edit agent")?
100 },
101 AgentsCommands::Delete(args) => delete::execute(args, ctx.prompter(), &ctx.cli)
102 .await
103 .context("Failed to delete agent")?,
104 AgentsCommands::Status(args) => status::execute(args, &ctx.cli)
105 .await
106 .context("Failed to get agent status")?,
107 AgentsCommands::Logs(args) => logs::execute(args, ctx.prompter(), &ctx.cli)
108 .await
109 .context("Failed to get agent logs")?,
110 AgentsCommands::Registry(args) => registry::execute(args, &ctx.cli)
111 .await
112 .context("Failed to get agent registry")?,
113 AgentsCommands::Message(args) => message::execute(args, ctx)
114 .await
115 .context("Failed to send message to agent")?,
116 AgentsCommands::Task(args) => task::execute(args, ctx)
117 .await
118 .context("Failed to get task details")?,
119 AgentsCommands::Tools(args) => tools::execute(args, ctx)
120 .await
121 .context("Failed to list agent tools")?,
122 AgentsCommands::Run(args) => {
123 return run::execute(args).await.context("Failed to run agent");
124 },
125 };
126 render_result(&result, &ctx.cli);
127 Ok(())
128}