Skip to main content
This tutorial shows you how to build an Amazon Bedrock agent that creates a real Excel file when you ask for a spreadsheet, and replies with the download link. The model decides when to call Doconda; you only wire up the tools.

What you need

  • An AWS account with a Bedrock model enabled, and its ID in BEDROCK_MODEL_ID.
  • AWS credentials in your environment (AWS_REGION, AWS_ACCESS_KEY_ID…), as for the rest of your code.
  • A Doconda API key in DOCONDA_API_KEY. Create one in the dashboard, under API keys.
  • Python 3.9 or later, or Node 20 or later.

Build the agent

1

Install the dependencies

2

Connect the tools and ask for the Excel file

tools() returns Doconda’s tools (create_document, edit_document, convert_file, upload_file, get_document…), each with a name, a description and a JSON Schema. Bedrock takes them as toolSpec. Create agent.py (or agent.mts):
In Python, the loop is the Converse API’s: while the model asks for a tool (stopReason == "tool_use"), you run it and send the result back. In TypeScript, the AI SDK runs that loop for you.
3

Run it

Result

The model calls create_document with format: "xlsx". The tool waits until the file is ready and returns something like this, which the model passes on in its reply:
You get the Excel file, with real formulas and its assumptions in their own cells, and a PDF version. The links expire after 5 minutes; if the user asks for them later, the agent calls get_document and gets fresh ones.
The tool returns only when the document is finished: about a minute at quality: "fast", a few minutes at standard.

Next steps

Use the Bedrock guide

The full integration, also with the Converse API in TypeScript.

Get Excel formulas right

What Doconda checks in a generated spreadsheet.

Call the Python SDK directly

Every method, to call Doconda without an agent.