v4.0.5
Key Feature Updates
TriggerFlow
- Rewrite for each process (
.for_each()) to support nested for each loops perfectly. [Example Code] - Add
.____(<comments>, log_info=<True | False>, print_info=<True | False>, show_value=<True | False>)to help developers to write flow chain beautifully. - Add
.when()to support developers to wait chunk done event, runtime data change event, flow data change event or customize event and trigger the next actions. [Example Code] - Add
.collect()to support developers to wait and collect parallel branches. [Example Code] - Rewrite and update match case process, now developers can use
.match(mode=<"hit_all" | "hit_first">)to set different judgement hit strategy. [Example Code]
You can also explore more example codes in TriggerFlow examples dir.
Prompt Configures
In Agently v3, developers loved YAML-Prompt very much. Now we update this feature to Prompt Configures!
Mappings replacing in any prompt settings
Now developers can use mappings parameter in any prompt setting methods. Use case examples: agent.input("${user_input}", mappings={ "user_input": beautify(user_input) }) or agent.set_agent_prompt("instruct", "You're a ${ role }", mappings={ "role": roles[current_role] }).
Developers can use mapping replacing feature to replace placeholder ${ <variable name> } in string content. Dvelopers can also use it to replace key name or value in dictionary like { "${ key_to_be_replaced }": "${ value_to_be_replaced_directly }" }.
Check here to see Example Code
YAML and JSON format supported!
Now developers can use both YAML and JSON format data to configure agent behaviors!
-
YAML-Prompt Example Code:
-
JSON-Prompt Example Code:
Built-In Tools
We added two built-in tools Search and Browse which can be registered to agent or be used independently. You can use from agently.builtins.tools import Search, Browse to import and use them.
Search tool can search information from DuckDuckGo, Bing, Google, Yahoo, Wikipedia via package ddgs and search document from arXiv.
Browse tool use BeautifulSoup4 to fetch most common website page content for agent.
Check here to see Example Code
Instant Mode
We add a new attribute .wildcard_path to instant mode event data for developers to watch items in list easier. Now developers can use code like if data.wildcard_path == "root_key.list[*]:" to watch and handle every item in root_key.list from Agently agent response in instant mode.
Check here to see Example Code
Other Updates
- Optimized
LazyImportto support the situation when the package's import name is different from the install name. - Optimized tool using logic to catch exceptions when calling the tools instead of preventing the agent request process.
- Many other updates and bug fixes...
=========
We'll keep updating and welcome all users to express your ideas or discuss with us in https://github.com/AgentEra/Agently/discussions
Have fun and happy coding!