cyka-agent 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cyka_agent-0.1.0/PKG-INFO +180 -0
- cyka_agent-0.1.0/README.md +145 -0
- cyka_agent-0.1.0/pyproject.toml +66 -0
- cyka_agent-0.1.0/setup.cfg +4 -0
- cyka_agent-0.1.0/src/cyka_agent/__init__.py +60 -0
- cyka_agent-0.1.0/src/cyka_agent/agent.py +327 -0
- cyka_agent-0.1.0/src/cyka_agent/browser.py +282 -0
- cyka_agent-0.1.0/src/cyka_agent/client.py +241 -0
- cyka_agent-0.1.0/src/cyka_agent/tools.py +221 -0
- cyka_agent-0.1.0/src/cyka_agent/types.py +193 -0
- cyka_agent-0.1.0/src/cyka_agent.egg-info/PKG-INFO +180 -0
- cyka_agent-0.1.0/src/cyka_agent.egg-info/SOURCES.txt +13 -0
- cyka_agent-0.1.0/src/cyka_agent.egg-info/dependency_links.txt +1 -0
- cyka_agent-0.1.0/src/cyka_agent.egg-info/requires.txt +12 -0
- cyka_agent-0.1.0/src/cyka_agent.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cyka-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for Cykani stealth browser automation and AI agents
|
|
5
|
+
Author-email: Cykani <dev@cykani.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://cykani.com
|
|
8
|
+
Project-URL: Documentation, https://docs.cykani.com
|
|
9
|
+
Project-URL: Repository, https://github.com/cykani/cyka-agent
|
|
10
|
+
Project-URL: Issues, https://github.com/cykani/cyka-agent/issues
|
|
11
|
+
Keywords: browser,automation,stealth,anti-detection,ai-agent,scraping
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: httpx>=0.24.0
|
|
26
|
+
Requires-Dist: pydantic>=2.0.0
|
|
27
|
+
Requires-Dist: websockets>=11.0
|
|
28
|
+
Provides-Extra: llm
|
|
29
|
+
Requires-Dist: openai>=1.0.0; extra == "llm"
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
34
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
35
|
+
|
|
36
|
+
# cyka-agent Python SDK
|
|
37
|
+
|
|
38
|
+
Python SDK for Cykani stealth browser automation and AI agents.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install cyka-agent
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For LLM support:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install cyka-agent[llm]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
### Manual Browser Control
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import asyncio
|
|
58
|
+
from cyka_agent import Browser
|
|
59
|
+
|
|
60
|
+
async def main():
|
|
61
|
+
browser = await Browser.connect("ws://localhost:9222")
|
|
62
|
+
|
|
63
|
+
await browser.goto("https://example.com")
|
|
64
|
+
await browser.click("#login-button")
|
|
65
|
+
await browser.type("#email", "user@example.com")
|
|
66
|
+
text = await browser.extract("#content")
|
|
67
|
+
|
|
68
|
+
print(text)
|
|
69
|
+
await browser.disconnect()
|
|
70
|
+
|
|
71
|
+
asyncio.run(main())
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### AI Agent (Autonomous)
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
import asyncio
|
|
78
|
+
from cyka_agent import Agent, Browser, AgentConfig
|
|
79
|
+
|
|
80
|
+
async def main():
|
|
81
|
+
browser = await Browser.connect("ws://localhost:9222")
|
|
82
|
+
|
|
83
|
+
agent = Agent.create(
|
|
84
|
+
session=browser._session,
|
|
85
|
+
config=AgentConfig(
|
|
86
|
+
session_id="",
|
|
87
|
+
profile_id="",
|
|
88
|
+
goal="Find the cheapest iPhone on Amazon and add to cart",
|
|
89
|
+
max_steps=25,
|
|
90
|
+
),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
result = await agent.run_async()
|
|
94
|
+
print(result.status) # "success" or "max_steps_exceeded"
|
|
95
|
+
print(result.result) # What was accomplished
|
|
96
|
+
|
|
97
|
+
asyncio.run(main())
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Tool-Based (For LLM Integration)
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
import asyncio
|
|
104
|
+
from cyka_agent import Browser, BrowserTools
|
|
105
|
+
|
|
106
|
+
async def main():
|
|
107
|
+
browser = await Browser.connect("ws://localhost:9222")
|
|
108
|
+
session = browser._session
|
|
109
|
+
|
|
110
|
+
tools = BrowserTools(session)
|
|
111
|
+
|
|
112
|
+
# Get tool definitions for your LLM
|
|
113
|
+
tool_defs = tools.get_definitions()
|
|
114
|
+
|
|
115
|
+
# Use with any LLM (example: OpenAI)
|
|
116
|
+
from openai import OpenAI
|
|
117
|
+
client = OpenAI()
|
|
118
|
+
|
|
119
|
+
response = client.chat.completions.create(
|
|
120
|
+
model="gpt-4",
|
|
121
|
+
messages=[{"role": "user", "content": "Navigate to example.com"}],
|
|
122
|
+
tools=tool_defs,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# Execute the tool call
|
|
126
|
+
tool_call = response.choices[0].message.tool_calls[0]
|
|
127
|
+
result = await tools.execute(
|
|
128
|
+
tool_call.function.name,
|
|
129
|
+
eval(tool_call.function.arguments),
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
print(result.output)
|
|
133
|
+
|
|
134
|
+
asyncio.run(main())
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Using with Cykani API
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from cyka_agent import CykaClient
|
|
141
|
+
|
|
142
|
+
client = CykaClient(
|
|
143
|
+
api_url="http://localhost:3001",
|
|
144
|
+
api_key="your-api-key",
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
# Create a session
|
|
148
|
+
session = client.sessions.create(profile_id="profile-123")
|
|
149
|
+
print(session.cdp_endpoint) # ws://localhost:9222
|
|
150
|
+
|
|
151
|
+
# Start the session
|
|
152
|
+
session = client.sessions.start(session.id)
|
|
153
|
+
|
|
154
|
+
# Create and run an agent
|
|
155
|
+
agent = client.agents.create(
|
|
156
|
+
session_id=session.id,
|
|
157
|
+
profile_id="profile-123",
|
|
158
|
+
goal="Scrape all product prices",
|
|
159
|
+
)
|
|
160
|
+
result = client.agents.run(agent["id"])
|
|
161
|
+
print(result)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Supported LLM Providers
|
|
165
|
+
|
|
166
|
+
- OpenAI (GPT-4, GPT-3.5)
|
|
167
|
+
- Anthropic (Claude)
|
|
168
|
+
- Any OpenAI-compatible API (Hermes, Groq, etc.)
|
|
169
|
+
|
|
170
|
+
## Environment Variables
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
CYKANI_API_URL=http://localhost:3001
|
|
174
|
+
CYKANI_API_KEY=your-api-key
|
|
175
|
+
OPENAI_API_KEY=your-openai-key # For OpenAI adapter
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
Apache-2.0
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# cyka-agent Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for Cykani stealth browser automation and AI agents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install cyka-agent
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For LLM support:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install cyka-agent[llm]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### Manual Browser Control
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import asyncio
|
|
23
|
+
from cyka_agent import Browser
|
|
24
|
+
|
|
25
|
+
async def main():
|
|
26
|
+
browser = await Browser.connect("ws://localhost:9222")
|
|
27
|
+
|
|
28
|
+
await browser.goto("https://example.com")
|
|
29
|
+
await browser.click("#login-button")
|
|
30
|
+
await browser.type("#email", "user@example.com")
|
|
31
|
+
text = await browser.extract("#content")
|
|
32
|
+
|
|
33
|
+
print(text)
|
|
34
|
+
await browser.disconnect()
|
|
35
|
+
|
|
36
|
+
asyncio.run(main())
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### AI Agent (Autonomous)
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import asyncio
|
|
43
|
+
from cyka_agent import Agent, Browser, AgentConfig
|
|
44
|
+
|
|
45
|
+
async def main():
|
|
46
|
+
browser = await Browser.connect("ws://localhost:9222")
|
|
47
|
+
|
|
48
|
+
agent = Agent.create(
|
|
49
|
+
session=browser._session,
|
|
50
|
+
config=AgentConfig(
|
|
51
|
+
session_id="",
|
|
52
|
+
profile_id="",
|
|
53
|
+
goal="Find the cheapest iPhone on Amazon and add to cart",
|
|
54
|
+
max_steps=25,
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
result = await agent.run_async()
|
|
59
|
+
print(result.status) # "success" or "max_steps_exceeded"
|
|
60
|
+
print(result.result) # What was accomplished
|
|
61
|
+
|
|
62
|
+
asyncio.run(main())
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Tool-Based (For LLM Integration)
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import asyncio
|
|
69
|
+
from cyka_agent import Browser, BrowserTools
|
|
70
|
+
|
|
71
|
+
async def main():
|
|
72
|
+
browser = await Browser.connect("ws://localhost:9222")
|
|
73
|
+
session = browser._session
|
|
74
|
+
|
|
75
|
+
tools = BrowserTools(session)
|
|
76
|
+
|
|
77
|
+
# Get tool definitions for your LLM
|
|
78
|
+
tool_defs = tools.get_definitions()
|
|
79
|
+
|
|
80
|
+
# Use with any LLM (example: OpenAI)
|
|
81
|
+
from openai import OpenAI
|
|
82
|
+
client = OpenAI()
|
|
83
|
+
|
|
84
|
+
response = client.chat.completions.create(
|
|
85
|
+
model="gpt-4",
|
|
86
|
+
messages=[{"role": "user", "content": "Navigate to example.com"}],
|
|
87
|
+
tools=tool_defs,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Execute the tool call
|
|
91
|
+
tool_call = response.choices[0].message.tool_calls[0]
|
|
92
|
+
result = await tools.execute(
|
|
93
|
+
tool_call.function.name,
|
|
94
|
+
eval(tool_call.function.arguments),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
print(result.output)
|
|
98
|
+
|
|
99
|
+
asyncio.run(main())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Using with Cykani API
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from cyka_agent import CykaClient
|
|
106
|
+
|
|
107
|
+
client = CykaClient(
|
|
108
|
+
api_url="http://localhost:3001",
|
|
109
|
+
api_key="your-api-key",
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Create a session
|
|
113
|
+
session = client.sessions.create(profile_id="profile-123")
|
|
114
|
+
print(session.cdp_endpoint) # ws://localhost:9222
|
|
115
|
+
|
|
116
|
+
# Start the session
|
|
117
|
+
session = client.sessions.start(session.id)
|
|
118
|
+
|
|
119
|
+
# Create and run an agent
|
|
120
|
+
agent = client.agents.create(
|
|
121
|
+
session_id=session.id,
|
|
122
|
+
profile_id="profile-123",
|
|
123
|
+
goal="Scrape all product prices",
|
|
124
|
+
)
|
|
125
|
+
result = client.agents.run(agent["id"])
|
|
126
|
+
print(result)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Supported LLM Providers
|
|
130
|
+
|
|
131
|
+
- OpenAI (GPT-4, GPT-3.5)
|
|
132
|
+
- Anthropic (Claude)
|
|
133
|
+
- Any OpenAI-compatible API (Hermes, Groq, etc.)
|
|
134
|
+
|
|
135
|
+
## Environment Variables
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
CYKANI_API_URL=http://localhost:3001
|
|
139
|
+
CYKANI_API_KEY=your-api-key
|
|
140
|
+
OPENAI_API_KEY=your-openai-key # For OpenAI adapter
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
Apache-2.0
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "cyka-agent"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python SDK for Cykani stealth browser automation and AI agents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "Apache-2.0"}
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Cykani", email = "dev@cykani.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["browser", "automation", "stealth", "anti-detection", "ai-agent", "scraping"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: Apache Software License",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
|
27
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"httpx>=0.24.0",
|
|
31
|
+
"pydantic>=2.0.0",
|
|
32
|
+
"websockets>=11.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
llm = [
|
|
37
|
+
"openai>=1.0.0",
|
|
38
|
+
]
|
|
39
|
+
dev = [
|
|
40
|
+
"pytest>=7.0.0",
|
|
41
|
+
"pytest-asyncio>=0.21.0",
|
|
42
|
+
"ruff>=0.1.0",
|
|
43
|
+
"mypy>=1.0.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://cykani.com"
|
|
48
|
+
Documentation = "https://docs.cykani.com"
|
|
49
|
+
Repository = "https://github.com/cykani/cyka-agent"
|
|
50
|
+
Issues = "https://github.com/cykani/cyka-agent/issues"
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["src"]
|
|
54
|
+
|
|
55
|
+
[tool.ruff]
|
|
56
|
+
line-length = 100
|
|
57
|
+
target-version = "py39"
|
|
58
|
+
|
|
59
|
+
[tool.ruff.lint]
|
|
60
|
+
select = ["E", "F", "I", "N", "W", "UP"]
|
|
61
|
+
|
|
62
|
+
[tool.mypy]
|
|
63
|
+
python_version = "3.9"
|
|
64
|
+
strict = true
|
|
65
|
+
warn_return_any = true
|
|
66
|
+
warn_unused_configs = true
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""
|
|
2
|
+
cyka-agent — Python SDK for Cykani stealth browser automation.
|
|
3
|
+
|
|
4
|
+
Provides:
|
|
5
|
+
- Browser session management with stealth patches
|
|
6
|
+
- AI agent execution loop (LLM-powered)
|
|
7
|
+
- Tool registry for browser interactions
|
|
8
|
+
- Integration with OpenAI, Hermes, and other LLM providers
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
from cyka_agent import CykaClient, Agent, Browser
|
|
12
|
+
|
|
13
|
+
client = CykaClient(api_url="http://localhost:3001", api_key="your-key")
|
|
14
|
+
session = client.sessions.create(profile_id="profile-123")
|
|
15
|
+
browser = Browser.connect(session.cdp_endpoint)
|
|
16
|
+
browser.goto("https://example.com")
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
__version__ = "0.1.0"
|
|
20
|
+
|
|
21
|
+
from .client import CykaClient
|
|
22
|
+
from .agent import Agent, AgentConfig, AgentResult
|
|
23
|
+
from .browser import Browser, BrowserSession
|
|
24
|
+
from .types import (
|
|
25
|
+
ToolDefinition,
|
|
26
|
+
ToolCall,
|
|
27
|
+
ToolResult,
|
|
28
|
+
ChatMessage,
|
|
29
|
+
CompletionResult,
|
|
30
|
+
TokenUsage,
|
|
31
|
+
Plan,
|
|
32
|
+
Step,
|
|
33
|
+
StepLogEntry,
|
|
34
|
+
PerceptionSnapshot,
|
|
35
|
+
InteractiveElement,
|
|
36
|
+
ProgressEvent,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
# Core
|
|
41
|
+
"CykaClient",
|
|
42
|
+
"Agent",
|
|
43
|
+
"AgentConfig",
|
|
44
|
+
"AgentResult",
|
|
45
|
+
"Browser",
|
|
46
|
+
"BrowserSession",
|
|
47
|
+
# Types
|
|
48
|
+
"ToolDefinition",
|
|
49
|
+
"ToolCall",
|
|
50
|
+
"ToolResult",
|
|
51
|
+
"ChatMessage",
|
|
52
|
+
"CompletionResult",
|
|
53
|
+
"TokenUsage",
|
|
54
|
+
"Plan",
|
|
55
|
+
"Step",
|
|
56
|
+
"StepLogEntry",
|
|
57
|
+
"PerceptionSnapshot",
|
|
58
|
+
"InteractiveElement",
|
|
59
|
+
"ProgressEvent",
|
|
60
|
+
]
|