|
| 1 | +syntax = "proto3"; |
| 2 | + |
| 3 | +package sharpaikit.agent; |
| 4 | + |
| 5 | +option csharp_namespace = "SharpAIKit.Grpc"; |
| 6 | + |
| 7 | +// Agent service for executing AI agent tasks |
| 8 | +service AgentService { |
| 9 | + // Create a new agent instance |
| 10 | + rpc CreateAgent(CreateAgentRequest) returns (CreateAgentResponse); |
| 11 | + |
| 12 | + // Execute an agent task |
| 13 | + rpc Execute(ExecuteRequest) returns (ExecuteResponse); |
| 14 | + |
| 15 | + // Execute an agent task asynchronously (streaming) |
| 16 | + rpc ExecuteStream(ExecuteRequest) returns (stream ExecuteStreamChunk); |
| 17 | + |
| 18 | + // List available skills |
| 19 | + rpc ListAvailableSkills(ListSkillsRequest) returns (ListSkillsResponse); |
| 20 | + |
| 21 | + // Get last skill resolution for an agent |
| 22 | + rpc GetLastSkillResolution(GetSkillResolutionRequest) returns (GetSkillResolutionResponse); |
| 23 | + |
| 24 | + // Health check |
| 25 | + rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse); |
| 26 | +} |
| 27 | + |
| 28 | +// Request to create an agent |
| 29 | +message CreateAgentRequest { |
| 30 | + string agent_id = 1; // Unique agent identifier |
| 31 | + string api_key = 2; // LLM API key |
| 32 | + string base_url = 3; // LLM base URL |
| 33 | + string model = 4; // Model name |
| 34 | + repeated string skill_ids = 5; // Skill IDs to activate |
| 35 | + map<string, string> options = 6; // Additional options |
| 36 | +} |
| 37 | + |
| 38 | +// Response from creating an agent |
| 39 | +message CreateAgentResponse { |
| 40 | + bool success = 1; |
| 41 | + string agent_id = 2; |
| 42 | + string error = 3; |
| 43 | +} |
| 44 | + |
| 45 | +// Request to execute an agent task |
| 46 | +message ExecuteRequest { |
| 47 | + string agent_id = 1; |
| 48 | + string task = 2; |
| 49 | + repeated ToolDefinition tools = 3; |
| 50 | + map<string, string> context = 4; |
| 51 | +} |
| 52 | + |
| 53 | +// Tool definition |
| 54 | +message ToolDefinition { |
| 55 | + string name = 1; |
| 56 | + string description = 2; |
| 57 | + repeated ToolParameter parameters = 3; |
| 58 | +} |
| 59 | + |
| 60 | +// Tool parameter |
| 61 | +message ToolParameter { |
| 62 | + string name = 1; |
| 63 | + string type = 2; |
| 64 | + string description = 3; |
| 65 | + bool required = 4; |
| 66 | +} |
| 67 | + |
| 68 | +// Response from executing an agent task |
| 69 | +message ExecuteResponse { |
| 70 | + bool success = 1; |
| 71 | + string output = 2; |
| 72 | + repeated ExecutionStep steps = 3; |
| 73 | + SkillResolutionInfo skill_resolution = 4; |
| 74 | + repeated string denied_tools = 5; |
| 75 | + string error = 6; |
| 76 | + string error_code = 7; |
| 77 | +} |
| 78 | + |
| 79 | +// Execution step |
| 80 | +message ExecutionStep { |
| 81 | + int32 step_number = 1; |
| 82 | + string type = 2; |
| 83 | + string thought = 3; |
| 84 | + string action = 4; |
| 85 | + string observation = 5; |
| 86 | + string tool_name = 6; |
| 87 | + map<string, string> tool_args = 7; |
| 88 | +} |
| 89 | + |
| 90 | +// Skill resolution information |
| 91 | +message SkillResolutionInfo { |
| 92 | + repeated string activated_skill_ids = 1; |
| 93 | + repeated string decision_reasons = 2; |
| 94 | + SkillConstraintsInfo constraints = 3; |
| 95 | + map<string, string> tool_denial_reasons = 4; // tool_name -> reason |
| 96 | +} |
| 97 | + |
| 98 | +// Skill constraints information |
| 99 | +message SkillConstraintsInfo { |
| 100 | + repeated string allowed_tools = 1; |
| 101 | + repeated string forbidden_tools = 2; |
| 102 | + int32 max_steps = 3; |
| 103 | + int64 max_execution_time_ms = 4; |
| 104 | +} |
| 105 | + |
| 106 | +// Streaming chunk for ExecuteStream |
| 107 | +message ExecuteStreamChunk { |
| 108 | + oneof content { |
| 109 | + string text_chunk = 1; |
| 110 | + ExecutionStep step = 2; |
| 111 | + SkillResolutionInfo skill_resolution = 3; |
| 112 | + string error = 4; |
| 113 | + bool done = 5; |
| 114 | + } |
| 115 | +} |
| 116 | + |
| 117 | +// Request to list available skills |
| 118 | +message ListSkillsRequest { |
| 119 | + // Empty - lists all available skills |
| 120 | +} |
| 121 | + |
| 122 | +// Response with available skills |
| 123 | +message ListSkillsResponse { |
| 124 | + repeated SkillInfo skills = 1; |
| 125 | +} |
| 126 | + |
| 127 | +// Skill information |
| 128 | +message SkillInfo { |
| 129 | + string id = 1; |
| 130 | + string name = 2; |
| 131 | + string description = 3; |
| 132 | + string version = 4; |
| 133 | + int32 priority = 5; |
| 134 | + string scope = 6; |
| 135 | +} |
| 136 | + |
| 137 | +// Request to get skill resolution |
| 138 | +message GetSkillResolutionRequest { |
| 139 | + string agent_id = 1; |
| 140 | +} |
| 141 | + |
| 142 | +// Response with skill resolution |
| 143 | +message GetSkillResolutionResponse { |
| 144 | + bool success = 1; |
| 145 | + SkillResolutionInfo skill_resolution = 2; |
| 146 | + string error = 3; |
| 147 | +} |
| 148 | + |
| 149 | +// Health check request |
| 150 | +message HealthCheckRequest { |
| 151 | + // Empty |
| 152 | +} |
| 153 | + |
| 154 | +// Health check response |
| 155 | +message HealthCheckResponse { |
| 156 | + bool healthy = 1; |
| 157 | + string version = 2; |
| 158 | +} |
| 159 | + |
0 commit comments