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.
For sensitive data (passwords, API keys). The LLM never sees the actual values. Substitution happens after the action plan is generated. Use ${variable_name} syntax in your prompt.
Input Variables
For custom agent parameters. These are visible to the agent and accessible in your custom agent workflow via the variables dictionary.
When calling a custom agent with a simple prompt, the string becomes the $input_as_text variable:
# Simple prompt - becomes $input_as_text variableawait window.agent( prompt="Search for the latest AI research papers", agent="/$USER/my-custom-agent")
In your custom agent workflow, this would be accessible as:
$input_as_text = “Search for the latest AI research papers”
When writing workflow code (e.g., in Agent Studio), input variables are available via the variables dictionary, which is automatically injected at runtime.
# 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.
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,)
Learn how to run multiple custom agents with different input variables simultaneously
Error Handling
Implement robust error handling for custom agent workflows
Structured Output
Structure your output data with JSON schemas
API Reference
Explore the complete Window.agent() API documentation
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.