# Session keys with outside execution

[Outside Execution](/aa-use-cases/outside-execution.md) (Meta-transactions in the Ethereum world)  allows external contracts to execute transactions from outside an account contract, thereby opening up new use-cases such as sponsored transactions, deploying an account on behalf of a user, transaction scheduling (limit orders) etc.

The setup is exactly the same as the "basic" session keys.  We simply have a few more steps to do:

#### 1. Prepare the contract call

```tsx
// example for creating the calldata
const erc20Contract = new Contract(
  Erc20Abi as Abi,
  ETHTokenAddress,
  sessionAccount
)

const calldata = erc20Contract.populate("transfer", {
  recipient: address,
  amount: parseInputAmountToUint256(amount)
})

```

#### 2. Prepare Execution from outside

Here you have two possibilities. Depending on your setup, you can chose between a "higher level" function with `createOutsideExecutionCall`  which returns a signed call and a "lower level" with `createOutsideExecutionTypedData`  which returns the session acout signature and the typed data.&#x20;

#### a. Get the raw Execute from outside call

```typescript
import { createOutsideExecutionCall } from "@argent/x-sessions"

const efoExecutionCall = await createOutsideExecutionCall({
        session, // same object as before
        sessionKey, // same object as before
        calls: [calldata],
        argentSessionServiceUrl: ARGENT_SESSION_SERVICE_BASE_URL,
        network:
          CHAIN_ID === constants.NetworkName.SN_SEPOLIA ? "sepolia" : "mainnet",
      })
```

#### 2.b. Get the signed Execute from outside call

```typescript
import { createOutsideExecutionTypedData } from "@argent/x-sessions"

const { signature, outsideExecutionTypedData } =
  await createOutsideExecutionTypedData({
    session,
    sessionKey,
    calls: [calldata],
    argentSessionServiceUrl: ARGENT_SESSION_SERVICE_BASE_URL
    network // values "mainnet" | "sepolia", default to "mainnet"
  })
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ready.co/aa-use-cases/session-keys/session-keys-with-outside-execution.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
