Quickstart: your first code agent

From nothing to an agent that runs in the cloud, in a few minutes.

Beta: request access. Code agents are in beta and are switched on for each agency by hand. Names and limits can still change. Request access

What you need

  • Python 3.9 or newer, or Node 18 or newer.
  • An Inflowave API token. In the app, open Developer, then API tokens. The token starts with iwa_.
  • Beta access for your agency. If the Developer area is missing, request access.

The steps

1. Install, log in, create and run on your computer

pip install inflowave-cli          # also installs the Python SDK
inflowave login                    # paste your token
inflowave agents create hello-python
cd hello-python
inflowave agents run

The run prints every log line and progress step. At the end it shows the result rows, the files and the charges. Nothing is billed on your computer, and everything is written to a storage folder next to your code.

Change main.py, run it again, and repeat until it does what you want.

2. Check, push and call it in the cloud

inflowave agents check
inflowave agents push
inflowave agents call hello-python --input storage/input.json --wait
inflowave agents logs RUN_ID
  • check tells you whether agent.json is valid, before anything leaves your computer.
  • push packs the folder, uploads it, waits for the security scan and follows the build. See Uploads and test runs.
  • call starts a real run in Inflowave. With the wait option it waits for the result. The run prints an id, and logs shows that run's log.

Your agent is private to your own agency until you choose otherwise, so these first runs are free and need no review.

Hello, Python

This is the file inflowave agents create writes for you. The main files in the folder are the program, the list of packages, agent.json and a sample input.

main.py

from inflowave_agent import Agent

with Agent() as agent:
    data = agent.get_input()
    keyword = data.get("keyword", "world")
    agent.info("Working on %s" % keyword)
    agent.progress(50, "Halfway")
    agent.push_data({"keyword": keyword, "greeting": "Hello, %s" % keyword})
    agent.charge("result")
    agent.done("Said hello to %s" % keyword)

requirements.txt

inflowave-agent>=0.1.0

agent.json

{
  "schema": "inflowave.agent/v1",
  "id": "hello-python",
  "runtime": { "kind": "code", "command": "python main.py", "timeout_s": 300, "memory_mb": 512 },
  "listing": {
    "name": "Hello Python",
    "tagline": "Says hello to a keyword. Replace this with one clear sentence.",
    "about": "Describe what the agent does, what the buyer gives it and what they get back.",
    "category": "Utilities",
    "price_usd": 0,
    "price_model": "per_run",
    "visibility": "private"
  },
  "inputs": [{ "id": "keyword", "type": "text", "label": "Keyword", "placeholder": "world", "required": true }],
  "pricing": { "events": { "result": { "title": "A finished result", "price_cents": 50 } }, "default_cap_cents": 500 },
  "test_input": { "keyword": "world" },
  "changelog": [{ "version": "1.0", "notes": ["First version."] }]
}

storage/input.json

The sample input used by inflowave agents run on your computer.

{ "keyword": "world" }

Hello, Node

Add the template option to create a Node agent. Node agents also need one npm install in the folder. Its agent.json is the same as the Python one, except that the command is node main.js and the id is hello-node.

inflowave agents create hello-node --template node
cd hello-node
npm install
inflowave agents run

main.js

import { Agent } from '@inflowave/agent';

await Agent.main(async (agent) => {
  const data = await agent.getInput();
  const keyword = data.keyword ?? 'world';
  agent.info(`Working on ${keyword}`);
  agent.progress(50, 'Halfway');
  await agent.pushData({ keyword, greeting: `Hello, ${keyword}` });
  agent.charge('result');
  agent.done(`Said hello to ${keyword}`);
});

package.json

{
  "name": "hello-node",
  "version": "0.1.0",
  "private": true,
  "type": "module",
  "dependencies": { "@inflowave/agent": "^0.1.0" }
}

What next

  • See every call in the SDK reference.
  • See every command in the CLI reference.
  • Describe your agent properly in the manifest.
  • When it works, open the agent in the app, run the test, and press Submit for review if you want to offer it to others.

If you hit a problem: "You are not logged in" means run inflowave login. A message that a charge is not listed means the name in charge must match an entry in pricing.events. For Node, "cannot find @inflowave/agent" means run npm install in the agent folder.

Want to build one?

Tell us about your agency and what you would like to build. We will switch the beta on for your account.