mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-07 12:47:55 -10:00
- Add Code category in Key Features table (like Workflows) - Add individual examples for each external agent: - claude_code_example.py - gemini_cli_example.py - codex_cli_example.py - cursor_cli_example.py - external_agents_example.py (all integrations) - code_editing_example.py - Link to individual docs pages for each integration - Organize code-related features under Code category
38 lines
981 B
Python
38 lines
981 B
Python
"""
|
|
Cursor CLI Integration Example
|
|
|
|
Demonstrates how to use Cursor CLI as an agent tool in PraisonAI.
|
|
"""
|
|
|
|
import asyncio
|
|
from praisonai.integrations import CursorCLIIntegration
|
|
|
|
async def main():
|
|
# Create Cursor CLI integration
|
|
cursor = CursorCLIIntegration(
|
|
workspace=".",
|
|
output_format="json",
|
|
force=True,
|
|
model="gpt-5",
|
|
stream_partial=True
|
|
)
|
|
|
|
# Check availability
|
|
print(f"Cursor CLI available: {cursor.is_available}")
|
|
print(f"Force mode: {cursor.force}")
|
|
print(f"Model: {cursor.model}")
|
|
|
|
# Execute a coding task
|
|
result = await cursor.execute("List files in the current directory")
|
|
print(f"Result: {result}")
|
|
|
|
# Stream output
|
|
print("\nStreaming output:")
|
|
async for event in cursor.stream("Explain the project"):
|
|
content = event.get("content", "")
|
|
if content:
|
|
print(content, end="", flush=True)
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|