Skip to main content
The current Narada SDK uploads file attachments automatically when you pass a file-like object to Agent.run(attachment=...) or input_variables={...}. You do not need to call a separate public upload_file() method.
Attachments are useful for document analysis, data extraction, and workflows where the agent needs to process file content.

Method Signature

async def run(
    self,
    prompt: str,
    *,
    attachment: File | IO[Any] | None = None,
    ...
) -> AgentResponse

Parameters

attachment
File | IO[Any] | None
default:"None"
A file-like object opened in binary read mode, or a File object returned by a lower-level upload flow.
with open("/path/to/document.pdf", "rb") as f:
    response = await agent.run(
        prompt="Summarize the attached document.",
        attachment=f,
    )

Return Value

Agent.run() returns an AgentResponse. For text responses, read response.text. For structured output, read response.structured_output.

Example

import asyncio

from narada import Agent, AgentKind, BrowserEnvironment

async def main():
    env = BrowserEnvironment()
    agent = Agent(environment=env, kind=AgentKind.CORE_AGENT)

    try:
        with open("/path/to/report.pdf", "rb") as f:
            response = await agent.run(
                prompt="Summarize the key points from the attached report.",
                attachment=f,
            )

        print(f"Summary: {response.text}")
    finally:
        await env.close()

if __name__ == "__main__":
    asyncio.run(main())
You can also pass file-like objects inside input_variables; the SDK uploads them before dispatching the request.