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