Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: AgentEra/Agently
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.4.0.3
Choose a base ref
...
head repository: AgentEra/Agently
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Oct 28, 2024

  1. Copy the full SHA
    28e3ef0 View commit details
  2. Copy the full SHA
    04430bf View commit details
  3. Copy the full SHA
    513771e View commit details
  4. update: remove event ".$complete" and add event ".$delta" for string …

    …items so string items without ".$delta" mark can return complete value like other items.
    Maplemx committed Oct 28, 2024
    Copy the full SHA
    8670c04 View commit details
  5. Copy the full SHA
    646afb3 View commit details
  6. Copy the full SHA
    4d5401c View commit details
  7. Copy the full SHA
    d67b4e5 View commit details
  8. update: support instant expression with ?* or ?_ to include all i…

    …tems in specific index position
    Maplemx committed Oct 28, 2024
    Copy the full SHA
    19f4cef View commit details
  9. Update README.md

    Shreyas0410 authored Oct 28, 2024
    Copy the full SHA
    b9e65d5 View commit details

Commits on Oct 30, 2024

  1. Copy the full SHA
    1bc2809 View commit details
  2. Merge pull request #180 from Maplemx/dev

    v3.4.0.4
    Maplemx authored Oct 30, 2024
    Copy the full SHA
    e3025fd View commit details
  3. Merge pull request #178 from Shreyas0410/Shreyas0410-broken_link

    Fixed broken link in Readme.md
    Maplemx authored Oct 30, 2024
    Copy the full SHA
    a318791 View commit details

Commits on Nov 1, 2024

  1. Merge pull request #179 from ghimirebibek/patch-1

    refactor: Refactored Status.py
    Maplemx authored Nov 1, 2024
    Copy the full SHA
    f2a45e8 View commit details

Commits on Nov 8, 2024

  1. update:

    1. set default retry times to 0 for clear error log;
    2. use kwargs as initial storage when attach a workflow as an
    new alias.
    Maplemx committed Nov 8, 2024
    Copy the full SHA
    f08e391 View commit details

Commits on Nov 9, 2024

  1. Merge pull request #182 from Maplemx/main

    update
    Maplemx authored Nov 9, 2024
    Copy the full SHA
    7e09012 View commit details

Commits on Nov 14, 2024

  1. Copy the full SHA
    a1e6a75 View commit details
  2. update: optimize tool using results so developers can use tool name i…

    …n prompt to specify target result
    Maplemx committed Nov 14, 2024
    Copy the full SHA
    47f27b3 View commit details
  3. Copy the full SHA
    d7ea560 View commit details
  4. Copy the full SHA
    6bd0057 View commit details
  5. Merge pull request #183 from Maplemx/dev

    v3.4.0.5
    Maplemx authored Nov 14, 2024
    Copy the full SHA
    80cba54 View commit details

Commits on Dec 7, 2024

  1. Copy the full SHA
    d89fc87 View commit details
  2. Copy the full SHA
    b1fa5b8 View commit details
  3. Copy the full SHA
    272d23e View commit details
  4. Copy the full SHA
    f5ad46b View commit details
  5. Copy the full SHA
    9048bb6 View commit details
  6. Merge pull request #186 from Maplemx/dev

    v3.4.1.0
    Maplemx authored Dec 7, 2024
    Copy the full SHA
    6988ae8 View commit details

Commits on Dec 13, 2024

  1. Copy the full SHA
    03f33b4 View commit details
  2. Copy the full SHA
    3b73ea2 View commit details
  3. Copy the full SHA
    8151d6e View commit details
  4. Copy the full SHA
    991b816 View commit details
  5. Copy the full SHA
    f3283a4 View commit details
  6. Copy the full SHA
    a0dd3a2 View commit details
  7. Merge pull request #187 from Maplemx/dev

    v3.4.1.1
    Maplemx authored Dec 13, 2024
    Copy the full SHA
    3c9e9b5 View commit details

Commits on Jan 23, 2025

  1. Copy the full SHA
    ce73054 View commit details

Commits on Jan 28, 2025

  1. Merge pull request #191 from cnbeining/main

    fest: Add LiteLLM to provide generic support for providers
    Maplemx authored Jan 28, 2025
    Copy the full SHA
    b2a14ab View commit details

Commits on Jan 30, 2025

  1. Copy the full SHA
    9440e98 View commit details
  2. Copy the full SHA
    14d6d72 View commit details
  3. Copy the full SHA
    bc5f632 View commit details
  4. Copy the full SHA
    560e792 View commit details
  5. update: add litellm

    Maplemx committed Jan 30, 2025
    Copy the full SHA
    84bb3b0 View commit details

Commits on Feb 7, 2025

  1. Copy the full SHA
    ec2c451 View commit details
  2. Copy the full SHA
    7e5811c View commit details
  3. Copy the full SHA
    75bdeb5 View commit details

Commits on Feb 8, 2025

  1. Copy the full SHA
    224c72a View commit details
  2. Copy the full SHA
    f8538f0 View commit details

Commits on Feb 11, 2025

  1. Copy the full SHA
    708f64d View commit details
  2. Merge branch 'main' into dev

    Maplemx authored Feb 11, 2025
    Copy the full SHA
    8cef687 View commit details
  3. Merge pull request #192 from AgentEra/dev

    update: add support of DeepSeek Reasoner model official API data format
    Maplemx authored Feb 11, 2025
    Copy the full SHA
    596dc92 View commit details
  4. update: add litellm

    Maplemx committed Feb 11, 2025
    Copy the full SHA
    3ab6734 View commit details
  5. Copy the full SHA
    3fb81d1 View commit details
15 changes: 3 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,42 +1,33 @@
# 忽略系统文件
.DS_Store
.AppleDouble
.Trashes

# 忽略编译文件和二进制文件
*.o
*.a
*.exe
*.pyc

# 忽略日志文件和备份文件
*.log
*.bak
*.swp

# 忽略临时文件
*.tmp
*.temp

# 忽略依赖和缓存文件
node_modules
.cache
.npmignore
__pycache__

# 忽略上传和下载文件
.download
.upload

# 自定义忽略文件和文件夹
test.py
test.js
private_settings
myenv
test
*test*
*_old

# 忽略PyCharm
.idea/

# ignore framework auto-create dir
.Agently
dist
48 changes: 24 additions & 24 deletions Agently/Agent/Agent.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import threading
import queue
from ..Request import Request
from ..utils import RuntimeCtx, RuntimeCtxNamespace, StorageDelegate, PluginManager, AliasManager, ToolManager, IdGenerator, DataGenerator,check_version, load_json
from ..utils import RuntimeCtx, RuntimeCtxNamespace, StorageDelegate, PluginManager, AliasManager, ToolManager, IdGenerator, DataGenerator, check_version, load_json

class Agent(object):
def __init__(
@@ -17,7 +17,7 @@ def __init__(
global_websocket_server: object,
parent_plugin_manager: object,
parent_settings: object,
is_debug: bool=False
is_debug: bool=None,
):
# Integrate
self.global_storage = global_storage
@@ -39,7 +39,8 @@ def __init__(
parent_settings = self.settings,
)
# Debug
self.settings.set("is_debug", is_debug)
if is_debug:
self.settings.set("is_debug", is_debug)
# Agent Id
if agent_id == None or agent_id == "":
self.agent_id = IdGenerator("agent").create()
@@ -156,11 +157,11 @@ def __init__(self, agent: object):
self.get_debug_status = lambda: self.agent.settings.get_trace_back("is_debug")
self.settings = RuntimeCtxNamespace(f"plugin_settings.agent_component.{ name }", self.agent.settings)

def start_workflow(self, init_inputs: dict=None, init_storage: dict={}):
if not isinstance(init_storage, dict):
raise Exception("[Workflow] Initial storage must be a dict.")
init_storage.update({ "$agent": self.agent })
return workflow.start(init_inputs, storage=init_storage)
def start_workflow(self, init_inputs: dict=None, **kwargs):
if not kwargs:
kwargs = {}
kwargs.update({ "$agent": self.agent })
return workflow.start(init_inputs, storage=kwargs)

def export(self):
return {
@@ -171,6 +172,8 @@ def export(self):
return self.register_agent_component(name, AttachedWorkflow)

async def start_async(self, request_type: str=None, *, return_generator:bool=False):
if return_generator:
return self.get_delta_generator()
try:
is_debug = self.settings.get_trace_back("is_debug")
# Auto Save Agent runtime_ctx
@@ -264,14 +267,12 @@ async def handle_response(response):

await handle_response({ "event": "response:finally", "data": self.request.response_cache })

if return_generator:
self.request_runtime_ctx.empty()
return self.response_generator.start()
else:
self.request_runtime_ctx.empty()
return self.request.response_cache["reply"]
self.request_runtime_ctx.empty()
return self.request.response_cache["reply"]
except Exception as e:
retry_time = self.settings.get_trace_back("request.retry_times", 2)
retry_time = self.settings.get_trace_back("request.retry_times")
if not isinstance(retry_time, int):
retry_time = 0
retry_count = self.request_runtime_ctx.get_trace_back("retry_count", 0)
if retry_count >= retry_time:
self.response_generator.end()
@@ -285,6 +286,8 @@ async def handle_response(response):
return await self.start_async(request_type, return_generator=return_generator)

def start(self, request_type: str=None, *, return_generator:bool=False):
if return_generator:
return self.get_delta_generator()
reply_queue = queue.Queue()
is_debug = self.settings.get_trace_back("is_debug")
def start_in_theard():
@@ -304,15 +307,12 @@ def start_in_theard():
loop.close()
theard = threading.Thread(target=start_in_theard)
theard.start()
if return_generator:
return self.response_generator.start()
else:
theard.join()
try:
reply = reply_queue.get_nowait()
except:
reply = None
return reply
theard.join()
try:
reply = reply_queue.get_nowait()
except:
reply = None
return reply

def start_websocket_server(self, port:int=15365):
is_debug = self.settings.get_trace_back("is_debug")
58 changes: 58 additions & 0 deletions Agently/Stage/EventEmitter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from .Stage import Stage

class EventEmitter:
def __init__(self, private_max_workers=None, max_concurrent_tasks=None, on_error=None):
self._listeners = {}
self._once = {}
self._stage = Stage(
private_max_workers=private_max_workers,
max_concurrent_tasks=max_concurrent_tasks,
on_error=on_error,
is_daemon=True,
)

def add_listener(self, event, listener):
if event not in self._listeners:
self._listeners.update({ event: [] })
if listener not in self._listeners[event]:
self._listeners[event].append(listener)
return listener

def remove_listener(self, event, listener):
if event in self._listeners and listener in self._listeners[event]:
self._listeners[event].remove(listener)

def remove_all_listeners(self, event_list):
if isinstance(event_list, str):
event_list = [event_list]
for event in event_list:
self._listeners.update({ event: [] })

def on(self, event, listener):
return self.add_listener(event, listener)

def off(self, event, listener):
return self.remove_listener(event, listener)

def once(self, event, listener):
if event not in self._once:
self._once.update({ event: [] })
if listener not in self._listeners[event] and listener not in self._once[event]:
self._once[event].append(listener)
return listener

def listener_count(self, event):
return len(self._listeners[event]) + len(self._once[event])

def emit(self, event, *args, **kwargs):
listeners_to_execute = []
if event in self._listeners:
for listener in self._listeners[event]:
listeners_to_execute.append((listener, args, kwargs))
if event in self._once:
for listener in self._once[event]:
listeners_to_execute.append((listener, args, kwargs))
self._once.update({ event: [] })
for listener, args, kwargs in listeners_to_execute:
self._stage.go(listener, *args, **kwargs)
return len(listeners_to_execute)
27 changes: 27 additions & 0 deletions Agently/Stage/MessageCenter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import uuid
from .Stage import Stage

class MessageCenter:
def __init__(self, private_max_workers=None, max_concurrent_tasks=None, on_error=None):
self._stage = Stage(
private_max_workers=private_max_workers,
max_concurrent_tasks=max_concurrent_tasks,
on_error=on_error,
is_daemon=True
)
self._consumers = {}

def register_consumer(self, handler):
consumer_id = uuid.uuid4()
self._consumers.update({ consumer_id: handler })
return consumer_id

def remove_consumer(self, consumer_id):
del self._consumers[consumer_id]

def put(self, data):
for _, consumer_handler in self._consumers.items():
self._stage.go(consumer_handler, data)

def close(self):
self._stage.close()
Loading