custom_agent_acp.py
1 #!/usr/bin/env python3 2 """ 3 Custom Agent ACP Server Example 4 5 This example shows how to run a custom PraisonAI agent as an ACP server. 6 7 Usage: 8 python custom_agent_acp.py 9 """ 10 11 from praisonai.acp import serve, ACPServer, ACPConfig 12 from praisonaiagents import Agent 13 14 # Create a custom agent 15 agent = Agent( 16 name="CodeAssistant", 17 instructions="""You are an expert coding assistant. You help users: 18 - Write clean, efficient code 19 - Debug issues 20 - Explain complex concepts 21 - Review code for best practices 22 23 Always provide clear explanations with your code suggestions.""", 24 model="gpt-4o-mini", 25 ) 26 27 if __name__ == "__main__": 28 # Create config 29 config = ACPConfig( 30 workspace=".", 31 debug=True, 32 allow_write=True, # Allow file modifications 33 approval_mode="manual", 34 ) 35 36 # Create server with custom agent 37 server = ACPServer(config=config, agent=agent) 38 39 # Run the server 40 serve( 41 workspace=".", 42 debug=True, 43 allow_write=True, 44 approval_mode="manual", 45 )