> ## Documentation Index
> Fetch the complete documentation index at: https://docs.riza.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Input

> Passing input to your script

Your script has access to initial input data from four sources: files, `stdin`,
command line arguments and environment variables.

## Files

See the [files reference documentation](/reference/files).

## `stdin`

The [execute code](/api-reference/command/execute-code) endpoint accepts a string
`stdin` parameter. The API sets any value you provide as stdin for the executed
script.

## Command line arguments

You can provide a list of strings to the [execute code](/api-reference/command/execute-code)
endpoint via the `args` parameter. The API passes these values as command line arguments
to your script.

<Note>
  When accessed within a script, the first argument will always be the absolute path to
  the file containing the script's source code. The value is meaningless outside of the
  Riza environment.
</Note>

## Environment variables

You can provide string key-value pairs to the [execute code](/api-reference/command/execute-code)
endpoint via the `env` parameter. The API sets these values as environment variables
accessible from within your script.

<RequestExample>
  ```js Node theme={null}
  import Riza from '@riza-io/api';

  const pythonCode = `
  import sys
  import os

  print("stdin", sys.stdin.read())
  print("args", sys.argv)
  print("env", dict(os.environ))
  `;

  const riza = new Riza();

  async function main() {
    const resp = await riza.command.exec({
      language: "python",
      code: pythonCode,
      stdin: "Hello", 
      args: ["one", "two"],
      env: {
        "DEBUG": "true",
      }
    });
    console.log(resp.stdout);
  }

  main();
  ```

  ```py Python theme={null}
  from rizaio import Riza

  CODE = """
  import sys
  import os

  print("stdin", sys.stdin.read())
  print("args", sys.argv)
  print("env", dict(os.environ))
  """

  client = Riza()

  resp = client.command.exec(
      language="python",
      code=CODE,
      stdin="Hello",
      args=["one", "two"],
      env={
          "DEBUG": "true",
      }
  )

  print(resp.stdout)
  ```

  ```go Go theme={null}
  package main

  import (
      "context"
      "log"
      "log/slog"

      "github.com/riza-io/riza-api-go"
  )

  const pythonCode = `
  import sys
  import os

  print("stdin", sys.stdin.read())
  print("args", sys.argv)
  print("env", dict(os.environ))
  `

  func main() {
      client := riza.NewClient()
      params := riza.CommandExecParams{
          Language: riza.F(riza.CommandExecParamsLanguagePython),
          Code:     riza.F(pythonCode),
          Stdin:    riza.F("Hello"),
          Args:     riza.F(
              []string{"one": "two"},
          ),
          Env:      riza.F(
              map[string]string{"DEBUG": "true"},
          ),
      }
      resp, err := client.Command.Exec(context.TODO(), params)
      if err != nil {
          log.Fatal(err)
      }
      slog.Info(
          resp.Stdout, 
          "code", resp.ExitCode,
          "stderr", resp.Stderr,
      )
  }
  ```
</RequestExample>

<ResponseExample>
  ```text Output theme={null}
  stdin Hello
  args ['/src/code.py', 'one', 'two']
  env {'DEBUG': 'true'}
  ```
</ResponseExample>
