What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can build a first AI agent with a few lines of Python or JavaScript: give it instructions, connect it to a model, and run it once. The simplest tutorial path is to make that one-turn agent work before adding tools, memory, or workflows. The code can be free to run if you use an eligible free model tier or a local model, but hosted free tiers have limits; the OpenAI Agents SDK examples below require an OpenAI API key and should not be assumed to have free API usage.

This guide starts with a runnable baseline, then shows how to add a tool and choose a no-cost learning setup. If you are wondering whether to start with Python, JavaScript, Gemini, or an agent framework, begin with whichever language you can run comfortably and postpone framework comparisons until you know what you want the agent to do.

What is the quickest way to build your first AI agent?

Start with Python and the OpenAI Agents SDK: create a virtual environment, install the package, set an API key outside your code, define one narrowly scoped agent, and run one prompt. This first example is intentionally a single-turn baseline. It does not browse the web, remember earlier prompts, or perform actions on your computer.

1. Create a project and install the SDK

Install a current Python version supported by the SDK, then run these commands in a terminal from your project directory:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
python -m venv .venv

# macOS or Linux
source .venv/bin/activate

# Windows PowerShell
.venvScriptsActivate.ps1

pip install openai-agents

Use the activation command for your shell, not both. If PowerShell blocks activation, you can use Command Prompt with .venvScriptsactivate.bat instead. Keep the project environment active when installing and running the package so that Python uses the intended dependencies.

2. Set your API key without putting it in the script

Create an API key with your chosen model provider and set it as an environment variable in the shell where you will run the program. For an OpenAI key, the variable name is OPENAI_API_KEY:

# macOS or Linux, for this terminal session
export OPENAI_API_KEY="your-key-here"

# Windows PowerShell, for this terminal session
$env:OPENAI_API_KEY="your-key-here"

Replace the example value locally; do not commit a real key to source control, paste it into a public issue, or send it to an agent as ordinary prompt text. Shell environment variables set this way normally apply only to the current terminal session. If you use another model provider, follow that provider’s credential and SDK setup instructions; changing the environment variable alone does not automatically make a provider’s models compatible with every SDK.

3. Define one agent and run one prompt

Save the following as first_agent.py:

import asyncio
from agents import Agent, Runner

agent = Agent(
    name="History tutor",
    instructions=(
        "You are a patient history tutor. Answer in plain language. "
        "If a question is ambiguous, ask one short clarifying question."
    ),
)

async def main():
    result = await Runner.run(
        agent,
        "Why was the printing press important in Europe?",
    )
    print(result.final_output)

if __name__ == "__main__":
    asyncio.run(main())

Run it from the activated environment with python first_agent.py. A successful run prints the model’s final answer. The Agent holds the name and instructions; Runner.run executes the request; and final_output is the user-facing result. The SDK also exposes run information that becomes useful when you add tools or need to inspect what happened.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The OpenAI Agents SDK quickstart has first-agent examples in both Python and JavaScript, and its documentation describes a progression from simple code agents to more advanced runtime patterns. For this first run, keep the prompt and role narrow. A short, testable task makes it easier to tell whether the instructions, model response, and setup are working.

Can you build an agent in JavaScript instead?

Yes. Use JavaScript if your project already runs on Node.js or you prefer npm. The same basic concepts apply: instructions, an agent object, one run, and a final response. The following is the corresponding minimal pattern from the JavaScript quickstart.

Install and configure

npm init -y
npm install @openai/agents zod

Set OPENAI_API_KEY in the shell before running your app, using the appropriate environment-variable syntax for your operating system. Keep the credential out of the project files and repository.

Run one turn

Save as first-agent.mjs:

import { Agent, run } from "@openai/agents";

const agent = new Agent({
  name: "History tutor",
  instructions:
    "You are a patient history tutor. Answer in plain language. " +
    "If a question is ambiguous, ask one short clarifying question.",
});

const result = await run(
  agent,
  "Why was the printing press important in Europe?",
);

console.log(result.finalOutput);

Run node first-agent.mjs. JavaScript uses finalOutput in camel case; Python’s example uses final_output. The package command includes zod, which is useful for typed schemas and structured data when you move beyond plain text output.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How can you make the agent free to learn with?

The SDK and the model that answers its requests are separate choices. Installing an agent framework does not provide free inference by itself. For a no-cost learning run, choose a model service whose current terms explicitly include a free tier, or run a local model on hardware you control. Neither option should be treated as unlimited: hosted limits and eligible models can change, and local inference depends on your machine and the model license.

Option 1: Use an eligible Gemini API free tier

Google’s Gemini API pricing page lists eligible free-tier models with free input and output tokens, alongside paid model rates. Availability and caps vary by model and can change, so check the current pricing and quota information before designing an app around a free allowance. Google AI Studio is part of the path for getting started, but a free-tier quota is a prototype and learning option, not a promise of unlimited production use.

The examples in this tutorial use OpenAI’s SDK and environment variable as a simple first run; they do not silently switch to Gemini. To use Gemini, choose Google’s supported SDK or follow the provider integration instructions for the framework and model you select. Confirm that the chosen combination supports the features you need, such as function calling, structured outputs, or tracing.

Option 2: Run a model locally

Hugging Face documents a local-app route that includes Ollama and an OpenAI-compatible API server. Local inference avoids a per-request hosted API charge, but it is not cost-free in every practical sense: your computer must have enough memory and processing capacity, generation may be slower on modest hardware, and each model has its own license. Check the license for the specific model and intended use rather than assuming every downloadable model permits every application.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Option 3: Use a hosted provider allowance carefully

Some inference services provide a limited free allowance. For example, Hugging Face’s pricing documentation describes a free-user allowance of $0.10, subject to change. Treat small allowances as experimentation budget, not a durable operating plan. For any provider, check current pricing, rate limits, eligible models, and whether charges apply after a cap before sending real user workloads.

What should you add after the first successful run?

Do not add every agent feature at once. Grow the program in steps so that each new behavior is observable and testable. Microsoft’s Agent Framework getting-started tutorial follows a similar progression: first agent, tools, conversations, memory, workflows, harness, and hosting.

Add one tool for one concrete capability

A tool lets the agent request an operation that ordinary text generation cannot perform by itself, such as looking up a value or calling an API. A function tool has four parts: a clear tool name and description, an input schema, the function that performs the operation, and a result or error returned to the agent. Start with a harmless, deterministic function, such as looking up a fixed list of FAQ answers.

Keep tool functions narrow. Validate their inputs, handle expected failures, and avoid granting broad file, shell, or network access just because a model can call a tool. A model may choose when to call an available tool, but your code is responsible for deciding what the tool is allowed to do and what to do when it fails. The OpenAI Agents SDK documentation covers function and hosted tools; use its current examples for the exact decorators and schemas supported by the version you install.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Add conversation state only when a second turn needs it

A single call answers one prompt. A chat experience needs a way to carry earlier messages or session state into later turns; otherwise, the agent has no reliable conversational context from the previous request. Use the SDK’s documented session or conversation mechanism for short-term multi-turn context. For durable memory across sessions, decide what to store, for how long, and how users can review or delete it before adding persistence.

Use handoffs and workflows for real orchestration needs

Handoffs are useful when a specialist agent should take responsibility for a request. Agents-as-tools can be useful when a coordinating agent needs a specialist’s result but retains control. A workflow is appropriate when a task has multiple deliberate steps, conditions, or validations. OpenAI’s SDK documentation also describes guardrails and structured outputs. These are not prerequisites for a first agent: add them in response to a real requirement, not to make a small example look more sophisticated.

Inspect runs and evaluate before expanding

Once tools or multiple steps are involved, inspect run history or tracing to see model calls and tool actions. Write a small set of representative prompts and expected behaviors before changing instructions. Check not only whether the answer sounds plausible, but whether the agent called the correct tool, handled an error, and avoided actions outside its intended scope. Evaluation and tracing help expose failures that a single successful demo cannot.

Which agent framework should a beginner choose?

There is no universal best framework. Choose based on the first task you want to finish and the environment you already understand. The comparison below describes the options at a high level; exact language support, integrations, and pricing depend on the current framework and model choices.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Starting point Best fit for a first project What to check before committing
OpenAI Agents SDK A code-first agent in Python or JavaScript, with a documented path to tools, handoffs, guardrails, structured outputs, and tracing. Model-provider compatibility, hosted inference cost, and the SDK’s current tool and state APIs.
Microsoft Agent Framework A staged learning path that moves from a first agent through tools, conversations, memory, workflows, harness, and hosting. Whether its language and model integrations match your stack and deployment needs. The getting-started page was last updated 2026-08-25.
Google ADK Developers who want Google’s agent development toolkit and its build, manage, evaluate, and deploy workflow. Supported languages, model choices, current Gemini quotas, and whether the framework fits your target runtime.
Local model and local app Learning offline or avoiding hosted per-call inference charges when your hardware is suitable. Hardware needs, speed, model license, setup work, and the local API or framework integration.

For your first afternoon, the simplest comparison is often not framework versus framework: it is which setup gets one prompt working and lets you inspect what happened. Python and JavaScript both have official OpenAI first-agent quickstarts. Google’s ADK is designed for building, managing, evaluating, and deploying agents. Microsoft’s tutorial provides a useful sequence for learning concepts one at a time. Move to the option that serves your actual model, language, privacy, observability, and hosting requirements.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If an agent needs to inspect a web page, a screenshot can be a useful tool result. You can build a browser automation flow yourself, but handling browser installation, page readiness, consent dialogs, and output files adds setup. ScreenshotNeo is a website screenshot API and MCP server for developers; it is not an agent framework, but an agent or application can use its capture endpoint as one part of a larger workflow.

One GET request returns an image or PDF. This cURL example saves a WebP screenshot of Stripe; replace the URL with the page you want to capture. See the ScreenshotNeo API documentation for request parameters and response details.

curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://stripe.com 
  -o shot.webp

ScreenshotNeo accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and whether the request was billed. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000. Learn more at ScreenshotNeo, or sign up for the free plan.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting a first agent

  • Missing API key: The process cannot read OPENAI_API_KEY, or the variable is set in a different terminal. Set it in the same shell you use to run the script, then rerun the command.
  • Authentication or permission error: Check that the key is copied correctly, is active, and belongs to an account with access to the selected model. Do not print the key while debugging; verify that the variable exists without revealing its value.
  • Package or import error: Confirm that the virtual environment is active and install the package into that environment. In Python, check that the executable running the script is the same environment where openai-agents was installed.
  • JavaScript module syntax error: Use the .mjs extension as shown, or configure your project for ES modules before using import syntax.
  • Quota, rate-limit, or billing response: A valid key does not guarantee free or unlimited model access. Check the provider’s current usage limits, account billing configuration, selected model availability, and retry guidance.
  • The answer ignores the role: Make instructions concrete and specific to one job. Try a representative prompt, then revise one instruction at a time rather than adding a long list of conflicting rules.
  • The agent cannot perform an action: Instructions alone do not grant tools or computer access. Add an explicit tool, define its allowed inputs and behavior, and ensure its result or failure is returned to the run.
  • A multi-step run is hard to diagnose: Inspect run history or tracing and separate the task into smaller steps. Verify tool inputs and outputs before introducing handoffs or additional agents.

Frequently Asked Questions

Does an AI agent need to be autonomous or use multiple agents?

No. A narrowly scoped agent that follows instructions and returns one useful answer is a valid first agent; add autonomy or multiple specialists only when the task requires them.

Can I keep an agent completely private by using a local model?

Local inference can keep model processing on your own machine, but privacy also depends on the application, tools, logs, and any services your code calls. Review the specific model license and your full data flow.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.