Introduction to Realm and its Provisions
At the heart of donew lies a powerful concept called “realms” - your gateway to creating sophisticated AI workflows with clarity and purpose.
Understanding Realms
A realm in donew represents a collection of capabilities or “provisions” that you grant to your AI tasks. Think of realms as specialized toolkits that your AI can access to accomplish specific goals. Whether it’s browsing the web, running computations, or analyzing data, realms define what your AI can do.
Key Concepts
- Realm Definition: A realm is defined using the
.realm()
method, where you specify which provisions (tools and capabilities) are available to your task.
from donew import DO, LiteLLMModel
model = LiteLLMModel(model_id="gpt-4o-mini")
super_doer = (DO.New(model, name="WebResearcher", purpose="Research topics on the web")
.realm([DO.Browse(headless=False)])
.envision(output_model)
.enact("Research the latest AI developments"))
-
Built-in Realms: donew comes with powerful built-in realms:
DO.Browse
for web browsing and interactionMCPRun
for leveraging MCP.run servlets- And many more specialized provisions
-
Composability: Donews can be composed both horizontally and vertically:
- Combine multiple donews side by side within a realm
- Nest donews within other donews for complex workflows
- Create reusable, modular task components
Why Realms Matter
Realms embody several core design principles that make donew powerful:
- Isolation: Each realm operates independently, preventing state contamination
- Clarity: Clear separation of responsibilities makes debugging easier
- Flexibility: Mix and match realms to create sophisticated workflows
- Reproducibility: Tasks using realms can be broken down into discrete, reusable steps
Getting Started with Realms
The simplest way to start with realms is to use one of the built-in provisions:
# Create a basic web browsing task
browser_task = (DO.New(model, name="Browser")
.realm([DO.Browse()])
.enact("Visit example.com and get the main heading"))
# Use MCP.run servlets
mcp_task = (DO.New(model, name="Calculator")
.realm([MCPRun(profile="your-profile", task="your-task")])
.enact("Calculate complex equations"))
As you become more comfortable, you can combine realms and create more complex workflows:
# Combine multiple realms
advanced_task = (DO.New(model, name="ResearchAnalyzer")
.realm([
DO.Browse(),
MCPRun(task="analyze_data"),
your_custom_realm
])
.envision(output_model)
.enact("Research and analyze market trends"))
Next Steps
Now that you understand the basics of realms, you’re ready to:
- Explore our built-in provisions in detail such as DO.Browse
- Learn about composing tasks
- Check out practical examples
- Dive into advanced use cases
Welcome to a new way of building AI workflows with donew!