Skip to main content

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cyka_agent-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cyka_agent-0.1.0-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file cyka_agent-0.1.0.tar.gz.

File metadata

  • Download URL: cyka_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for cyka_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51c9a83999d442674cf2788ef053eeeaabcfd216df1dfe3c525264116afc736b
MD5 b9f34303531453561739fa52a2cc17f2
BLAKE2b-256 540b7a5a23b78f73c02f793c07c4d75898bfcf56eef797f693d0decf88b1bc4c

See more details on using hashes here.

File details

Details for the file cyka_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cyka_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for cyka_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25dca19f5dbb9fcd08955fa6263aa40e2df0a5f5e78f437469f317553a58dd67
MD5 d70e327cf06e1991d77dff4aa6222738
BLAKE2b-256 50227b2f146eb7571a0e38544469c486489dd0050987d829406694af1979ee76

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page