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

# Simple Agent

> Run a minimal agent with Run() using the in-process runtime and no extra setup

Minimal agent with a system prompt, LLM client, and a single blocking `Run()`. Use this to verify your LLM credentials and SDK install before adding tools or Temporal.

Source: [`examples/simple_agent/`](https://github.com/agenticenv/agent-sdk-go/tree/main/examples/simple_agent)

## What it demonstrates

* `NewAgent` with `WithLLMClient` and `WithSystemPrompt`
* Blocking `Run()` returning `AgentRunResult`
* Optional token usage footer via `SHOW_LLM_USAGE=true`

## Run

From `examples/`:

```bash theme={null}
go run ./simple_agent "Hello, what can you do?"
SHOW_LLM_USAGE=true go run ./simple_agent "Hello"
```

## Key code

The example loads LLM settings from `examples/.env` and calls `Run` once:

```go theme={null}
a, err := agent.NewAgent(
    agent.WithName("simple-agent"),
    agent.WithSystemPrompt("You are a helpful assistant that can generate text."),
    agent.WithLLMClient(llmClient),
    // config.RuntimeOption(cfg) adds WithTemporalConfig when AGENT_RUNTIME=temporal
)
if err != nil {
    log.Fatal(err)
}
defer a.Close()

result, err := a.Run(ctx, prompt, nil)
fmt.Println(result.Content)
```

For a from-scratch module without the examples helper package, follow the [Quickstart](/getting-started/quickstart).

## Expected output

```
I'm a helpful assistant that can answer questions, explain concepts, summarize content,
and help with a wide range of text-based tasks. What would you like to explore?

--- LLM Usage ---
Input tokens:  45
Output tokens: 38
```

The LLM response varies; the optional usage footer appears only when `SHOW_LLM_USAGE=true`.

## Learn more

<CardGroup cols={2}>
  <Card title="Quickstart" icon="bolt" href="/getting-started/quickstart">
    Build an agent in your own module
  </Card>

  <Card title="Tools" icon="wrench" href="/examples/tools">
    Add built-in and custom tools
  </Card>

  <Card title="Configuration" icon="sliders" href="/getting-started/configuration">
    All agent options
  </Card>
</CardGroup>
