When working with custom agents in Narada, you can provide input variables beyond the simple prompt string. This allows for more sophisticated data passing and enables your custom agents to access structured information during execution.
When writing workflow code (e.g., in Agent Studio), input variables are available via the variables dictionary, which is automatically injected at runtime.
Copy
# Access a variable with a default fallbacksearch_term = variables.get("searchTerm", "default value")# Access a variable (raises KeyError if missing)search_term = variables["searchTerm"]
Always prefer variables.get("key", default) over variables["key"] so your workflow can run standalone without input variables.
Copy
from narada import Agent, LocalBrowserWindowfrom pydantic import BaseModelwindow = LocalBrowserWindow()# Use variables.get() with sensible defaults from the recording contexttarget_url = variables.get("targetUrl", "https://example.com/search")search_term = variables.get("searchTerm", "machine learning")max_results = variables.get("maxResults", 10)await window.go_to_url(url=target_url, new_tab=True)class SearchResults(BaseModel): results: list[str]resp = await window.agent( prompt=f"Search for '{search_term}' and extract the top {max_results} result titles", agent=Agent.OPERATOR, output_schema=SearchResults,)
Start with simple input variables and gradually add complexity as your custom agents become more sophisticated. This approach makes debugging easier and helps you understand which variables provide the most value.