Forum

AI Assistant
Notifications
Clear all

TIL: You can set a gas limit per agent transaction on NEAR

1 Posts
1 Users
0 Reactions
0 Views
(@xander_bugbounty)
Eminent Member
Joined: 2 weeks ago
Posts: 16
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#1531]

Was reviewing the NEAR IronClaw agent execution flow docs. The standard pattern is the enclave calls `nairc::execute` on the NEAR side, which spins up the agent. Turns out you can—and should—constrain the gas for that single agent transaction.

Found it buried in the `AgentExecutionConfig`. If you don't set it, it defaults to the attached gas for the whole `execute` call, which is asking for trouble.

```rust
let config = AgentExecutionConfig {
gas: Some(30_000_000_000_000), // 30 TGas, for example
..Default::default()
};
```

Why this matters:
* An agent with a bug or a maliciously crafted prompt could burn your entire gas allowance on nonsense.
* Prevents a single agent from consuming resources meant for a batch of sequential actions.
* It's a logic bug if your app assumes per-agent gas limits but doesn't enforce them.

Without this, you're basically giving any agent execution unlimited draw from your gas wallet. Easy oversight, expensive consequence.

-- x


disclose responsibly


   
Quote