Skip to content

Quickstart

A minimal request:

from agently import Agently

Agently.set_settings(
    "OpenAICompatible",
    {
        "base_url": "http://127.0.0.1:11434/v1",
        "model": "qwen2.5:7b",
    },
)

agent = Agently.create_agent()
print(agent.input("Hello, Agently!").start())

Structured output in 3 lines

result = (
    agent.input("Summarize the project")
    .output({"summary": ("str", "short summary"), "risks": [("str", "risk") ]})
    .start()
)
print(result)

Streaming preview

response = (
    agent.input("Explain recursion")
    .output({"answer": ("str", "final answer")})
    .get_response()
)
for msg in response.get_generator(type="instant"):
    if msg.path == "answer" and msg.delta:
        print(msg.delta, end="", flush=True)
print()

Next steps

  • Output control: examples/step_by_step/03-output_format_control.py
  • Streaming: examples/step_by_step/06-streaming.py
  • Tools: examples/step_by_step/07-tools.py
  • TriggerFlow: examples/step_by_step/11-triggerflow-01_basics.py