Skip to content

Examples

Quick run

from agents.prebuilt import ReWOOAgent
agent = ReWOOAgent(model="claude-sonnet-4")
print(agent.solve("Summarize the last 3 NYT top stories"))
````

## Build your own

```python
from agents.standard_agent import StandardAgent
from agents.llm.litellm import LiteLLM
from agents.tools.jentic import JenticClient
from agents.memory.dict_memory import DictMemory
from agents.reasoner.sequential.reasoner import SequentialReasoner
from agents.reasoner.sequential.planners.bullet_list import BulletListPlan
from agents.reasoner.sequential.executors.rewoo import ReWOOExecuteStep
from agents.reasoner.sequential.reflectors.rewoo import ReWOOReflect
from agents.reasoner.sequential.summarizer.default import DefaultSummarizeResult

llm = LiteLLM(model="gpt-4o")
tools = JenticClient()
memory = DictMemory()

reasoner = SequentialReasoner(
  llm=llm, tools=tools, memory=memory,
  plan=BulletListPlan(llm=llm),
  execute_step=ReWOOExecuteStep(llm=llm, tools=tools, memory=memory),
  reflect=ReWOOReflect(llm=llm, tools=tools, memory=memory, max_retries=5),
  summarize_result=DefaultSummarizeResult(llm=llm)
)

agent = StandardAgent(llm=llm, tools=tools, memory=memory, reasoner=reasoner)
print(agent.solve("Translate this to Sith: Hope is not lost."))