cyka-agent Python SDK
Python SDK for Cykani stealth browser automation and AI agents.
Installation
pip install cyka-agent
For LLM support:
pip install cyka-agent[llm]
Quick Start
Manual Browser Control
import asyncio
from cyka_agent import Browser
async def main():
browser = await Browser.connect("ws://localhost:9222")
await browser.goto("https://example.com")
await browser.click("#login-button")
await browser.type("#email", "user@example.com")
text = await browser.extract("#content")
print(text)
await browser.disconnect()
asyncio.run(main())
AI Agent (Autonomous)
import asyncio
from cyka_agent import Agent, Browser, AgentConfig
async def main():
browser = await Browser.connect("ws://localhost:9222")
agent = Agent.create(
session=browser._session,
config=AgentConfig(
session_id="",
profile_id="",
goal="Find the cheapest iPhone on Amazon and add to cart",
max_steps=25,
),
)
result = await agent.run_async()
print(result.status) # "success" or "max_steps_exceeded"
print(result.result) # What was accomplished
asyncio.run(main())
Tool-Based (For LLM Integration)
import asyncio
from cyka_agent import Browser, BrowserTools
async def main():
browser = await Browser.connect("ws://localhost:9222")
session = browser._session
tools = BrowserTools(session)
# Get tool definitions for your LLM
tool_defs = tools.get_definitions()
# Use with any LLM (example: OpenAI)
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Navigate to example.com"}],
tools=tool_defs,
)
# Execute the tool call
tool_call = response.choices[0].message.tool_calls[0]
result = await tools.execute(
tool_call.function.name,
eval(tool_call.function.arguments),
)
print(result.output)
asyncio.run(main())
Using with Cykani API
from cyka_agent import CykaClient
client = CykaClient(
api_url="http://localhost:3001",
api_key="your-api-key",
)
# Create a session
session = client.sessions.create(profile_id="profile-123")
print(session.cdp_endpoint) # ws://localhost:9222
# Start the session
session = client.sessions.start(session.id)
# Create and run an agent
agent = client.agents.create(
session_id=session.id,
profile_id="profile-123",
goal="Scrape all product prices",
)
result = client.agents.run(agent["id"])
print(result)
Supported LLM Providers
- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude)
- Any OpenAI-compatible API (Hermes, Groq, etc.)
Environment Variables
CYKANI_API_URL=http://localhost:3001
CYKANI_API_KEY=your-api-key
OPENAI_API_KEY=your-openai-key # For OpenAI adapter
License
Apache-2.0
Metadata
Release files for cyka-agent 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cyka_agent-0.1.1.tar.gz | 14.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cyka_agent-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.2 kB
Release files / cyka_agent-0.1.1.tar.gz
| Download URL | cyka_agent-0.1.1.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12e07200be4911568f252fc8ef9c083c8c1071edc6a96e283a2c94f77771a2d6
|
|
BLAKE2b-256 checksum How to use checksums |
2bcef847bc8f725b24b5b33c0883ca3fef3428534bb8e7fd564a966e60ac2f94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / cyka_agent-0.1.1-py3-none-any.whl
| Download URL | cyka_agent-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d65e8cf6f0792d6a9524f2057d9d7797b5c241df95f09effc66184c4697b1e5b
|
|
BLAKE2b-256 checksum How to use checksums |
25fd32ffdec5527465c5c4c850ba1d250c708f0296335f5a95fd0c103d21f1b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|