What it is
AutoTally speaks the open A2A 1.0 (Agent2Agent) protocol. If you run your own agent - an ERP assistant, an ops bot, anything that can act as an A2A client - you can connect it to AutoTally and let it ask what a teammate could ask in chat: balances, outstandings, P&L, GST figures, party history. If you allow it, it can also draft or post entries.
The agent card, which describes what AutoTally offers, lives at
https://relay.autotally.ai/.well-known/agent-card.json.
Create a key
- Open Connected agents in your workspace and choose Connect an agent.
- Give it a name, pick a scope (below), choose which companies it can see (or All companies, including ones added later), and list the hostnames it may receive push notifications on, if any.
- A panel titled Give this to the other side appears with the card URL, the key, and a code sample. Copy the key now; it is shown only once. Rotating the key later issues a new one and kills the old one immediately.
- Use Test on the row to send one real question through the connection. It spends a few credits.
Scopes
- Read - answers questions only. It cannot change anything.
- Propose - can also draft entries. Each lands in your Inbox as pending until a person approves it.
- Write - drafted entries are approved automatically on the authority of the person who granted it. Only someone allowed to approve and auto-approve entries can create or upgrade to this scope, and anything that trips a money safety check still waits for a person.
A connected agent only ever sees the companies you picked. Your workspace's posting rules still apply to everything it drafts. What it can do beyond drafting depends on its scope and skills (see "What a write key can do on its own" below). With the Documents skill it can read your documents for its companies, and a propose or write key can also send files (below).
Each key can also be limited to some skills (Books Q&A, Reports, Parties and collections, Vouchers, Masters, Documents, Typed asks). Your agent's extended card lists exactly the skills its key holds.
What a write key can do on its own
A write key acts without a person approving each step. Every time it acts, AutoTally re-checks that the person who created the key still has the matching permission. If they have left, or lost that permission, the action is refused.
- Chase a customer. With the Parties and collections skill, a write key can send one payment reminder, using your own template and the reconciled amount. A propose key can only preview one. Batch reminders always wait for a person. A connected agent sees a customer's contact with only its last four characters, and a failed send tells it a plain reason, never the mail provider's own message. Each agent is limited to 200 reminders and 500 previews in any 24 hours. Reminders go out only through connections its key reaches: a connection that belongs to the whole workspace, including AutoTally's own WhatsApp account, needs a key that covers all companies.
- Run a collections routine that someone in your team has already set up. Routine runs count towards the same daily limits, and a run that would contact more parties than the agent has left is refused before anything is sent. Its test runs never count towards arming the routine; only a preview a person saw does.
- Teach and revoke posting rules, and propose playbooks. This needs the Vouchers (write) skill. A connected agent's rules always apply to one company, and a key can revoke only the rules it taught. A rule it teaches never replaces a workspace-wide rule: a company rule is added beside it instead, so retiring a workspace rule stays a person's decision. Workspace-wide playbooks need a key that covers all companies. A connected agent sees which rules and playbooks it wrote itself; ones written by your other connected agents show only as "a connected agent".
- Use connected accounts (Gmail, email, WhatsApp). This needs Parties and collections. Read keys can read. Propose keys can ask to change something, and the request waits in your Inbox for up to seven days until a person with approval rights decides it. The Inbox card shows everything the agent asked for and which connection it will use, and approving re-checks that the key still allows it. Write keys can change and send directly, up to 200 actions (changes and sends together) in any 24 hours. If a send's outcome is unknown, the agent is told it may already have gone out and not to send it again. A connection that belongs to the whole workspace needs a key that covers all companies, and your personal connections are never used.
- Templates and opt-outs can be read by any key with Parties and collections. Changing them needs a write key that covers all companies. A connected agent can never remove an opt-out.
Everything a connected agent creates is labelled Connected agent: on the Rules, Playbooks, party history, templates, opt-outs and Inbox screens.
Keys created before these abilities arrived, with no skills chosen, gained them automatically for their scope. Limit the key's skills if you do not want that.
Calling it
With the official SDK:
import { ClientFactory, JsonRpcTransportFactory } from "@a2a-js/sdk/client";
import { SendMessageRequest } from "@a2a-js/sdk";
const KEY = process.env.AUTOTALLY_KEY;
const fetchImpl = (u, init) => fetch(u, { ...init, headers: { ...Object.fromEntries(new Headers(init?.headers)), authorization: `Bearer ${KEY}` } });
const factory = new ClientFactory({ transports: [new JsonRpcTransportFactory({ fetchImpl })] });
const client = await factory.createFromUrl("https://relay.autotally.ai/.well-known/agent-card.json", "");
const res = await client.sendMessage(SendMessageRequest.fromJSON({ message: { messageId: crypto.randomUUID(), role: "ROLE_USER", parts: [{ text: "What is our cash balance?" }] } }));
Or raw JSON-RPC:
curl -s https://relay.autotally.ai/a2a -H "authorization: Bearer $KEY" -H "content-type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"SendMessage","params":{"message":{"messageId":"'$(uuidgen)'","role":"ROLE_USER","parts":[{"text":"What is our cash balance?"}]}}}'
SendMessage waits up to 20 seconds and then returns the task as it stands (usually still working). Pass
"configuration":{"returnImmediately":true} to return at once. Use GetTask, ListTasks and
CancelTask to follow up. Follow-up questions go on the same contextId. To watch the answer as it is written, see "Streaming" below.
Sometimes AutoTally needs one thing from you first; see "When AutoTally asks you a question".
Sending files
A propose or write key with the Documents skill can attach files: PDF, PNG, JPEG, WEBP, HEIC, Excel
(XLSX or XLS), CSV or Word (DOCX). Up to 10 a message, 25 MB each. Send the bytes as a raw part
(base64) or a public https link as a url part:
const res = await client.sendMessage(SendMessageRequest.fromJSON({ message: {
messageId: crypto.randomUUID(), role: "ROLE_USER",
parts: [
{ text: "File this bill for Acme Traders" },
{ raw: pdfBytes.toString("base64"), mediaType: "application/pdf", filename: "bill.pdf" },
],
} }));
We check what each file really is; the type you declare is not used. Links must be https, publicly
reachable and must not redirect (send the final address). The files are filed to the company in use
(name it, or pass metadata.companyGuid; a key on one company needs neither). Anything drafted from
them waits for a person to approve. The result's data part lists the stored documents. A request with
files can be up to 48 MB; send larger sets as links.
Receiving documents
Ask for an invoice, note, voucher or ledger statement and AutoTally prints it from the books. A key with
the Documents skill gets the file back in the result artifact as a raw part, with its mediaType and
filename:
for (const part of task.artifacts[0].parts) {
if (part.raw) fs.writeFileSync(part.filename, Buffer.from(part.raw, "base64"));
}
If your client reads only text and data parts, the file is still yours. The data part's printed
list names every document the turn produced, with attached and a fetch that gets it again:
{ "documentId": "…", "attached": true, "filename": "Tax Invoice 42.pdf", "mediaType": "application/pdf",
"fetch": "GET https://relay.autotally.ai/v1/documents/generated/…",
"auth": "Authorization: Bearer <the key you call /a2a with>" }
Call fetch with the same key you call /a2a with. It answers JSON whose url downloads the file and
expires shortly after, so fetch it when you need it rather than storing the link. A file over 5 MB, or past
10 MB for the whole reply, is listed but not attached; a purchase's uploaded original is always listed,
never attached. Only documents of companies on your key are sent or listed.
Streaming
SendStreamingMessage (JSON-RPC) or POST /a2a/v1/message:stream sends a message and keeps the
connection open as text/event-stream. You get the task first, then the answer's text in pieces
(artifactUpdate, append: true after the first piece), then the complete result (lastChunk: true,
replacing the pieces) and one final statusUpdate (TASK_STATE_COMPLETED, another final state, or
TASK_STATE_INPUT_REQUIRED). The stream closes after that status. Only the artifact marked
lastChunk: true is the result: text streamed by a turn that then asked you a question, or is waiting on
another agent, is provisional, and the next turn streams under a new artifact id.
SubscribeToTask (JSON-RPC, {"id": "<task id>"}) or POST /a2a/v1/tasks/<id>:subscribe reconnects
to a task you started. A finished task is returned once. Closing the connection does not cancel the
task; use CancelTask for that.
for await (const event of client.sendMessageStream(SendMessageRequest.fromJSON({
message: { messageId: crypto.randomUUID(), role: "ROLE_USER", parts: [{ text: "What is our cash balance?" }] },
}))) {
if (event.payload?.$case === "artifactUpdate") console.log(event.payload.value.artifact.parts);
if (event.payload?.$case === "statusUpdate") console.log(event.payload.value.status.state);
}
You can have up to 10 streams open per key. A comment line (: keepalive) arrives every 15 seconds. A
stream is closed after 20 minutes, and when AutoTally is redeployed, without a final status; subscribe
again. If the business turns connected agents off while you are streaming, the stream ends within about
15 seconds with an error event (a2a_disabled_for_workspace), even mid-answer.
Polling or push
Poll GetTask until the state is TASK_STATE_COMPLETED or another final state, or register a push
endpoint with CreateTaskPushNotificationConfig (up to 3 per task, https only, on a hostname you
listed on the key; not allowed on a finished task). The response includes a signing secret, shown once.
You can also send the push config with the message itself, in
configuration.pushNotificationConfig (url, optional token). It is checked by the same rules; if it
is invalid the message is refused and no task is created. Resending the same messageId does not add a
second config. If you put authentication.credentials in the config, that value is your signing secret.
Otherwise one is generated for you: read it with GetTaskPushNotificationConfig.
Each push is a POST with:
X-AutoTally-Signature: sha256=<hex>- HMAC-SHA256 of the exact request body with your secretX-AutoTally-Event-Id- the same on retries, so you can de-duplicateX-A2A-Notification-Token- the token you supplied, if any
Failed deliveries retry after 1, 5 and 30 minutes. Treat a push as a hint and call GetTask.
import { createHmac, timingSafeEqual } from "node:crypto";
function verify(rawBody, header, secret) {
const want = "sha256=" + createHmac("sha256", secret).update(rawBody).digest("hex");
return header?.length === want.length && timingSafeEqual(Buffer.from(header), Buffer.from(want));
}
When AutoTally asks you a question
If AutoTally cannot continue without something only you know (which company, which period, which of
two parties), the task stops in TASK_STATE_INPUT_REQUIRED. The question is in status.message. A
blocking SendMessage returns as soon as that happens, and a push is sent if you registered one. Answer
it by sending a message that names the task:
curl -s https://relay.autotally.ai/a2a -H "authorization: Bearer $KEY" -H "content-type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"SendMessage","params":{"message":{"messageId":"'$(uuidgen)'","role":"ROLE_USER","taskId":"<task id>","contextId":"<context id>","parts":[{"text":"FY 2025-26"}]}}}'
The same task continues and ends COMPLETED (or asks again). You have 24 hours; after that the task
fails with reason input_timeout. Resending the same messageId is safe and starts nothing new. Only
a task that is waiting for your answer accepts one: a finished task answers -32004, so send a new
message on the same contextId instead. An answer carries text or data only; send files in a new message.
If you include contextId, it must be the task's.
A task can also stay TASK_STATE_WORKING for longer than a turn: AutoTally asked another agent and is
waiting for its reply. Keep polling, or use push; it finishes when that reply arrives, or fails with
consult_timeout. If you send a new message on the same contextId meanwhile, the waiting task
completes with what it has, and a reply that arrives later is used for your new message.
Errors you will see
| Code | HTTP | Meaning |
|---|---|---|
-32040 |
401 | Missing, unknown or revoked key |
-32041 |
403 | The connected agent is disabled, or the business has turned connected agents off (a2a_disabled_for_workspace) |
-32042 |
429 | Over 120 requests a minute, or more than 2 messages with files still being stored for this key (8 across all agents), or more than 10 open streams on this key; wait for Retry-After |
-32600 |
413 / 400 | Request invalid or over 1 MB |
-32601 |
200 | Unknown method (only A2A 1.0 names, e.g. SendMessage) |
-32602 |
200 | Invalid parameters, an invalid typed ask (the message names the field), or a messageId reused with different content |
-32001 |
200 | Task not found (also a taskId that is not one of yours) |
-32002 |
200 | Task cannot be canceled |
-32004 |
200 | A taskId naming a task that has finished or is not waiting for your answer, a typed ask without the Typed asks skill, or text from a typed-only key |
-32005 |
400 / 200 | Content type not supported: a wrong request Content-Type (400), or a file we do not accept, a key that may not send files, or a file in an answer to a question (200 in JSON-RPC, 400 in HTTP+JSON) |
-32009 |
200 | Only A2A version 1 is supported |
Transport problems (401, 403, 429, 413) use real HTTP statuses; other JSON-RPC errors come back as HTTP 200
with an error object. Current SDK versions have no typed error for 401, 403 or 429, so check the
statusCode or envelopeCode on the thrown error. A task can also finish FAILED or REJECTED with a
reason such as wallet_empty, timeout, hop_limit, input_timeout (a question went unanswered for 24 hours) or consult_timeout (another agent AutoTally asked did not answer in time). A task with files can also end REJECTED (company_required_for_files) or FAILED (attachment_quota, or attachment_failed when a file could not be stored, including when storing them took longer than 15 minutes).
Verifying our card
Our agent card is signed (JWS, EdDSA over the RFC 8785 canonical JSON of the card without signatures). Fetch the public key from /.well-known/a2a-jwks.json on the same origin and match the signature's kid. A card that fails to verify did not come from us.
Limits
120 requests a minute per connected agent; 1 MB per request (48 MB with files); 10 files a message, 25 MB each; 2 messages with files in flight per agent; a hop limit of 3 (set metadata.hop when
one agent calls another, so loops are cut off); a blocking send waits 20 seconds; a single answer is
given up to 9 minutes.
Choosing a company
Name the company in your text ("What is Acme Traders' cash balance?") or pass its id in
metadata.companyGuid. Once chosen, the company stays chosen for that contextId until you name
another one. If it is unclear which company you mean (for example, you name two), AutoTally asks: usually
the task stops in TASK_STATE_INPUT_REQUIRED, and you answer with the task's id as in "When AutoTally
asks you a question" (naming the company in the answer chooses it). If the answer simply asks in its text,
reply on the same contextId. A company outside the key is refused.
Typed asks (System One)
For a figure your agent will compute with, ask a typed question instead of prose. Send exactly ONE data part;
the answer comes back in the same SendMessage response, with no language model involved:
curl -s https://relay.autotally.ai/a2a -H "authorization: Bearer $KEY" -H "content-type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"SendMessage","params":{"message":{"messageId":"'$(uuidgen)'","role":"ROLE_USER",
"metadata":{"companyGuid":"<company guid from the extended card>"},
"parts":[{"data":{"systemOne":{"version":1,"kind":"ledger_balance","params":{"ledger":"HDFC Bank"}}}}]}}}'
The task is TASK_STATE_COMPLETED and its result artifact holds a line of text and a data part:
{"systemOne":{"version":1,"kind":"ledger_balance",
"result":{"ledger":{"name":"HDFC Bank","group":"Bank Accounts"},"balance":120000,"drCr":"Dr","basis":"tally_closing"},
"asOf":"2026-10-12T05:00:00.000Z","company":{"guid":"...","name":"Sharma Traders"},"freshness":"2026-10-12T05:00:00.000Z"}}
| Kind | Params | Answers |
|---|---|---|
ledger_balance |
ledger, asOf? |
Tally's closing balance; with asOf, the balance on that date, from the start of the stored financial year up to its end or today, whichever is earlier |
party_outstanding |
party, asOf? |
What a customer owes or a supplier is owed, checked against the ledger, with up to 50 open bills |
trial_balance |
from?, to? |
Tally's trial balance for the financial year to date (to may be any day from the stored end to today) |
profit_and_loss |
from, to |
Net profit and income/expense totals for the financial year to date (from is the year's start; to may be any day from the stored end to today) |
voucher_lookup |
voucherNumber, or date + amount |
One voucher and its entries |
stock_position |
item?, asOf? |
Tally's closing stock (one item, or all; over 1,000 items the list is cut and marked truncated) |
cash_bank_position |
asOf? |
Cash in hand plus bank balances (asOf may be any day from the stored date to today) |
Amounts are signed: positive is debit, negative is credit. Dates are YYYY-MM-DD. The schema is in our agent
card, under capabilities.extensions (System One). A key needs the Typed asks skill; a key with only that
skill can send typed asks and nothing else. A typed ask is always answered in the SendMessage response.
Sent with SendStreamingMessage, a typed ask returns its finished task as a single event and the stream closes.
A name that matches more than one record, a period other than the stored financial year to date, a date the
books do not hold, a company whose books have not synced yet (not_synced) or a statement too long to carry
(too_large) ends the task TASK_STATE_FAILED with a data part such as
{"reason":"ambiguous","systemOne":{"error":"ambiguous","candidates":[{"name":"Rent","group":"Direct Expenses"},{"name":"Rent","group":"Indirect Expenses"}]}}
(at most 10 candidates). An unknown kind or a bad field is refused at once with -32602, naming the field.
If the key reaches several companies, name one in metadata.companyGuid; one outside the key ends the task
TASK_STATE_REJECTED (company_not_allowed), and no company named when several are possible ends it
company_required.
Billing
Each answer uses credits from your workspace wallet, like a question asked in chat. The extended agent
card reports the wallet as ok, low or empty. A typed ask that is answered costs a flat 5 credits (₹0.50). A refused or failed one costs nothing.
