@@ -5,10 +5,393 @@ title: API Reference
55
66# API Reference
77
8- ## Coming Soon
8+ Developer documentation for extending and integrating with Recursive Control.
99
10- Complete API documentation is under construction. Check back soon!
10+ ## Plugin Development
1111
12- For now, see:
13- - [ Getting Started Guide] ( Getting-Started.md )
14- - [ Multi-Agent Architecture] ( Multi-Agent-Architecture.md )
12+ ### Creating a Custom Plugin
13+
14+ Plugins extend Recursive Control's capabilities. Here's how to create one:
15+
16+ ``` csharp
17+ using Microsoft .SemanticKernel ;
18+ using System .ComponentModel ;
19+
20+ public class MyCustomPlugin
21+ {
22+ [KernelFunction ]
23+ [Description (" Does something useful" )]
24+ public string MyFunction (
25+ [Description (" Input parameter" )] string input )
26+ {
27+ // Your implementation here
28+ return $" Processed: {input }" ;
29+ }
30+ }
31+ ```
32+
33+ ### Plugin Interface Requirements
34+
35+ All plugins must:
36+ 1 . Use ` [KernelFunction] ` attribute for exposed methods
37+ 2 . Include ` [Description] ` for functions and parameters
38+ 3 . Return serializable types (string, int, bool, etc.)
39+ 4 . Handle exceptions gracefully
40+
41+ ### Registering Your Plugin
42+
43+ ``` csharp
44+ // In your initialization code
45+ kernel .ImportPluginFromType <MyCustomPlugin >();
46+ ```
47+
48+ ## Built-in Plugins API
49+
50+ ### CMDPlugin
51+
52+ Execute command line instructions.
53+
54+ ``` csharp
55+ [KernelFunction ]
56+ [Description (" Execute a Windows command" )]
57+ string ExecuteCommand (
58+ [Description (" Command to execute" )] string command ,
59+ [Description (" Working directory" )] string workingDirectory = null )
60+ ```
61+
62+ ** Example Usage** : "Execute dir command in C:\\ Users"
63+
64+ ### PowerShellPlugin
65+
66+ Run PowerShell scripts and commands.
67+
68+ ``` csharp
69+ [KernelFunction ]
70+ [Description (" Execute PowerShell command" )]
71+ string ExecutePowerShell (
72+ [Description (" PowerShell script" )] string script )
73+ ```
74+
75+ ** Example Usage** : "Run PowerShell to get running processes"
76+
77+ ### KeyboardPlugin
78+
79+ Automate keyboard input.
80+
81+ ``` csharp
82+ [KernelFunction ]
83+ [Description (" Type text using keyboard" )]
84+ void TypeText (
85+ [Description (" Text to type" )] string text )
86+
87+ [KernelFunction ]
88+ [Description (" Press a key combination" )]
89+ void PressKeys (
90+ [Description (" Keys to press" )] string keys )
91+ ```
92+
93+ ** Example Usage** : "Type Hello World" or "Press Ctrl+C"
94+
95+ ### MousePlugin
96+
97+ Automate mouse actions.
98+
99+ ``` csharp
100+ [KernelFunction ]
101+ [Description (" Click at coordinates" )]
102+ void Click (
103+ [Description (" X coordinate" )] int x ,
104+ [Description (" Y coordinate" )] int y ,
105+ [Description (" Button (left/right/middle)" )] string button = " left" )
106+
107+ [KernelFunction ]
108+ [Description (" Move mouse to position" )]
109+ void MoveTo (
110+ [Description (" X coordinate" )] int x ,
111+ [Description (" Y coordinate" )] int y )
112+ ```
113+
114+ ** Example Usage** : "Click at position 500, 300"
115+
116+ ### ScreenCapturePlugin
117+
118+ Capture and analyze screenshots.
119+
120+ ``` csharp
121+ [KernelFunction ]
122+ [Description (" Capture screenshot" )]
123+ string CaptureScreen (
124+ [Description (" Capture full screen or window" )] string mode = " fullscreen" )
125+
126+ [KernelFunction ]
127+ [Description (" Get screen dimensions" )]
128+ string GetScreenSize ()
129+ ```
130+
131+ ** Example Usage** : "Take a screenshot of the current window"
132+
133+ ### WindowSelectionPlugin
134+
135+ Manage application windows.
136+
137+ ``` csharp
138+ [KernelFunction ]
139+ [Description (" List all open windows" )]
140+ string ListWindows ()
141+
142+ [KernelFunction ]
143+ [Description (" Bring window to front" )]
144+ void FocusWindow (
145+ [Description (" Window title or handle" )] string identifier )
146+
147+ [KernelFunction ]
148+ [Description (" Close a window" )]
149+ void CloseWindow (
150+ [Description (" Window identifier" )] string identifier )
151+ ```
152+
153+ ** Example Usage** : "List all open windows" or "Focus Chrome window"
154+
155+ ### PlaywrightPlugin
156+
157+ Automate web browsers.
158+
159+ ``` csharp
160+ [KernelFunction ]
161+ [Description (" Launch browser" )]
162+ Task < string > LaunchBrowser (
163+ [Description (" Browser type" )] string browser = " chromium" )
164+
165+ [KernelFunction ]
166+ [Description (" Navigate to URL" )]
167+ Task < string > NavigateTo (
168+ [Description (" URL to navigate" )] string url )
169+
170+ [KernelFunction ]
171+ [Description (" Execute JavaScript" )]
172+ Task < string > ExecuteScript (
173+ [Description (" JavaScript code" )] string script )
174+
175+ [KernelFunction ]
176+ [Description (" Close browser" )]
177+ Task CloseBrowser ()
178+ ```
179+
180+ ** Example Usage** : "Open browser and go to github.com"
181+
182+ ### RemoteControlPlugin
183+
184+ HTTP API for remote command execution.
185+
186+ ``` csharp
187+ [KernelFunction ]
188+ [Description (" Start HTTP server" )]
189+ void StartServer (
190+ [Description (" Port number" )] int port = 8080 )
191+
192+ [KernelFunction ]
193+ [Description (" Stop HTTP server" )]
194+ void StopServer ()
195+ ```
196+
197+ ** HTTP API Endpoint** :
198+ ``` bash
199+ POST http://localhost:8080/command
200+ Content-Type: application/json
201+
202+ {
203+ " command" : " Your natural language command here"
204+ }
205+ ```
206+
207+ ## Configuration API
208+
209+ ### ToolConfig
210+
211+ Main configuration for plugins and features.
212+
213+ ``` csharp
214+ public class ToolConfig
215+ {
216+ // Plugin toggles
217+ public bool EnableKeyboard { get ; set ; }
218+ public bool EnableMouse { get ; set ; }
219+ public bool EnableScreenCapture { get ; set ; }
220+ public bool EnableCMD { get ; set ; }
221+ public bool EnablePowerShell { get ; set ; }
222+ public bool EnablePlaywright { get ; set ; }
223+ public bool EnableRemoteControl { get ; set ; }
224+
225+ // System prompts
226+ public string CoordinatorPrompt { get ; set ; }
227+ public string PlannerPrompt { get ; set ; }
228+ public string ExecutorPrompt { get ; set ; }
229+
230+ // Other settings
231+ public int RemoteControlPort { get ; set ; }
232+ public bool VerboseLogging { get ; set ; }
233+ }
234+ ```
235+
236+ ** Config Location** : ` %APPDATA%\FlowVision\toolconfig.json `
237+
238+ ### APIConfig
239+
240+ AI provider configuration.
241+
242+ ``` csharp
243+ public class APIConfig
244+ {
245+ public string Provider { get ; set ; } // "OpenAI", "Azure", "Anthropic", etc.
246+ public string ApiKey { get ; set ; }
247+ public string Endpoint { get ; set ; }
248+ public string ModelName { get ; set ; }
249+ public string DeploymentName { get ; set ; }
250+ public int MaxTokens { get ; set ; }
251+ public double Temperature { get ; set ; }
252+ }
253+ ```
254+
255+ ** Config Location** : ` %APPDATA%\FlowVision\apiconfig.json `
256+
257+ ## Multi-Agent Architecture
258+
259+ ### Agent Roles
260+
261+ ``` csharp
262+ // Coordinator: Routes requests to appropriate agent
263+ var coordinatorAgent = new Agent
264+ {
265+ Name = " Coordinator" ,
266+ SystemPrompt = toolConfig .CoordinatorPrompt
267+ };
268+
269+ // Planner: Creates execution plans
270+ var plannerAgent = new Agent
271+ {
272+ Name = " Planner" ,
273+ SystemPrompt = toolConfig .PlannerPrompt
274+ };
275+
276+ // Executor: Executes actions using plugins
277+ var executorAgent = new Agent
278+ {
279+ Name = " Executor" ,
280+ SystemPrompt = toolConfig .ExecutorPrompt ,
281+ Plugins = kernel .Plugins
282+ };
283+ ```
284+
285+ ### Workflow
286+
287+ 1 . User input → Coordinator
288+ 2 . Coordinator → Planner (if planning needed)
289+ 3 . Planner → Executor (with step-by-step plan)
290+ 4 . Executor → Plugins (to perform actions)
291+ 5 . Results → User
292+
293+ ## Extension Points
294+
295+ ### Custom AI Providers
296+
297+ Implement custom AI provider:
298+
299+ ``` csharp
300+ public interface IAIProvider
301+ {
302+ Task <string > GenerateResponse (string prompt );
303+ Task <string > GenerateWithFunctions (string prompt , IEnumerable <Function > functions );
304+ }
305+ ```
306+
307+ ### Custom Logging
308+
309+ Implement custom logger:
310+
311+ ``` csharp
312+ public interface IPluginLogger
313+ {
314+ void LogUsage (string plugin , string function , Dictionary <string , object > parameters );
315+ void LogError (string plugin , Exception ex );
316+ }
317+ ```
318+
319+ ### Custom UI Themes
320+
321+ Create custom theme:
322+
323+ ``` csharp
324+ public class CustomTheme : ITheme
325+ {
326+ public Color BackgroundColor { get ; set ; }
327+ public Color ForegroundColor { get ; set ; }
328+ public Color AccentColor { get ; set ; }
329+ public Font DefaultFont { get ; set ; }
330+ }
331+ ```
332+
333+ ## Integration Examples
334+
335+ ### HTTP API Integration
336+
337+ ``` python
338+ import requests
339+
340+ # Send command via HTTP
341+ response = requests.post(
342+ ' http://localhost:8080/command' ,
343+ json = {' command' : ' Open Notepad and type Hello World' }
344+ )
345+
346+ print (response.json())
347+ ```
348+
349+ ### Programmatic Control
350+
351+ ``` csharp
352+ // Initialize Recursive Control programmatically
353+ var config = new APIConfig { /* ... */ };
354+ var executor = new MultiAgentActioner (config );
355+
356+ // Execute command
357+ var result = await executor .ExecuteAsync (" Take a screenshot" );
358+ Console .WriteLine (result );
359+ ```
360+
361+ ## Best Practices
362+
363+ ### Plugin Development
364+ 1 . Use descriptive function and parameter names
365+ 2 . Provide detailed descriptions for AI understanding
366+ 3 . Handle errors gracefully and return meaningful messages
367+ 4 . Keep functions focused on single responsibilities
368+ 5 . Test with various AI models
369+
370+ ### Performance
371+ 1 . Cache expensive operations
372+ 2 . Use async/await for I/O operations
373+ 3 . Implement timeout mechanisms
374+ 4 . Release resources properly
375+
376+ ### Security
377+ 1 . Validate all input parameters
378+ 2 . Sanitize file paths and commands
379+ 3 . Implement permission checks
380+ 4 . Log security-relevant actions
381+ 5 . Don't expose sensitive data in responses
382+
383+ ## Further Reading
384+
385+ - [ Multi-Agent Architecture] ( Multi-Agent-Architecture.html ) - Deep dive into agent system
386+ - [ System Prompts Reference] ( System-Prompts-Reference.html ) - Customizing agent behavior
387+ - [ GitHub Repository] ( https://github.com/flowdevs-io/Recursive-Control ) - Source code
388+
389+ ## Community Resources
390+
391+ - [ Discord Developer Channel] ( https://discord.gg/mQWsWeHsVU ) - Ask questions
392+ - [ GitHub Discussions] ( https://github.com/flowdevs-io/Recursive-Control/discussions ) - Share ideas
393+ - [ Example Plugins] ( https://github.com/flowdevs-io/Recursive-Control/tree/master/FlowVision/lib/Plugins ) - Reference implementations
394+
395+ ---
396+
397+ Have questions? Join our [ Discord] ( https://discord.gg/mQWsWeHsVU ) or open a [ GitHub Discussion] ( https://github.com/flowdevs-io/Recursive-Control/discussions ) !
0 commit comments