Skip to content

Commit

Permalink
Merge pull request #50 from agentsea/dev
Browse files Browse the repository at this point in the history
fix owner bug
  • Loading branch information
pbarker authored Jun 6, 2024
2 parents 091f76f + a195235 commit 78b6b57
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 21 deletions.
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "surfkit"
version = "0.1.196"
version = "0.1.199"
description = "A toolkit for building AI agents that use devices"
authors = ["Patrick Barker <[email protected]>"]
license = "MIT"
Expand All @@ -21,7 +21,7 @@ litellm = "^1.35.8"
tiktoken = "^0.6.0"
rich = "^13.7.1"
agentdesk = "^0.2.84"
taskara = "^0.1.99"
taskara = "^0.1.100"


[tool.poetry.group.dev.dependencies]
Expand Down
24 changes: 19 additions & 5 deletions surfkit/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ def version():


# Root command callback
@app.callback(invoke_without_command=True)
def default(ctx: typer.Context):
show_help(ctx, "root")
def default(
ctx: typer.Context,
debug: bool = typer.Option(False, "--debug", "-d", help="Enable debug mode"),
):
if debug:
logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.INFO)


# 'create' command group callback
Expand Down Expand Up @@ -1439,6 +1444,7 @@ def solve(
from taskara import Task
from taskara.runtime.base import Tracker

from surfkit.config import HUB_API_URL, GlobalConfig
from surfkit.server.models import V1SolveTask
from surfkit.types import AgentType
from surfkit.util import find_open_port
Expand Down Expand Up @@ -1624,8 +1630,6 @@ def solve(
if agent_type:
from typing import List

from surfkit.config import HUB_API_URL, GlobalConfig

all_types: List[AgentType] = []

type_parts = agent_type.split("/")
Expand Down Expand Up @@ -1714,6 +1718,15 @@ def solve(
if starting_url:
params["site"] = starting_url

owner = "[email protected]"
config = GlobalConfig.read()
if config.api_key:
from surfkit.hub import Hub

hub = Hub()
user_info = hub.get_user_info(config.api_key)
owner = user_info.email

task = Task(
description=description,
parameters=params,
Expand All @@ -1722,6 +1735,7 @@ def solve(
assigned_to=agent,
assigned_type=agent_type,
remote=_remote_task_svr,
owner_id=owner,
)

if _device and view:
Expand Down
4 changes: 2 additions & 2 deletions surfkit/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class Hub:
"""The Agentsea Hub"""

def __init__(self, hub_url: str = "https://hub.agentsea.ai") -> None:
self.hub_url = os.getenv("AGENTSEA_HUB_URL", hub_url)
def __init__(self, hub_url: str = "https://api.hub.agentlabs.xyz") -> None:
self.hub_url = os.getenv("AGENTSEA_HUB_API_URL", hub_url)

def get_api_key(self, token: str) -> str:
"""Get the api key from the hub"""
Expand Down
1 change: 1 addition & 0 deletions surfkit/runtime/agent/kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ def solve_task(
def _handle_logs_with_attach(self, agent_name: str, attach: bool):
import typer

print("following logs for agent...")
try:
log_lines = self.logs(name=agent_name, follow=True)

Expand Down
9 changes: 7 additions & 2 deletions surfkit/runtime/agent/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def run(
if not auth_enabled:
environment["AGENT_NO_AUTH"] = "true"

if not agent_type.llm_providers:
if agent_type.llm_providers:
environment["MODEL_PREFERENCE"] = ",".join(
agent_type.llm_providers.preference
)
Expand Down Expand Up @@ -207,6 +207,7 @@ def solve_task(
logger.info("Task successfully posted to the agent.")
if follow_logs:
_task = Task.from_v1(task.task)
print("following logs with attach: ", attach)
self._follow_logs(name, _task, attach)

else:
Expand All @@ -219,7 +220,11 @@ def solve_task(
except requests.exceptions.RequestException as e:
logger.error("Error while sending the POST request:", str(e))
except Exception as e:
logger.error(f"An unexpected error occurred: {str(e)}")
import traceback

logger.error(
f"An unexpected error occurred solving task with runtime {self.name()}: {str(e)} \n{traceback.print_exc()}"
)

def _signal_handler(self, agent_name: str):
def handle_signal(signum, frame):
Expand Down
2 changes: 1 addition & 1 deletion surfkit/runtime/container/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def call(
print(f"Container '{name}' does not exist.")
raise
except Exception as e:
print(f"An unexpected error occurred: {e}")
print(f"An unexpected error occurred calling docker container: {e}")
raise

url = f"http://localhost:{port}{path}"
Expand Down
1 change: 1 addition & 0 deletions surfkit/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class V1Agent(BaseModel):
class V1SolveTask(BaseModel):
task: V1Task
agent: Optional[V1Agent] = None
token: Optional[str] = None


class V1CreateTask(BaseModel):
Expand Down
9 changes: 4 additions & 5 deletions ui/surfkit/src/components/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Collapse,
Typography,
IconButton,
Avatar,
} from "@material-tailwind/react";
import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline";

Expand All @@ -31,7 +30,7 @@ function NavList() {
className="p-1 font-medium"
>
<a
href="https://github.com/agentsea/surfkit"
href="https://kentaurosai.mintlify.app/introduction"
className="flex items-center hover:text-blue-500 transition-colors"
>
Docs
Expand All @@ -56,10 +55,10 @@ export function Nav() {
}, []);

return (
<Navbar className="mx-auto max-w-screen-xl px-6 py-3 w-full min-w-screen-xl">
<div className="flex items-center justify-between text-blue-gray-900">
<Navbar className="mx-auto max-w-screen-xl p-2 lg:rounded-full mt-4 lg:pl-6">
<div className="relative mx-auto flex items-center justify-between text-blue-gray-900">
<img
className="h-10 w-10 rounded-full object-contain object-center rounded-full border border-blue-gray-100 p-1 shadow-xl"
className="h-9 w-9 rounded-full object-contain object-center rounded-full"
src="https://storage.googleapis.com/guisurfer-assets/logo_black.png"
alt="logo"
/>
Expand Down

0 comments on commit 78b6b57

Please sign in to comment.