
English Introduction | δΈζδ»η»
Speed Up Your GenAI Application Development
Agently is a Python-based framework for building GenAI applications. You can install it via pip and import features using from agently import Agently
.
Install via pip:
pip install agently==4.0.0b1
Clone the repository and install locally:
git clone git@github.com:AgentEra/Agently.git
cd Agently
pip install -e .
Agently aims to provide an intuitive, efficient, and developer-friendly framework for GenAI application development. By deeply understanding the runtime control needs of model outputs, Agently bridges the gap between large language models and real-world applications.
Agently abstracts away the complexities of:
- Varying model parameters
- Output formatting
- Communication between engineering modules and GenAI logic
...while giving developers full control over business logic and integration with existing systems.
We believe GenAI is not a generational replacement for current systems but a powerful extension. Engineers and tools are key to turning GenAI's possibilities into reality.
Our mission is to build the best developer experience (DX) for GenAI application engineers.
Agently allows you to control and consume model outputs using a developer-centric pattern:
from agently import Agently
agent = Agently.create_agent()
(
agent
.input("What time is it now?", always=True)
.info({
"default_timezone": "",
"tool_list": [{
"name": "get_current_time",
"desc": "Get current time by time zone provided",
"kwargs": {
"timezone_str": (str, "time zone string in ZoneInfo()"),
},
}]
})
.output({
"first_time_response": (str, ),
"tool_using_judgement": (bool, ),
"tool_using_command": (
{
"name": (str, "Decide which tool to use by tool name:{tool_list.[].name}"),
"kwargs": (dict, "According {tool_list.[].args} to output kwargs dictionary"),
},
"If {tool_using_judgement}==False, just output {}",
),
})
)
Then, consume the model response:
response = agent.get_response()
# Get raw output
response_text = response.get_text()
# Get parsed structured result
response_dict = response.get_result()
# Streamed output
for delta in response.get_generator(content="delta"):
print(delta, end="", flush=True)
Or use the instant parsing mode:
instant_response_generator = response.get_generator(content="instant")
use_tool = False
for instant_message in instant_response_generator:
if instant_message.path == "first_time_response":
if instant_message.delta is not None:
print(instant_message.delta, end="", flush=True)
elif instant_message.path == "tool_using_judgement":
use_tool = instant_message.value
print()
if use_tool:
print("[USE TOOL!]")
else:
print("[NO NEED TO USE TOOL!]")
if use_tool:
if instant_message.path == "tool_using_command.name" and instant_message.is_complete:
print(f"I want to use: '{ instant_message.value }'")
elif instant_message.path == "tool_using_command":
print(f"call: { instant_message.value }")
print(f"kwargs: { instant_message.value }")
I can check the current time for you. Please specify a timezone (e.g., 'America/New_York') so I can provide the accurate time.
[NO NEED TO USE TOOL!]
Click Here to Apply or Scan the QR Code Below: