Skip to content

feat: submit agent-wallet transactions from Python#122

Merged
MicBun merged 2 commits into
mainfrom
feat/maa-exec-submission
Jun 16, 2026
Merged

feat: submit agent-wallet transactions from Python#122
MicBun merged 2 commits into
mainfrom
feat/maa-exec-submission

Conversation

@MicBun

@MicBun MicBun commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

resolves: https://github.com/truflation/website/issues/4085

A Python app can already set up and observe an agent wallet (derive, create the rule, join/fund, read back). It still cannot make the agent act. This adds TNClient.execute_agent_action, so a delegated restricted key can run its allow-listed actions as the wallet and the unrestricted owner can withdraw — closing the operate-the-agent half of the MAA lifecycle for Python.

  • Thin gopy wrapper over sdk-go's ExecuteAgentAction (no new protocol logic); inner-action args cross the boundary as JSON decoded with UseNumber(), the existing action-args convention.
  • Re-pins sdk-go and kwil-db to the merged maa_exec submission path.
  • Pure-unit tests for input validation, namespace defaulting, and arg type fidelity (SDK-level integration is intentionally deferred to the node E2E, per the feat: insert large data into multiple stream #9 plan).

Builds on:

Summary by CodeRabbit

  • New Features

    • New execute_agent_action method enables executing allow-listed inner actions on behalf of agent wallets with automatic address validation and JSON serialization.
  • Tests

    • Added comprehensive unit tests for agent action execution, validating address formats, input normalization, and error handling.
  • Chores

    • Updated dependencies to latest versions.

@holdex

holdex Bot commented Jun 16, 2026

Copy link
Copy Markdown

Time Submission Status

Member # Time Running Total Status Last Update
MicBun 4h ✅ Submitted Jun 16, 2026, 9:58 AM

Submit or update total time with:

@holdex pr submit-time 2h

Add time on top of previous submission with:

@holdex pr add-time 1h30m

See available commands to help comply with our Guidelines.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@MicBun, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 43 minutes and 2 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 660b0545-406d-45d2-9bf2-e24160a9873d

📥 Commits

Reviewing files that changed from the base of the PR and between 23fe4cc and 0b7cdc6.

📒 Files selected for processing (2)
  • src/trufnetwork_sdk_py/client.py
  • tests/test_maa_exec.py
📝 Walkthrough

Walkthrough

Adds MAAExec support across the stack: a Go binding parses JSON-encoded args and calls ExecuteAgentAction for maa_exec transactions; a Python execute_agent_action method validates/normalizes inputs via _maa_exec_args and invokes the binding; unit tests cover address normalization, namespace defaulting, and arg serialization. Go module dependencies are bumped to enable the new types.MAAExecuteInput.

Changes

MAA Execute Agent Action

Layer / File(s) Summary
Go MAAExec binding and dependency bump
go.mod, bindings/maa.go
Bumps sdk-go and kwil-db pseudo-versions in go.mod; adds types import, MAAExec function, and decodeMAAArgs helper that parses a JSON array with UseNumber and coerces json.Number to int64 or float64.
Python execute_agent_action and _maa_exec_args
src/trufnetwork_sdk_py/client.py
Adds _maa_exec_args static helper (address bytes/hex normalization to 20 bytes, namespace default, JSON serialization of args) and execute_agent_action method that invokes truf_sdk.MAAExec and optionally waits for the transaction.
Unit tests for _maa_exec_args
tests/test_maa_exec.py
Adds eight pytest functions covering address bytes/hex normalization, empty namespace defaulting to "main", action pass-through, invalid address lengths, empty action, JSON type preservation, empty args serializing to "[]", and non-serializable args raising ValueError.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 A hop through JSON, an action to call,
MAAExec arrives to handle them all.
Twenty bytes, a namespace, an action in hand,
The rabbit has wired it just as planned.
int64 or float, the numbers stay true—
Now agent wallets know just what to do! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding agent-wallet transaction submission capability to the Python SDK.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/maa-exec-submission

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/trufnetwork_sdk_py/client.py`:
- Around line 3657-3660: The json.dumps call at line 3658 allows NaN and
Infinity values which serialize to invalid JSON that Go decoders reject
downstream. Add the allow_nan=False parameter to the json.dumps call to reject
non-finite floats early at the Python layer with validation. Additionally, when
allow_nan=False is set, json.dumps raises ValueError (not just TypeError) for
non-finite float values, so update the except clause to catch both TypeError and
ValueError exceptions and ensure the error message appropriately describes JSON
serialization failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a0834810-b9c3-4ca8-bfde-5949d141e56e

📥 Commits

Reviewing files that changed from the base of the PR and between 53aec08 and 23fe4cc.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • bindings/maa.go
  • go.mod
  • src/trufnetwork_sdk_py/client.py
  • tests/test_maa_exec.py

Comment thread src/trufnetwork_sdk_py/client.py Outdated
@MicBun MicBun self-assigned this Jun 16, 2026
@MicBun

MicBun commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@holdex pr submit-time 4h

@MicBun
MicBun merged commit 3dcc8fa into main Jun 16, 2026
6 checks passed
@MicBun
MicBun deleted the feat/maa-exec-submission branch June 16, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant